OBJtoH and source – Windows

This is something that is really only useful to developers. It converts 3D OBJ files to c++ headers.

Since I’m somewhat rage inducingly stuck getting stuff working on PS3 CFW I’ve began to shift my focus towards another game (Which I probably wont be publicly revealing for a few months so don’t hold your breath hitting F5 waiting for it to be posted) on another platform and I ran into some small trouble getting it to load external files in emulation. I’m sure it would have been easy to correct but instead I decided to just write a small (it compiles to only 16KB) program to load 3d meshes from a Wavefront Object format files and export them as ready to be included headers.

There is no UI. Just drag and drop the Obj files (you can do it with multiple files at once) onto the executable.

The filename and the name of the variables that it contains all reflect the filename of the OBJ file that they where generated from.

If for example you converted a file named person.obj the filename of the header it outputs would then be person.h.
It would contain an integer named personvertexcount which would store the number of vertices in the mesh.
It would also contain a float array named personvertexarray which would store the position of each vertex (3 entries for each vertex so for example the x position of the 2nd vertex would be found at personvertexarray[3] and its y position would be at personvertexarray[4] and its z position would be at personvertexarray[5]).
It would also contain a float array named persontexturearray which would store the texture coordinates for each vertex (2 entries for each vertex).
Last but not least it would contain a float array named personnormalarray which would store the normals of each vertex (3 entries for each vertex).

One limitation though is that my Obj file loader currently assumes that you are only using triangular polygons. Quads aren’t yet supported.

Along with the pre compiled windows executable the RAR file also includes the source code. Since it doesn’t really have any abnormal dependencies it should be incredibly easy to compile it on any platform.

Download
Alternate links

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: