initJSON static method

Scene initJSON(
  1. Map<String, dynamic> json
)

Implementation

static Scene initJSON(Map<String, dynamic> json) {
  Map<String, dynamic> rootJSON = {};

  List<Shape> shapes = [];
  List<Map<String, dynamic>> shapesJSON = json["shapes"];
  for (var shape in shapesJSON) {
    shapes.add(Curve.castJSON(shape));
  }
  rootJSON["shapes"] = shapes;

  List<BufferGeometry> geometries = [];
  List<Map<String, dynamic>> geometriesJSON = json["geometries"];
  for (var geometry in geometriesJSON) {
    geometries.add(BufferGeometry.castJSON(geometry, rootJSON));
  }

  List<Material> materials = [];
  List<Map<String, dynamic>> materialsJSON = json["materials"];
  for (var material in materialsJSON) {
    materials.add(Material.fromJSON(material, {}));
  }

  rootJSON["materials"] = materials;
  rootJSON["geometries"] = geometries;

  return Object3D.castJSON(json["object"], rootJSON) as Scene;
}