Lightweight OBJ mesh file loader for C/C++?

2020-03-19 15:25发布

问题:

I'm looking for a simple lightweight Wavefront OBJ mesh file reader for C or C++. (ie. given a mesh in OBJ format, read it in from a file, and make it accessible, preferably as a list of vertices and triangles.) Recommendations?

It doesn't need to support material properties or any other fancy data that might be present - just the geometry is fine.

回答1:

There are plenty of them: http://www.google.com/codesearch?q=wavefront+obj+loader
This one for example: http://www.google.com/codesearch?hl=ru&q=wavefront+obj+loader&exact_package=http://ftp5.ru.freebsd.org/pub/FreeBSD/distfiles/gl-117-1.3.2-src.tar.bz2 ;)

The Google links are broken. CodeSearch was done away with. Try these instead. hosting/search http://www.google.com/hosting/search?q=wavefront+obj+loader

The second link had this embedded in the link (that link is still active): http://ftp5.ru.freebsd.org/pub/FreeBSD/distfiles/gl-117-1.3.2-src.tar.bz2



回答2:

Open Asset Import Library looks very promising. Plenty of formats is supported.