Class: Three::Loaders::ThreeJSONLoader

Inherits:
Object
  • Object
show all
Defined in:
lib/three/loaders/three_json_loader.rb

Instance Method Summary collapse

Instance Method Details

#parse(input) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/three/loaders/three_json_loader.rb', line 8

def parse(input)
  data = input.is_a?(String) ? JSON.parse(input) : input
  @textures = build_resource_map(value(data, :textures)) { |entry| build_texture(entry) }
  @geometries = build_resource_map(value(data, :geometries)) { |entry| build_geometry(entry) }
  @materials = build_resource_map(value(data, :materials)) { |entry| build_material(entry) }
  build_object(value(data, :object))
end