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 (Map<String, dynamic> shape in shapesJSON) {
  //   shapes.add(Curve.castJson(shape) as Shape);
  // }
  //rootJson["shapes"] = shapes;

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

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

  rootJson["materials"] = materials;
  rootJson["geometries"] = geometries;

  return Object3D.castJson(json["object"], rootJson) as Scene;
}