Class: Wavefront::Vertex
- Inherits:
-
Object
- Object
- Wavefront::Vertex
- Defined in:
- lib/wavefront/vertex.rb
Instance Attribute Summary collapse
-
#normal ⇒ Object
readonly
Returns the value of attribute normal.
-
#normal_index ⇒ Object
readonly
Returns the value of attribute normal_index.
-
#position ⇒ Object
readonly
Returns the value of attribute position.
-
#position_index ⇒ Object
readonly
Returns the value of attribute position_index.
-
#texture_index ⇒ Object
readonly
Returns the value of attribute texture_index.
-
#uv ⇒ Object
(also: #tex)
readonly
Returns the value of attribute uv.
Instance Method Summary collapse
- #composite_index ⇒ Object
-
#initialize(p, uv, n, p_index, t_index, n_index) ⇒ Vertex
constructor
A new instance of Vertex.
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
#normal ⇒ Object (readonly)
Returns the value of attribute normal.
3 4 5 |
# File 'lib/wavefront/vertex.rb', line 3 def normal @normal end |
#normal_index ⇒ Object (readonly)
Returns the value of attribute normal_index.
3 4 5 |
# File 'lib/wavefront/vertex.rb', line 3 def normal_index @normal_index end |
#position ⇒ Object (readonly)
Returns the value of attribute position.
3 4 5 |
# File 'lib/wavefront/vertex.rb', line 3 def position @position end |
#position_index ⇒ Object (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_index ⇒ Object (readonly)
Returns the value of attribute texture_index.
3 4 5 |
# File 'lib/wavefront/vertex.rb', line 3 def texture_index @texture_index end |
#uv ⇒ Object (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_index ⇒ Object
12 13 14 |
# File 'lib/wavefront/vertex.rb', line 12 def composite_index "p_#{position_index}_n_#{normal_index}_t#{texture_index}" end |