Skip to content

GLTFImporter

Introduction

vtkGLTFImporter can import glTF 2.0 files.

The GL Transmission Format (glTF) is an API-neutral runtime asset delivery format. A glTF asset is represented by:

  • A JSON-formatted file (.gltf) containing a full scene description: node hierarchy, materials, cameras, as well as descriptor information for meshes, animations, and other constructs
  • Binary files (.bin) containing geometry and animation data, and other buffer-based data
  • Image files (.jpg, .png) for textures

Supported extensions:

  • KHR_draco_mesh_compression
  • KHR_lights_punctual
  • KHR_materials_unlit
  • KHR_materials_ior
  • KHR_materials_specular
  • KHR_materials_variants
  • EXT_texture_webp
  • EXT_texture_avif

Methods

extend

Method used to decorate a given object (publicAPI+model) with vtkGLTFImporter characteristics.

ArgumentTypeRequiredDescription
publicAPIYesobject on which methods will be bounds (public)
modelYesobject on which data structure will be bounds (protected)
initialValuesIGLTFImporterInitialValuesNo(default: {})

getActors

Get the actors.

getAnimationMixer

Get the animation mixer.

getAnimations

Get the animations.

getBaseURL

Get the base url.

getCameras

Get the cameras.

getDataAccessHelper

getUrl

Get the url of the object to load.

getVariantMappings

Get the variant mappings.

getVariants

Get the variant array.

importActors

Import the actors.

importAnimations

Import the animations.

importCameras

Import the cameras.

importLights

Import the lights.

invokeReady

Invoke the ready event.

loadData

Load the object data.

ArgumentTypeRequiredDescription
optionsIGLTFImporterOptionsNo

newInstance

Method used to create a new instance of vtkGLTFImporter

ArgumentTypeRequiredDescription
initialValuesIGLTFImporterInitialValuesNofor pre-setting some of its content

onReady

ArgumentTypeRequiredDescription
callbackYes

parse

Parse data.

ArgumentTypeRequiredDescription
contentString or ArrayBufferYesThe content to parse.

parseAsArrayBuffer

Parse data as ArrayBuffer.

ArgumentTypeRequiredDescription
contentArrayBufferYesThe content to parse.

parseAsText

Parse data as text.

ArgumentTypeRequiredDescription
contentStringYesThe content to parse.

requestData

ArgumentTypeRequiredDescription
inDataYes
outDataYes

setCamera

Set the camera id.

ArgumentTypeRequiredDescription
cameraIdYesThe camera id.

setDataAccessHelper

ArgumentTypeRequiredDescription
dataAccessHelperYes

setDracoDecoder

Set the Draco decoder.

ArgumentTypeRequiredDescription
dracoDecoderYes

setRenderer

Set the vtk Renderer.

ArgumentTypeRequiredDescription
rendererYesThe vtk Renderer.

setUrl

Set the url of the object to load.

ArgumentTypeRequiredDescription
urlStringYesthe url of the object to load.
optionIGLTFImporterOptionsNoThe Draco reader options.

setWasmBinary

Load the WASM decoder from url and set the decoderModule

ArgumentTypeRequiredDescription
urlYes
binaryNameYes

switchToVariant

Switch to a variant.

ArgumentTypeRequiredDescription
variantIndexYesThe index of the variant to switch to.