loadFscenebAsset function

Future<Node> loadFscenebAsset(
  1. String assetPath, {
  2. FsceneComponentRegistry? registry,
  3. AssetBundle? bundle,
})

Loads a .fsceneb binary asset by assetPath and realizes it into a live node graph, loading any external assets / fmat materials it references.

Mirrors loadModel: returns a root node to add to a scene. Pass a custom registry to realize app-defined component types.

Implementation

Future<Node> loadFscenebAsset(
  String assetPath, {
  FsceneComponentRegistry? registry,
  AssetBundle? bundle,
}) async {
  final resolvedBundle = bundle ?? rootBundle;
  final data = await resolvedBundle.load(assetPath);
  return loadFscenebBytesAsync(
    data.buffer.asUint8List(data.offsetInBytes, data.lengthInBytes),
    registry: registry,
    bundle: bundle,
  );
}