Matrix4f
This is a WIP project - Expect breaking changes to occur.
Overview
Represents a 4 x 4 matrix used for transformation in 3D graphics, including translation, rotation and scaling.
It provides methods to create identity, translation, rotation and scaling matrices, as well as a method to multiply two matrices together.
In our engine, the Matrix4f class provides methods for creating and manipulating these matrices to perform
transformations on objects in the 3D space.
Some of the key functionalities of the Matrix4f class include:
- Identity Matrix: A matrix that does not change any vector when multiplied by it.
- Translation: Moving an object from one position to another.
- Rotation: Rotating an object around an axis.
- Scaling: Changing the size of an object.
- Perspective Projection: Creating a perspective view of the scene.
The Matrix4f class is essential for rendering objects correctly in a 3D environment
and is often used in conjunction with shaders to achieve various visual effects.
identity()
public static Matrix4f identity() {}translate(...)
public static Matrix4f translate(Vector3f t) {}rotate(...)
public static Matrix4f rotate(float angle, Vector3f axis) {}scale(...)
public static Matrix4f scale(Vector3f s) {}transform(...)
public static Matrix4f transform(Vector3f positon, Vector3f rotation, Vector3f scale) {}lookAt(...)
public static Matrix4f lookAt(Vector3f eye, Vector3f center, Vector3f worldUp) {}perspective(...)
public static Matrix4f perspective(float fovDeg, float aspect, float near, float far) {}Creates a standard perspective projection matrix.
multiply(...)
public static Matrix4f multiply(Matrix4f a, Matrix4f b) {}Getters and Setters
get()
public float get(int row, int col) { return elements[row * SIZE + col]; }set()
public void set(int row, int col, float value) { elements[row * SIZE + col] = value; }getAll()
public float[] getAll() { return elements; }Last updated on