Home Reference Source
public class | source

GLTF2Loader

This is a loader class of glTF2 file format. You can see more detail of glTF2 format at https://github.com/KhronosGroup/glTF .

Static Member Summary

Static Public Members
public static

Static Method Summary

Static Public Methods
public static

The static method to get singleton instance of this class.

Constructor Summary

Public Constructor
public

constructor(enforcer: Symbol)

The constructor of GLTFLoader class.

Member Summary

Private Members
private

_materials: *[]

Method Summary

Public Methods
public

loadGLTF(uri: string, options: Object): Promise

the method to load glTF2 file.

Private Methods
private

_accessArrayBufferAsImage(arrayBuffer: *, imageType: *): *

private

_accessBinaryAsImage(bufferViewStr: *, json: *, arrayBuffer: *, mimeType: *): *

private

_checkArrayBufferOfGltf(arrayBuffer: *, uri: *, options: *, defaultOptions: *, resolve: *)

private

_getImageType(imageType: *): *

private

_getOptions(defaultOptions: *, json: *, options: *): *

private

_loadAsBinaryJson(dataView: *, uri: *, isLittleEndian: *, arrayBuffer: *, options: *, defaultOptions: *, resolve: *)

private

_loadAsTextJson(arrayBuffer: *, uri: *, options: *, defaultOptions: *, resolve: *)

private
private
private
private
private
private
private
private
private
private

_loadInner(arrayBufferBinary: *, basePath: *, gltfJson: *, options: *): *

private

_loadJsonContent(gltfJson: *, resources: *, options: *)

private

_loadResources(arrayBufferBinary: *, basePath: *, gltfJson: *, options: *, resources: *): *

private

_mergeExtendedJson(gltfJson: *, extendedData: *)

private

_sliceBufferViewToArrayBuffer(json: *, bufferViewStr: *, arrayBuffer: *): *

Static Public Members

public static [singleton]: * source

Static Public Methods

public static getInstance(): GLTFLoader source

The static method to get singleton instance of this class.

Return:

GLTFLoader

The singleton instance of GLTFLoader class

Public Constructors

public constructor(enforcer: Symbol) source

The constructor of GLTFLoader class. But you cannot use this constructor directly because of this class is a singleton class. Use getInstance() static method.

Params:

NameTypeAttributeDescription
enforcer Symbol

a Symbol to forbid calling this constructor directly

Private Members

private _materials: *[] source

Public Methods

public loadGLTF(uri: string, options: Object): Promise source

the method to load glTF2 file.

Params:

NameTypeAttributeDescription
uri string

uri of glTF file

options Object
  • optional
  • default: {}

opition data for loading

Return:

Promise

Private Methods

private _accessArrayBufferAsImage(arrayBuffer: *, imageType: *): * source

Params:

NameTypeAttributeDescription
arrayBuffer *
imageType *

Return:

*

private _accessBinaryAsImage(bufferViewStr: *, json: *, arrayBuffer: *, mimeType: *): * source

Params:

NameTypeAttributeDescription
bufferViewStr *
json *
arrayBuffer *
mimeType *

Return:

*

private _checkArrayBufferOfGltf(arrayBuffer: *, uri: *, options: *, defaultOptions: *, resolve: *) source

Params:

NameTypeAttributeDescription
arrayBuffer *
uri *
options *
defaultOptions *
resolve *

private _getImageType(imageType: *): * source

Params:

NameTypeAttributeDescription
imageType *

Return:

*

private _getOptions(defaultOptions: *, json: *, options: *): * source

Params:

NameTypeAttributeDescription
defaultOptions *
json *
options *

Return:

*

private _loadAsBinaryJson(dataView: *, uri: *, isLittleEndian: *, arrayBuffer: *, options: *, defaultOptions: *, resolve: *) source

Params:

NameTypeAttributeDescription
dataView *
uri *
isLittleEndian *
arrayBuffer *
options *
defaultOptions *
resolve *

private _loadAsTextJson(arrayBuffer: *, uri: *, options: *, defaultOptions: *, resolve: *) source

Params:

NameTypeAttributeDescription
arrayBuffer *
uri *
options *
defaultOptions *
resolve *

private _loadDependenciesOfAccessors(gltfJson: *) source

Params:

NameTypeAttributeDescription
gltfJson *

private _loadDependenciesOfAnimations(gltfJson: *) source

Params:

NameTypeAttributeDescription
gltfJson *

private _loadDependenciesOfBufferViews(gltfJson: *) source

Params:

NameTypeAttributeDescription
gltfJson *

private _loadDependenciesOfJoints(gltfJson: *) source

Params:

NameTypeAttributeDescription
gltfJson *

private _loadDependenciesOfMaterials(gltfJson: *) source

Params:

NameTypeAttributeDescription
gltfJson *

private _loadDependenciesOfMeshes(gltfJson: *) source

Params:

NameTypeAttributeDescription
gltfJson *

private _loadDependenciesOfNodes(gltfJson: *) source

Params:

NameTypeAttributeDescription
gltfJson *

private _loadDependenciesOfScenes(gltfJson: *) source

Params:

NameTypeAttributeDescription
gltfJson *

private _loadDependenciesOfTextures(gltfJson: *) source

Params:

NameTypeAttributeDescription
gltfJson *

private _loadInner(arrayBufferBinary: *, basePath: *, gltfJson: *, options: *): * source

Params:

NameTypeAttributeDescription
arrayBufferBinary *
basePath *
gltfJson *
options *

Return:

*

private _loadJsonContent(gltfJson: *, resources: *, options: *) source

Params:

NameTypeAttributeDescription
gltfJson *
resources *
options *

private _loadResources(arrayBufferBinary: *, basePath: *, gltfJson: *, options: *, resources: *): * source

Params:

NameTypeAttributeDescription
arrayBufferBinary *
basePath *
gltfJson *
options *
resources *

Return:

*

private _mergeExtendedJson(gltfJson: *, extendedData: *) source

Params:

NameTypeAttributeDescription
gltfJson *
extendedData *

private _sliceBufferViewToArrayBuffer(json: *, bufferViewStr: *, arrayBuffer: *): * source

Params:

NameTypeAttributeDescription
json *
bufferViewStr *
arrayBuffer *

Return:

*