syoyo / tinyobjloader-c

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

Include face if last line in file #14

Closed andystanton closed 5 years ago

andystanton commented 5 years ago

Take two.

The reason this change is necessary is because the raw .obj data might not be null terminated. This means that there might be content between the end of the file and the last found line end.

Taking the viewer as an example, mmap returns a char* of just the number of bytes requested and does not include a null character at the end. If there are no empty lines at the end of the file, as in the example in #12, the last face is ignored.

syoyo commented 5 years ago

Oh, sorry I forgot to merge this PR.

Thanks!