Class: Mittsu::Face3
- Inherits:
-
Object
- Object
- Mittsu::Face3
- Defined in:
- lib/mittsu/core/face3.rb
Instance Attribute Summary collapse
-
#a ⇒ Object
Returns the value of attribute a.
-
#b ⇒ Object
Returns the value of attribute b.
-
#c ⇒ Object
Returns the value of attribute c.
-
#color ⇒ Object
Returns the value of attribute color.
-
#material_index ⇒ Object
Returns the value of attribute material_index.
-
#normal ⇒ Object
Returns the value of attribute normal.
-
#vertex_colors ⇒ Object
Returns the value of attribute vertex_colors.
-
#vertex_normals ⇒ Object
Returns the value of attribute vertex_normals.
-
#vertex_tangents ⇒ Object
Returns the value of attribute vertex_tangents.
Instance Method Summary collapse
- #clone ⇒ Object
-
#initialize(a, b, c, normal = nil, color = nil, material_index = nil) ⇒ Face3
constructor
A new instance of Face3.
Constructor Details
#initialize(a, b, c, normal = nil, color = nil, material_index = nil) ⇒ Face3
Returns a new instance of Face3.
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/mittsu/core/face3.rb', line 7 def initialize(a, b, c, normal = nil, color = nil, material_index = nil) @a = a @b = b @c = c @normal = normal.is_a?(Vector3) ? normal : Mittsu::Vector3.new @vertex_normals = normal.is_a?(Array) ? normal : [] @color = color.is_a?(Color) ? color : Mittsu::Color.new @vertex_colors = color.is_a?(Array) ? normal : [] @vertex_tangents = [] @material_index = material_index.nil? ? 0 : material_index end |
Instance Attribute Details
#a ⇒ Object
Returns the value of attribute a.
5 6 7 |
# File 'lib/mittsu/core/face3.rb', line 5 def a @a end |
#b ⇒ Object
Returns the value of attribute b.
5 6 7 |
# File 'lib/mittsu/core/face3.rb', line 5 def b @b end |
#c ⇒ Object
Returns the value of attribute c.
5 6 7 |
# File 'lib/mittsu/core/face3.rb', line 5 def c @c end |
#color ⇒ Object
Returns the value of attribute color.
5 6 7 |
# File 'lib/mittsu/core/face3.rb', line 5 def color @color end |
#material_index ⇒ Object
Returns the value of attribute material_index.
5 6 7 |
# File 'lib/mittsu/core/face3.rb', line 5 def material_index @material_index end |
#normal ⇒ Object
Returns the value of attribute normal.
5 6 7 |
# File 'lib/mittsu/core/face3.rb', line 5 def normal @normal end |
#vertex_colors ⇒ Object
Returns the value of attribute vertex_colors.
5 6 7 |
# File 'lib/mittsu/core/face3.rb', line 5 def vertex_colors @vertex_colors end |
#vertex_normals ⇒ Object
Returns the value of attribute vertex_normals.
5 6 7 |
# File 'lib/mittsu/core/face3.rb', line 5 def vertex_normals @vertex_normals end |
#vertex_tangents ⇒ Object
Returns the value of attribute vertex_tangents.
5 6 7 |
# File 'lib/mittsu/core/face3.rb', line 5 def vertex_tangents @vertex_tangents end |
Instance Method Details
#clone ⇒ Object
19 20 21 22 23 24 25 26 27 28 |
# File 'lib/mittsu/core/face3.rb', line 19 def clone face = Mittsu::Face3.new(@a, @b, @c) face.normal.copy(@normal) face.color.copy(@color) face.material_index = @material_index face.vertex_normals = @vertex_normals.map(&:clone) face.vertex_colors = @vertex_colors.map(&:clone) face.vertex_tangents = @vertex_tangents.map(&:clone) face end |