Class: CyberarmEngine::Model::Material
- Inherits:
-
Object
- Object
- CyberarmEngine::Model::Material
- Defined in:
- lib/cyberarm_engine/model/material.rb
Instance Attribute Summary collapse
-
#ambient ⇒ Object
Returns the value of attribute ambient.
-
#diffuse ⇒ Object
Returns the value of attribute diffuse.
-
#name ⇒ Object
Returns the value of attribute name.
-
#specular ⇒ Object
Returns the value of attribute specular.
-
#texture_id ⇒ Object
readonly
Returns the value of attribute texture_id.
Instance Method Summary collapse
-
#initialize(name) ⇒ Material
constructor
A new instance of Material.
- #set_texture(texture_path) ⇒ Object
Constructor Details
#initialize(name) ⇒ Material
Returns a new instance of Material.
7 8 9 10 11 12 13 14 |
# File 'lib/cyberarm_engine/model/material.rb', line 7 def initialize(name) @name = name @ambient = Color.new(1, 1, 1, 1) @diffuse = Color.new(1, 1, 1, 1) @specular = Color.new(1, 1, 1, 1) @texture = nil @texture_id = nil end |
Instance Attribute Details
#ambient ⇒ Object
Returns the value of attribute ambient.
4 5 6 |
# File 'lib/cyberarm_engine/model/material.rb', line 4 def ambient @ambient end |
#diffuse ⇒ Object
Returns the value of attribute diffuse.
4 5 6 |
# File 'lib/cyberarm_engine/model/material.rb', line 4 def diffuse @diffuse end |
#name ⇒ Object
Returns the value of attribute name.
4 5 6 |
# File 'lib/cyberarm_engine/model/material.rb', line 4 def name @name end |
#specular ⇒ Object
Returns the value of attribute specular.
4 5 6 |
# File 'lib/cyberarm_engine/model/material.rb', line 4 def specular @specular end |
#texture_id ⇒ Object (readonly)
Returns the value of attribute texture_id.
5 6 7 |
# File 'lib/cyberarm_engine/model/material.rb', line 5 def texture_id @texture_id end |
Instance Method Details
#set_texture(texture_path) ⇒ Object
16 17 18 |
# File 'lib/cyberarm_engine/model/material.rb', line 16 def set_texture(texture_path) @texture_id = Texture.new(path: texture_path).id end |