Class: CyberarmEngine::Model::Material

Inherits:
Object
  • Object
show all
Defined in:
lib/cyberarm_engine/model/material.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#ambientObject

Returns the value of attribute ambient.



4
5
6
# File 'lib/cyberarm_engine/model/material.rb', line 4

def ambient
  @ambient
end

#diffuseObject

Returns the value of attribute diffuse.



4
5
6
# File 'lib/cyberarm_engine/model/material.rb', line 4

def diffuse
  @diffuse
end

#nameObject

Returns the value of attribute name.



4
5
6
# File 'lib/cyberarm_engine/model/material.rb', line 4

def name
  @name
end

#specularObject

Returns the value of attribute specular.



4
5
6
# File 'lib/cyberarm_engine/model/material.rb', line 4

def specular
  @specular
end

#texture_idObject (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