Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GLTFLoader

This class can be used to load the glTF file format, which describes scenes and models. It handles all buffer, texture and geometry creation as well as scene generation. Per glTF scene, one SceneNode is generated which represents the hierarchy of the scene.

const loader = new GLTFLoader(this._context);
await loader.loadAsset(GltfRenderer.assetURI);
const rootNode = loader.defaultScene;

Hierarchy

  • GLTFLoader

Index

Constructors

constructor

Properties

Protected _context

_context: Context

Protected _defaultScene

_defaultScene: SceneNode | undefined

Protected _pbrDefaultMaterial

_pbrDefaultMaterial: Material

Protected _pbrProgram

_pbrProgram: Program

Protected _resourceManager

_resourceManager: ResourceManager

Protected _sceneName

_sceneName: string

Protected _scenes

_scenes: Array<SceneNode>

Accessors

defaultScene

pbrProgram

scenes

Methods

Protected generateScenes

  • generateScenes(asset: GltfAsset, meshes: Array<GLTFMesh>): Promise<void>

Protected getTexture

  • getTexture(index: number): Texture2D | undefined

Protected inferBufferUsage

  • inferBufferUsage(asset: GltfAsset, bufferViewId: number): GLenum

loadAsset

  • loadAsset(uri: string): Promise<void>

Protected loadBuffers

  • loadBuffers(asset: GltfAsset): Promise<void>

Protected loadMaterials

  • loadMaterials(asset: GltfAsset): Promise<void>

Protected loadMeshes

  • loadMeshes(asset: GltfAsset): Promise<Array<GLTFMesh>>

Protected loadPrimitive

  • loadPrimitive(asset: GltfAsset, primitiveInfo: MeshPrimitive, id: number): Promise<GLTFPrimitive | undefined>

Protected loadTextures

  • loadTextures(asset: GltfAsset): Promise<void>

uninitialize

  • uninitialize(): void