GLTFLoader class

glTF (GL Transmission Format) is an open format specification for efficient delivery and loading of 3D content. Assets may be provided either in JSON (.gltf) or binary (.glb) format. External files store textures (.jpg, .png) and additional binary data (.bin). A glTF asset may deliver one or more scenes, including meshes, materials, textures, skins, skeletons, morph targets, animations, lights, and/or cameras.

GLTFLoader uses ImageBitmapLoader whenever possible. Be advised that image bitmaps are not automatically GC-collected when they are no longer referenced, and they require special handling during the disposal process. More information in the How to dispose of objects guide.

Inheritance

Constructors

GLTFLoader.new({LoadingManager? manager, bool flipY = false})
manager — The LoadingManager for the loader to use. Default is DefaultLoadingManager.

Properties

crossOrigin String
getter/setter pairinherited
flipY bool
getter/setter pairinherited
hashCode int
The hash code for this object.
no setterinherited
manager LoadingManager
getter/setter pairinherited
mimeType String
getter/setter pairinherited
path String
getter/setter pairinherited
pluginCallbacks List<Function>
getter/setter pair
requestHeader Map<String, dynamic>
getter/setter pairinherited
resourcePath String?
getter/setter pairinherited
responseType String
getter/setter pairinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
withCredentials bool
getter/setter pairinherited

Methods

dispose() → void
override
fromAsset(String asset, {String? package}) Future<GLTFData?>
asset - path of the file to be loaded
override
fromBlob(Blob blob) Future<GLTFData?>
blob - a blob of the file to be loaded
override
fromBytes(Uint8List bytes) Future<GLTFData?>
bytes - the loaded bytes of the file
override
fromFile(File file) Future<GLTFData?>
file - the file to be loaded
override
fromNetwork(Uri uri) Future<GLTFData?>
uri - a uri containing the location of the file to be loaded
override
fromPath(String filePath) Future<GLTFData?>
filePath - path of the file to be loaded
override
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
register(Function callback) GLTFLoader
setCrossOrigin(String crossOrigin) Loader
crossOrigin — The crossOrigin string to implement CORS for loading the url from a different domain that allows CORS.
inherited
setKTX2Loader(dynamic ktx2Loader) GLTFLoader
setMeshoptDecoder(dynamic meshoptDecoder) GLTFLoader
setPath(String path) GLTFLoader
path — Set the base path for the asset.
override
setRequestHeader(Map<String, dynamic> requestHeader) Loader
requestHeader - key: The name of the header whose value is to be set. value: The value to set as the body of the header.
inherited
setResourcePath(String? resourcePath) Loader
resourcePath — Set the base path for dependent resources like textures.
inherited
setWithCredentials(bool value) Loader
Whether the XMLHttpRequest uses credentials such as cookies, authorization headers or TLS client certificates. See XMLHttpRequest.withCredentials.
inherited
toString() String
A string representation of this object.
inherited
unknown(dynamic url) Future
url - a dynmaic data that gets parsed by the system
inherited
unregister(Function callback) GLTFLoader

Operators

operator ==(Object other) bool
The equality operator.
inherited