syoyo / tinyobjloader-c

Header only tiny wavefront .obj loader in pure C99
423 stars 60 forks source link

Last face ignored if it's the last line in the file #12

Closed andystanton closed 5 years ago

andystanton commented 5 years ago

If the face is the last line in the file, it doesn't get added.

v 0.500000 -0.500000 -0.500000
v 0.500000 -0.500000 0.500000
v -0.500000 -0.500000 0.500000
v -0.500000 -0.500000 -0.500000
v 0.500000 0.500000 -0.500000
v 0.500000 0.500000 0.500000
v -0.500000 0.500000 0.500000
v -0.500000 0.500000 -0.500000
vn 0.0000 -0.5000 0.0000
vn 0.0000 0.5000 0.0000
vn 0.5000 0.0000 0.0000
vn -0.0000 -0.0000 0.5000
vn -0.5000 -0.0000 -0.0000
vn 0.0000 0.0000 -0.5000
s off
f 1//1 2//1 3//1 4//1
f 5//2 8//2 7//2 6//2
f 1//3 5//3 6//3 2//3
f 2//4 6//4 7//4 3//4
f 3//5 7//5 8//5 4//5
f 5//6 1//6 4//6 8//6

Renders in the viewer like this:

screenshot 2018-11-16 at 20 33 48
syoyo commented 5 years ago

screen shot 2018-12-02 at 21 17 02

I have confirmed now it loads the last face correctly after merging #14

Thus this issue should be ready to close.

andystanton commented 5 years ago

Cool, thanks @syoyo!