loadGLTF static method

Future<GLTFData?> loadGLTF(
  1. String path
)

Replaces THREE.GLTFLoader().fromAsset(path). Packed models must be self-contained .glb files (textures embedded).

Implementation

static Future<THREE.GLTFData?> loadGLTF(String path) async {
  final b = await packedBytes(path);
  if (b == null) return THREE.GLTFLoader().fromAsset(path);
  final loader = THREE.GLTFLoader();
  loader.setPath(path.substring(0, path.lastIndexOf('/') + 1));
  return loader.fromBytes(b);
}