Class: Wavefront::Vertex

Inherits:
Object
  • Object
show all
Defined in:
lib/wavefront/vertex.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(p, uv, n, p_index, t_index, n_index) ⇒ Vertex

Returns a new instance of Vertex.



6
7
8
9
10
# File 'lib/wavefront/vertex.rb', line 6

def initialize p, uv, n, p_index, t_index, n_index
  raise "cannot initialize vertex without a position!" if p.nil?
  @position, @uv, @normal = p, uv, n
  @position_index, @texture_index, @normal_index = p_index, t_index, n_index
end

Instance Attribute Details

#normalObject (readonly)

Returns the value of attribute normal.



3
4
5
# File 'lib/wavefront/vertex.rb', line 3

def normal
  @normal
end

#normal_indexObject (readonly)

Returns the value of attribute normal_index.



3
4
5
# File 'lib/wavefront/vertex.rb', line 3

def normal_index
  @normal_index
end

#positionObject (readonly)

Returns the value of attribute position.



3
4
5
# File 'lib/wavefront/vertex.rb', line 3

def position
  @position
end

#position_indexObject (readonly)

Returns the value of attribute position_index.



3
4
5
# File 'lib/wavefront/vertex.rb', line 3

def position_index
  @position_index
end

#texture_indexObject (readonly)

Returns the value of attribute texture_index.



3
4
5
# File 'lib/wavefront/vertex.rb', line 3

def texture_index
  @texture_index
end

#uvObject (readonly) Also known as: tex

Returns the value of attribute uv.



3
4
5
# File 'lib/wavefront/vertex.rb', line 3

def uv
  @uv
end

Instance Method Details

#composite_indexObject



12
13
14
# File 'lib/wavefront/vertex.rb', line 12

def composite_index
  "p_#{position_index}_n_#{normal_index}_t#{texture_index}"
end