fast_obj
fast_obj copied to clipboard
Proposal: move material texture maps into fastObjMesh
This PR replaces the fastObjTexture
maps in fastObjMaterial
with unsigned int
indices (which index into a newly added fastObjMesh::textures
array).
With this, all texture maps used in an OBJ file are grouped together and directly accessible from a fastObjMesh
, making it really straight-forward to load them (i.e. without having to traverse the fastObjMesh::materials
array checking all textures maps for each material, and where materials often contain duplicate texture maps between themselves).
It also makes the sizeof(fastObjMaterial)
smaller, and concentrates/minimizes string allocations, but a downside is that read_map
will now do string comparisons.
P.S.: I've bumped the version to 1.3
since this would lead to a breaking change.
Thanks! Let me have a think about this - I think it's probably a better way of doing things, but slightly worried by the API change, mostly because I've never written any proper docs, so communicating the change to people is a pain!
I 100% approve of this change!
Woah, sorry, thanks for the prod. Completely forgot to get back to this! I'll try and make some time in the next couple of weeks to get this in - could do with a 1.3 release anyway for recent changes, and I can explain the diffs in the release notes.
Fixed conflicts with https://github.com/thisistherk/fast_obj/pull/45
Thank you! Sorry this took so long!