Class: OBJ::Mesh
- Inherits:
-
Object
- Object
- OBJ::Mesh
- Defined in:
- lib/obj/mesh.rb
Instance Attribute Summary collapse
-
#faces ⇒ Object
Returns the value of attribute faces.
-
#normals ⇒ Object
Returns the value of attribute normals.
-
#text_coords ⇒ Object
Returns the value of attribute text_coords.
-
#vertices ⇒ Object
Returns the value of attribute vertices.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(file_path) ⇒ Mesh
constructor
A new instance of Mesh.
- #normals? ⇒ Boolean
- #text_coords? ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(file_path) ⇒ Mesh
Returns a new instance of Mesh.
9 10 11 12 13 14 15 16 |
# File 'lib/obj/mesh.rb', line 9 def initialize(file_path) @vertices = [] @normals = [] @text_coords = [] @faces = [] initialize_from_file(file_path) end |
Instance Attribute Details
#faces ⇒ Object
Returns the value of attribute faces.
7 8 9 |
# File 'lib/obj/mesh.rb', line 7 def faces @faces end |
#normals ⇒ Object
Returns the value of attribute normals.
7 8 9 |
# File 'lib/obj/mesh.rb', line 7 def normals @normals end |
#text_coords ⇒ Object
Returns the value of attribute text_coords.
7 8 9 |
# File 'lib/obj/mesh.rb', line 7 def text_coords @text_coords end |
#vertices ⇒ Object
Returns the value of attribute vertices.
7 8 9 |
# File 'lib/obj/mesh.rb', line 7 def vertices @vertices end |
Class Method Details
.load(file_path) ⇒ Object
3 4 5 |
# File 'lib/obj/mesh.rb', line 3 def self.load(file_path) Mesh.new(file_path) end |
Instance Method Details
#normals? ⇒ Boolean
18 19 20 |
# File 'lib/obj/mesh.rb', line 18 def normals? !@normals.empty? end |
#text_coords? ⇒ Boolean
22 23 24 |
# File 'lib/obj/mesh.rb', line 22 def text_coords? !@text_coords.empty? end |
#to_s ⇒ Object
26 27 28 29 |
# File 'lib/obj/mesh.rb', line 26 def to_s "<#{self.class} vertices: #{@vertices.size} normals: #{@normals.size}" \ " text_coords: #{@text_coords.size} faces: #{@faces.size}>" end |