Seeking an C/C++ OBJ geometry read/write that does not modify the representation

Posted by Blake Senftner on Game Development See other posts from Game Development or by Blake Senftner
Published on 2012-11-10T16:08:06Z Indexed on 2012/11/10 17:18 UTC
Read the original article Hit count: 341

Filed under:
|

I am seeking a means to read and write OBJ geometry files with logic that does not modify the geometry representation. i.e. read geometry, immediately write it, and a diff of the source OBJ and the one just written will be identical. Every OBJ writing utility I've been able to find online fails this test.

I am writing small command line tools to modify my OBJ geometries, and I need to write my results, not just read the geometry for rendering purposes.

Simply needing to write the geometry knocks out 95% of the OBJ libraries on the web.

Also, many of the popular libraries modify the geometry representation. For example, Nat Robbin's GLUT library includes the GLM library, which both converts quads to triangles, as well as reverses the topology (face ordering) of the geometry. It's still the same geometry, but if your tool chain expects a given topology, such as for rigging or morph targets, then GLM is useless.

I'm not rendering in these tools, so dependencies like OpenGL or GLUT make no sense.

And god forbid, do not "optimize" the geometry! Redundant vertices are on purpose for maintaining oneself on cache with our weird little low memory mobile devices.

© Game Development or respective owner

Related posts about model-loader

Related posts about saveload