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;
}