Module: Shattered::View::InstanceMethods
- Defined in:
- lib/shattered_view/shattered_view.rb
Instance Attribute Summary collapse
-
#controller ⇒ Object
Returns the value of attribute controller.
-
#lights ⇒ Object
readonly
Returns the value of attribute lights.
-
#materials ⇒ Object
readonly
Returns the value of attribute materials.
-
#meshes ⇒ Object
readonly
Returns the value of attribute meshes.
-
#model ⇒ Object
Returns the value of attribute model.
Instance Method Summary collapse
-
#create(type, *args) ⇒ Object
The method of creating new view objects, IE: create(:light) or create :mesh, :ogre or create :material, :basic, :texture => “blank.jpg”.
- #define_accessor(array, new_obj, name) ⇒ Object
- #dsl_create(type, *args) ⇒ Object
- #node ⇒ Object
- #position ⇒ Object
- #position=(val) ⇒ Object
- #rotate(vector, amount) ⇒ Object
- #scene_manager ⇒ Object
- #setup_variables ⇒ Object
- #translate(v) ⇒ Object
- #visible=(visible) ⇒ Object
Instance Attribute Details
#controller ⇒ Object
Returns the value of attribute controller.
73 74 75 |
# File 'lib/shattered_view/shattered_view.rb', line 73 def controller @controller end |
#lights ⇒ Object (readonly)
Returns the value of attribute lights.
74 75 76 |
# File 'lib/shattered_view/shattered_view.rb', line 74 def lights @lights end |
#materials ⇒ Object (readonly)
Returns the value of attribute materials.
74 75 76 |
# File 'lib/shattered_view/shattered_view.rb', line 74 def materials @materials end |
#meshes ⇒ Object (readonly)
Returns the value of attribute meshes.
74 75 76 |
# File 'lib/shattered_view/shattered_view.rb', line 74 def meshes @meshes end |
#model ⇒ Object
Returns the value of attribute model.
73 74 75 |
# File 'lib/shattered_view/shattered_view.rb', line 73 def model @model end |
Instance Method Details
#create(type, *args) ⇒ Object
The method of creating new view objects, IE: create(:light) or create :mesh, :ogre or create :material, :basic, :texture => “blank.jpg”
136 137 138 |
# File 'lib/shattered_view/shattered_view.rb', line 136 def create(type, *args) return self.send(:"create_#{type}", *args) end |
#define_accessor(array, new_obj, name) ⇒ Object
109 110 111 112 113 114 115 116 117 118 |
# File 'lib/shattered_view/shattered_view.rb', line 109 def define_accessor(array, new_obj, name) instance_eval("#{array} ||= {}") instance_eval("#{array}[\"#{name}\"] = new_obj") self.class.class_eval <<-EOF define_method(:#{name}) do #{array}[\"#{name}\"] end EOF end |
#dsl_create(type, *args) ⇒ Object
120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/shattered_view/shattered_view.rb', line 120 def dsl_create(type, *args) name = args[0] = args[-1] object = create(type, *args) # Create an accessor for the object self.class.send(:define_method, name) do object end call_object_function_for_each_key(object, ) end |
#node ⇒ Object
153 154 155 |
# File 'lib/shattered_view/shattered_view.rb', line 153 def node @scene_node ||= scene_manager.root_scene_node.create_child_scene_node end |
#position ⇒ Object
141 142 143 |
# File 'lib/shattered_view/shattered_view.rb', line 141 def position node.position end |
#position=(val) ⇒ Object
145 146 147 |
# File 'lib/shattered_view/shattered_view.rb', line 145 def position=(val) node.position = val end |
#rotate(vector, amount) ⇒ Object
105 106 107 |
# File 'lib/shattered_view/shattered_view.rb', line 105 def rotate(vector, amount) node.rotate(vector, amount) end |
#scene_manager ⇒ Object
157 158 159 |
# File 'lib/shattered_view/shattered_view.rb', line 157 def scene_manager Game.instance.scene_manager end |
#setup_variables ⇒ Object
76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/shattered_view/shattered_view.rb', line 76 def setup_variables @lights = [] on_unload do @lights.each { |light| scene_manager.destroy_light(light) } @lights = [] end @materials = [] on_unload do @materials.each { |material| Ogre::MaterialManager.instance.remove(material.name) } @materials = [] end @meshes = [] on_unload do @meshes.each { |mesh| mesh.unload } @meshes = [] end @particle_systems = [] on_unload do @particle_systems.each { |ps| ps.unload } end end |
#translate(v) ⇒ Object
149 150 151 |
# File 'lib/shattered_view/shattered_view.rb', line 149 def translate(v) node.translate(v) end |
#visible=(visible) ⇒ Object
101 102 103 |
# File 'lib/shattered_view/shattered_view.rb', line 101 def visible=(visible) node.visible=(visible) end |