loadFsceneAsset function

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

Loads a .fscene text 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> loadFsceneAsset(
  String assetPath, {
  FsceneComponentRegistry? registry,
  AssetBundle? bundle,
}) async {
  final source = await (bundle ?? rootBundle).loadString(assetPath);
  return realizeSceneAsync(
    readFscene(source),
    registry: registry,
    bundle: bundle,
  );
}