Box2D Update

I’ve been working hard today to update our box2d wrapper to the latest release. While i tested it as much as possible, there’s always the possibility that a regression crawled back in. Check out the latest nightlies and update your natives (especially for Android!).

Here’re the changes i made:

@Nicolas, i hope Zynga likes all the free work we do for them 🙂 It would be nice if the andenginephysicsextension actually stated where the source comes from.

You Mac OS X lovers have to wait until Tamas can compile the binaries for you (3-4 days).

Matrix3/Matrix4 Additions & ShapeRenderer

I invested some time today to fix a long standing feature enhancement: in-place matrix operations. What’s that? OpenGL ES 1.x (and desktop OpenGL) have a rather convenient way of concatenating matrix operations:

These functions operate on the top of the currently active matrix stack of OpenGL. The transformations are applied from bottom to top (rotate, scale then translate in the above example).

Doing something like this with Matrix3 and Matrix4 was a bit of a piece in the ass until now as one had to use a temporary matrix to achieve the same. I went ahead and implemented three new methods on Matrix3 and Matrix4: rotate, scale and translate. These will post-multiply the matrix with a rotation, scaling or translation matrix, in-place. No need for a temporary matrix anymore. Furthermore, the methods return a reference to the matrix so you can easily chain transformations.

In addition to that i wrote a little class called ShapeRenderer which allows you to draw points, lines, (filled) rectangles, and boxes. The class is meant to support you while debugging and follows the batching paradigmn we have in a lot of our graphics classes. It’s actually not terribly slow, but i’d still not recommend using it in production.


You can find the code that produces the above output here. I put a bit of effort in the javadocs of the class as well. This is how i want all our javadocs to look like in the near future, maybe you can give me feedback if it’s good enough.