I’m working on cleaning up my skeletal animation test program. I had planned to stop using LWJGL’s built-in matrix and vector classes but I just haven’t bothered to do so, but when I started with animation I realized how many lacking features there were, especially in the Quaternion class. Now I’m out hunting for a good math library.
Here is a list of features that I need. Functions in red are missing from LWJGL’s math lib.
- Matrix4x4 operations: translate by vector, multiply, invert.
- Vector4 functions: transform by matrix
- Quaternion functions: quat-quat multiplication, rotate vector by quaternion, slerp, quaternion to matrix conversion.
Performance related features:
- No allocations. I’ll be doing a lot of math for each bone, so being forced to allocate new objects all the time is going to increase GC stuttering quite a bit.
- Everything is going into FloatBuffers in the end, so something similar to LWJGL’s Matrix4f.load(floatBuffer) would be nice but not necessary.
- I only need float precision these classes. Double precision would reduce performance and double the GPU bandwidth needed for an unnoticeable increase in precision.
Obviously I can survive with the LWJGL math lib, but I’d really like to start using a better one if possible. What do you guys use and recommend?