loadGltf abstract method

Future<ThermionAsset> loadGltf(
  1. String uri, {
  2. bool addToScene = true,
  3. int initialInstances = 1,
  4. bool keepData = false,
  5. String? resourceUri,
  6. bool loadAsync = false,
})

Load the glTF asset at the given path (.glb or .gltf)

If the file is a .gltf and resourceUri is not specified, all resources will be loaded relative to the URI of the file (so if uri is asset://assets/scene.gltf, the loader will attempt to load asset://assets/scene.bin, asset://assets/texture.png, and so on).

If resourceUri is specified, resources will be loaded relative to that path.

If addToScene is true, all renderable entities (including lights) in the asset will be added to the scene.

The initialInstances argument determines the number of instances created when the asset is first instantiated. If keepData is false, no further instances will be able to be created.

If keepData is true, additional instances can be created by calling createInstance on the returned asset.

Creating instances at asset load time is more efficient than dynamically instantating at a later time.

Instances can be retrieved with getInstances.

If loadResourcesAsync is true, resources (textures, materials, etc) will be loaded asynchronously. Some material/texture pop-in is expected.

Implementation

Future<ThermionAsset> loadGltf(String uri,
    {bool addToScene = true,
    int initialInstances = 1,
    bool keepData = false,
    String? resourceUri,
    bool loadAsync = false});