Posted on

An Army of Pancakes.

At the beginning of this month, Colby and myself decided it was time to buckle down and do something cool. We stumbled upon a branch of LÖVE that supports buffering vertices and decided to see if we couldn't abuse this functionality to open LÖVE up to 3D development.

For those in the dark, LÖVE is a 2D game framework that uses the Lua programming language to allow for rapid prototyping and development. While the API is centred around providing easy tools to create 2D games, LÖVE sits on top of OpenGL. With the right tools, breaking free of LÖVE's 2D API is pretty simple and the results are well worth it.

To begin, I decided to write an IQE model loader while Colby began work on a 4x4 matrix (mat4) library. Writing a basic IQE loader wasn't terribly difficult since the spec is very well documented, and we had a model on screen in about an hour or two.

Her name is Pancakes.

Once we got the basic IQE stuff worked out, the next step was to get materials and textures working. Since IQE does not have a material format, I decided to built the Wavefront Object's material format into the loader. This worked out really well and we had our colourful model not too long after.

Pancakes has pink hair. :3

When we tried setting up the IQE animations, we ran into an extremely frustrating bug and I spent much of Thanksgiving on the phone with Colby trying to sort things out.

That looks like it... hurts.

Pancakes enlisted in the United States Airforce. As a jet.

Pancakes no naku koro ni. @u@

The problem ended up being that Colby's mat4 library was column-major whereas the reference documents for IQM/IQE were row-major. Once we figured this out, the problem solved itself: switch the multiplication order of two matrices. With that fixed, and a couple OpenGL calls, we were able to load and animate 3D models.

With the ability to load and animate models at will, we decided to post our work to the LÖVE forums with surprisingly little fanfare.

My next post will focus on our new math library and the tank game we ar ebuilding with LÖVE3D.