Class: Ogre::MeshInstance

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/shattered_ogrerb/mesh_instance.rb

Overview

are not delegated respectfully.

Direct Known Subclasses

LightInstance

Instance Attribute Summary collapse

Instance Method Summary collapse

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
# File 'lib/shattered_ogrerb/mesh_instance.rb', line 14

def initialize(parent, scene_manager, mesh_name, options={})
	@@entity_count ||= 0
	@node = parent.create_child_scene_node
	# formats to '#<SceneManager:???>.entity(0)'
	@entity = options[: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

#entityObject (readonly)

Returns the value of attribute entity.



13
14
15
# File 'lib/shattered_ogrerb/mesh_instance.rb', line 13

def entity
  @entity
end

#nodeObject (readonly)

Returns the value of attribute node.



13
14
15
# File 'lib/shattered_ogrerb/mesh_instance.rb', line 13

def node
  @node
end

Instance Method Details

#material=(material) ⇒ Object

Set a material on a mesh. You can set rmaterials or names of Ogre materials.



54
55
56
57
58
59
60
# File 'lib/shattered_ogrerb/mesh_instance.rb', line 54

def material=(material)
 if(material.is_a? String)
   self.set_material_name(material)
  else
    self.set_material_name(material.get_name)
   end
end

#visible=(v) ⇒ Object

Entity delegates that map differently



45
46
47
# File 'lib/shattered_ogrerb/mesh_instance.rb', line 45

def visible=(v)
	entity.set_visible v
end

#visible?Boolean

Returns:

  • (Boolean)


49
50
51
# File 'lib/shattered_ogrerb/mesh_instance.rb', line 49

def visible?
	entity.is_visible
end