Class: ObjParser::ObjParser

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

Constant Summary collapse

VERTEX_LINE_ID =
'v'
NORMAL_LINE_ID =
'vn'
TEXTURE_LINE_ID =
'vt'
INDEXES_ID =
'f'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(index_array_starting_at = 0) ⇒ ObjParser

Returns a new instance of ObjParser.



14
15
16
# File 'lib/obj_parser/obj_parser.rb', line 14

def initialize(index_array_starting_at = 0)
  self.index_array_starting_at_index = 1
end

Instance Attribute Details

#index_array_starting_at_indexObject

Returns the value of attribute index_array_starting_at_index.



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

def index_array_starting_at_index
  @index_array_starting_at_index
end

Instance Method Details

#load(input_io) ⇒ Object



18
19
20
21
22
23
24
25
# File 'lib/obj_parser/obj_parser.rb', line 18

def load(input_io)
  obj = Obj.new
  input_io.rewind
  while(line = input_io.gets)
    parser_for_line(line).call(line, obj)
  end
  obj
end