mirror of
https://github.com/thisistherk/fast_obj.git
synced 2025-04-05 05:25:03 +00:00
Fast C OBJ parser
In some .obj files, there's a stray 'g' followed by a newline at the very end of the file. What happens right now is that *p++ skips past the "terminating newline", and then proceeds to process out of bounds memory which leads to a crash. I'm not sure if 'g' can actually be empty per spec, so this change just fixes the crash without resetting the group to "default" or anything like that; 'v'/'f' shouldn't be empty but this would fix crashing when parsing malicious/malformed .obj files as well. |
||
---|---|---|
test | ||
.gitignore | ||
CMakeLists.txt | ||
fast_obj.h | ||
LICENSE | ||
README.md |
fast_obj
Because the world needs another OBJ loader. Single header library, should compile without warnings in both C89 or C++. Much faster (5-10x) than other libraries tested.
To use:
fastObjMesh* mesh = fast_obj_read("path/to/objfile.obj");
...do stuff with mesh...
fast_obj_destroy(mesh);
Simple test app to compare speed against tinyobjloader and check output matches.