Class: Mittsu::Face3

Inherits:
Object
  • Object
show all
Defined in:
lib/mittsu/core/face3.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#aObject

Returns the value of attribute a.



5
6
7
# File 'lib/mittsu/core/face3.rb', line 5

def a
  @a
end

#bObject

Returns the value of attribute b.



5
6
7
# File 'lib/mittsu/core/face3.rb', line 5

def b
  @b
end

#cObject

Returns the value of attribute c.



5
6
7
# File 'lib/mittsu/core/face3.rb', line 5

def c
  @c
end

#colorObject

Returns the value of attribute color.



5
6
7
# File 'lib/mittsu/core/face3.rb', line 5

def color
  @color
end

#material_indexObject

Returns the value of attribute material_index.



5
6
7
# File 'lib/mittsu/core/face3.rb', line 5

def material_index
  @material_index
end

#normalObject

Returns the value of attribute normal.



5
6
7
# File 'lib/mittsu/core/face3.rb', line 5

def normal
  @normal
end

#vertex_colorsObject

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_normalsObject

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_tangentsObject

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

#cloneObject



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