Options
All
  • Public
  • Public/Protected
  • All
Menu

Class GltfAsset

Hierarchy

  • GltfAsset

Index

Constructors

constructor

Properties

bufferData

bufferData: BufferData

Helper for accessing buffer data

glbData

glbData: GLTFBinaryData | undefined

gltf

gltf: GlTf

The JSON part of the asset.

imageData

imageData: ImageData

Helper for accessing image data

Methods

accessorData

  • accessorData(index: GlTfId): Promise<Uint8Array>
  • Fetch the data associated with the accessor. Equivalent to bufferViewData for most accessors; special cases:

    • accessor.bufferView is undefined: create a buffer initialized with zeroes.
    • accessor.sparse is defined: Copy underlying buffer view and apply values from sparse.

    Parameters

    Returns Promise<Uint8Array>

bufferViewData

  • bufferViewData(index: GlTfId): Promise<Uint8Array>
  • Fetch the data for a buffer view. Pass in the bufferView property of an Accessor. NOTE: To avoid any unnessary copies, the data is returned as a Uint8Array instead of an ArrayBuffer.

    Parameters

    Returns Promise<Uint8Array>

preFetchAll

  • preFetchAll(): Promise<void[][]>
  • Pre-fetches all buffer and image data. Useful to avoid stalls due to lazy loading.

    Returns Promise<void[][]>