Header only tiny wavefront .obj loader in pure C99
Tiny but powerful header only wavefront obj loader written in C99.
If you are looking for C++ version, please see https://github.com/syoyo/tinyobjloader
Experimental. Loading geometry data would be OK, More testing required for materials and shapes.
libc)
Copy
tinyobj_loader_c.hto your project.
/* define TINYOBJ_LOADER_C_IMPLEMENTATION for only *one* .c */ #define TINYOBJ_LOADER_C_IMPLEMENTATION #include "tinyobj_loader_c.h"...
See
examples/viewer/for more details.
tinyobjloader allocates memory. To replace the functions used for allocation, define
TINYOBJ_MALLOC,
TINYOBJ_REALLOC,
TINYOBJ_CALLOCand
TINYOBJ_FREEin the .c file you defined
TINYOBJ_LOADER_C_IMPLEMENTATIONin, before including
tinyobj_loader_c.h. Define either all or none of them. They replace
malloc,
realloc,
callocand
freerespectively.
Example: ```
## TestsThe single header test library acutest is used to provide a test runner and assertion macros. There are two test suites: one for the API and one for the internal functions. Ultimately the internal tests should be removed, but are useful while the project is volatile.
The tests can be run from the project root using:
$ make test ```
This builds and executes a binary called
tinyobj_testsin the test folder. There are some options to run specific tests that can be passed to the executable directly that are described on the acutest readme.
By default acutest forks for each test. To disable this for debugging purposes, you can pass the switch
--no-execto
tinyobj_tests.
MIT license.