loadScene method

dynamic loadScene(
  1. dynamic sceneIndex
)

Implementation

loadScene(sceneIndex) async {
  var json = this.json;
  var extensions = this.extensions;
  Map<String, dynamic> sceneDef = this.json["scenes"][sceneIndex];
  var parser = this;

  // Loader returns Group, not Scene.
  // See: https://github.com/mrdoob/three.js/issues/18342#issuecomment-578981172
  var scene = new Group();
  if (sceneDef["name"] != null)
    scene.name = parser.createUniqueName(sceneDef["name"]);

  assignExtrasToUserData(scene, sceneDef);

  if (sceneDef["extensions"] != null)
    addUnknownExtensionsToUserData(extensions, scene, sceneDef);

  var nodeIds = sceneDef["nodes"] ?? [];

  for (var i = 0, il = nodeIds.length; i < il; i++) {
    await buildNodeHierarchy(nodeIds[i], scene, json, parser);
  }

  return scene;
}