Module: OBJ

Defined in:
lib/obj.rb,
lib/obj/version.rb

Defined Under Namespace

Classes: Mesh

Constant Summary collapse

VERSION =
"0.0.1"

Class Method Summary collapse

Class Method Details

.parse(file_path) ⇒ Object



20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/obj.rb', line 20

def self.parse(file_path)
  info = Mesh.new

  File.open(file_path, 'r') do |f|
    f.each_line do |line|
      case line[0,2]
      when 'v '
        info.vertices += 1
      when 'vt'
        info.text_coords += 1
      when 'vn'
        info.normals += 1
      when 'f '
        info.faces += 1
      end
    end
  end

  puts info
end