Class: Three::Mesh

Inherits:
Object3D show all
Defined in:
lib/three/objects/mesh.rb

Direct Known Subclasses

InstancedMesh

Constant Summary

Constants inherited from Object3D

Object3D::DEFAULT_MATRIX_AUTO_UPDATE, Object3D::DEFAULT_MATRIX_WORLD_AUTO_UPDATE, Object3D::DEFAULT_UP

Instance Attribute Summary collapse

Attributes inherited from Object3D

#cast_shadow, #children, #id, #layers, #matrix, #matrix_auto_update, #matrix_world, #matrix_world_auto_update, #matrix_world_needs_update, #name, #parent, #position, #quaternion, #receive_shadow, #rotation, #scale, #type, #up, #user_data, #uuid, #visible

Instance Method Summary collapse

Methods inherited from Object3D

#add, allocate_id, #clear, #dirty_dependency_changed, #get_object_by_id, #get_object_by_name, #get_object_by_property, #get_objects_by_property, #get_world_direction, #get_world_position, #get_world_quaternion, #get_world_scale, #mark_descendant_dirty!, #mark_dirty!, #remove, #remove_from_parent, #to_json, #traverse, #traverse_ancestors, #traverse_visible, #update_matrix, #update_matrix_world, #update_world_matrix

Methods included from Dirty

#add_dirty_dependent, #dirty?, #dirty_dependents, #dirty_field?, #dirty_fields, #mark_clean!, #mark_dirty!, #remove_dirty_dependent

Methods inherited from EventDispatcher

#add_event_listener, #dispatch_event, #has_event_listener?, #remove_event_listener

Constructor Details

#initialize(geometry = BufferGeometry.new, material = MeshBasicMaterial.new) ⇒ Mesh

Returns a new instance of Mesh.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/three/objects/mesh.rb', line 12

def initialize(geometry = BufferGeometry.new, material = MeshBasicMaterial.new)
  super()
  @type = "Mesh"
  @geometry = nil
  @material = nil
  @morph_target_dictionary = nil
  @morph_target_influences = nil
  @count = 1
  self.geometry = geometry
  self.material = material
end

Instance Attribute Details

#countObject

Returns the value of attribute count.



10
11
12
# File 'lib/three/objects/mesh.rb', line 10

def count
  @count
end

#geometryObject

Returns the value of attribute geometry.



9
10
11
# File 'lib/three/objects/mesh.rb', line 9

def geometry
  @geometry
end

#materialObject

Returns the value of attribute material.



9
10
11
# File 'lib/three/objects/mesh.rb', line 9

def material
  @material
end

#morph_target_dictionaryObject

Returns the value of attribute morph_target_dictionary.



10
11
12
# File 'lib/three/objects/mesh.rb', line 10

def morph_target_dictionary
  @morph_target_dictionary
end

#morph_target_influencesObject

Returns the value of attribute morph_target_influences.



10
11
12
# File 'lib/three/objects/mesh.rb', line 10

def morph_target_influences
  @morph_target_influences
end

Instance Method Details

#to_hObject



38
39
40
41
42
43
# File 'lib/three/objects/mesh.rb', line 38

def to_h
  super.merge(
    geometry: @geometry.uuid,
    material: @material.respond_to?(:uuid) ? @material.uuid : nil
  )
end