Open Hurleyworks opened 4 years ago
Yeah, it's intentional, though not very obvious! I guess it stems from using default C zero-initialisation to mean 'invalid' - so:
fastObjIndex idx = {
.p = position_index
};
would leave texture/normal index set to 0 and so indicate they aren't present. Also means that you don't need to test if the 'invalid' indices are actually invalid before using them - they'll still point to a valid point in the corresponding array (whereas defining e.g. INVALID_INDEX = -1 and using that for data that isn't present would mean you'd need to test or end up reading outside array bounds).
I'll attempt to add some blurb to the readme about it!
Okay, thanks for the clarification
Hey, thanks for making this project available!
When I parse a basic cube mesh with 8 vertices and 12 triangles, the fastObjMesh->position_count reads 9 instead of 8. It looks like this is caused by the dummy data added starting at line 1296 of fast_obj.h.
Here's a link to the cube.obj tested https://gist.github.com/noonat/1131091/450ad7bbb6e0c8fba1854cc86a9f6b7a224fca56