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.
| Argument | Type | Required | Description |
|---|---|---|---|
publicAPI | Yes | object on which methods will be bounds (public) | |
model | Yes | object on which data structure will be bounds (protected) | |
initialValues | IGLTFImporterInitialValues | No | (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.
| Argument | Type | Required | Description |
|---|---|---|---|
options | IGLTFImporterOptions | No |
newInstance
Method used to create a new instance of vtkGLTFImporter
| Argument | Type | Required | Description |
|---|---|---|---|
initialValues | IGLTFImporterInitialValues | No | for pre-setting some of its content |
onReady
| Argument | Type | Required | Description |
|---|---|---|---|
callback | Yes |
parse
Parse data.
| Argument | Type | Required | Description |
|---|---|---|---|
content | String or ArrayBuffer | Yes | The content to parse. |
parseAsArrayBuffer
Parse data as ArrayBuffer.
| Argument | Type | Required | Description |
|---|---|---|---|
content | ArrayBuffer | Yes | The content to parse. |
parseAsText
Parse data as text.
| Argument | Type | Required | Description |
|---|---|---|---|
content | String | Yes | The content to parse. |
requestData
| Argument | Type | Required | Description |
|---|---|---|---|
inData | Yes | ||
outData | Yes |
setCamera
Set the camera id.
| Argument | Type | Required | Description |
|---|---|---|---|
cameraId | Yes | The camera id. |
setDataAccessHelper
| Argument | Type | Required | Description |
|---|---|---|---|
dataAccessHelper | Yes |
setDracoDecoder
Set the Draco decoder.
| Argument | Type | Required | Description |
|---|---|---|---|
dracoDecoder | Yes |
setRenderer
Set the vtk Renderer.
| Argument | Type | Required | Description |
|---|---|---|---|
renderer | Yes | The vtk Renderer. |
setUrl
Set the url of the object to load.
| Argument | Type | Required | Description |
|---|---|---|---|
url | String | Yes | the url of the object to load. |
option | IGLTFImporterOptions | No | The Draco reader options. |
setWasmBinary
Load the WASM decoder from url and set the decoderModule
| Argument | Type | Required | Description |
|---|---|---|---|
url | Yes | ||
binaryName | Yes |
switchToVariant
Switch to a variant.
| Argument | Type | Required | Description |
|---|---|---|---|
variantIndex | Yes | The index of the variant to switch to. |