adbrown85/glycerin — Issue #2: Add 3 and 4 width square matrix implementations
Author: adbrown85
Created: 2012-02-08 02:31:20+00:00
State: open

Since OpenGL no longer has matrix math built-in, we need to make some matrix implementations. For 3D graphics I think three and four width square matrices are enough.

Like our vectors, it would be nice to have them mirror the GLSL implementations as much as possible. Therefore the names should probably be *Mat3* and *Mat4*. (We'll go with capitals for now to be consistent with other types in the library...) To make things easy for now we'll just stick with floats. If we need doubles later we can tack on a *d* at the end of the name, similar to what GLSL does, or even go template based.

Besides all the necessary operators, they should have a few extra top-level functions that users will expect.

- *inverse*
- *transpose*

Also we will want some *toArray* methods so we can easily send the values to OpenGL shaders, or just for users that want or need to work with arrays. We will assume the single-index forms are in column-major order though. We won't support dumping down to a pointer because there's no way to know the dimensions of that.

- *toArray*(float[3][3])
- *toArray*(float[4][4])
- *toArray*(float[9])
- *toArray*(float[16])