Class: Ogre::MeshInstance
- Defined in:
- lib/shattered_view/ogrerb/mesh_instance.rb
Overview
are not delegated respectfully.
Instance Attribute Summary collapse
-
#entity ⇒ Object
readonly
Returns the value of attribute entity.
-
#node ⇒ Object
readonly
Returns the value of attribute node.
Instance Method Summary collapse
-
#hide ⇒ Object
Hide the mesh and it’s children.
-
#initialize(parent, scene_manager, mesh_name, options = {}) ⇒ MeshInstance
constructor
A new instance of MeshInstance.
-
#material=(material) ⇒ Object
Set a material on a mesh.
- #scale(*args) ⇒ Object
-
#show ⇒ Object
Show the mesh and it’s children.
-
#unload ⇒ Object
Unload the mesh entity and node.
-
#visible=(v) ⇒ Object
Entity delegates that map differently.
-
#visible? ⇒ Boolean
Is the entity visible?.
Constructor Details
#initialize(parent, scene_manager, mesh_name, options = {}) ⇒ MeshInstance
Returns a new instance of MeshInstance.
14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/shattered_view/ogrerb/mesh_instance.rb', line 14 def initialize(parent, scene_manager, mesh_name, ={}) @@entity_count ||= 0 @scene_manager = scene_manager @parent = parent @node = parent.create_child_scene_node("#{parent.to_s}.node(#{parent.num_children})") # formats to '#<SceneManager:???>.entity(0)' @entity = [:entity] || scene_manager.create_entity("#{scene_manager.to_s}.entity(#{@@entity_count})", mesh_name) @node.attach_object(@entity) @@entity_count += 1 # delegate all unknown methods to the entity object __setobj__(@entity) end |
Instance Attribute Details
#entity ⇒ Object (readonly)
Returns the value of attribute entity.
13 14 15 |
# File 'lib/shattered_view/ogrerb/mesh_instance.rb', line 13 def entity @entity end |
#node ⇒ Object (readonly)
Returns the value of attribute node.
13 14 15 |
# File 'lib/shattered_view/ogrerb/mesh_instance.rb', line 13 def node @node end |
Instance Method Details
#hide ⇒ Object
Hide the mesh and it’s children
65 66 67 |
# File 'lib/shattered_view/ogrerb/mesh_instance.rb', line 65 def hide self.visible = false end |
#material=(material) ⇒ Object
Set a material on a mesh. You can set rmaterials or names of Ogre materials.
75 76 77 78 79 80 81 |
# File 'lib/shattered_view/ogrerb/mesh_instance.rb', line 75 def material=(material) if(material.is_a? String) self.set_material_name(material) else self.set_material_name(material.get_name.to_s) end end |
#scale(*args) ⇒ Object
50 51 52 |
# File 'lib/shattered_view/ogrerb/mesh_instance.rb', line 50 def scale(*args) node.scale *args end |
#show ⇒ Object
Show the mesh and it’s children
70 71 72 |
# File 'lib/shattered_view/ogrerb/mesh_instance.rb', line 70 def show self.visible = true end |
#unload ⇒ Object
Unload the mesh entity and node.
28 29 30 31 32 |
# File 'lib/shattered_view/ogrerb/mesh_instance.rb', line 28 def unload @node.detach_object(@entity) @scene_manager.destroy_entity(@entity) @parent.remove_and_destroy_child(@node.get_name) end |
#visible=(v) ⇒ Object
Entity delegates that map differently
55 56 57 |
# File 'lib/shattered_view/ogrerb/mesh_instance.rb', line 55 def visible=(v) entity.set_visible v end |
#visible? ⇒ Boolean
Is the entity visible?
60 61 62 |
# File 'lib/shattered_view/ogrerb/mesh_instance.rb', line 60 def visible? entity.is_visible end |