|
Gin
|
A 4x4 matrix class for 3D transformations. More...
#include <gin_mat4.h>
Public Member Functions | |
| Mat4 () | |
| Mat4 | operator* (const Mat4 &other) const |
| Matrix multiplication. | |
| Vec3< T > | transformPoint (const Vec3< T > &v) const |
| Transform a 3D point (applies full transformation including translation). | |
| Vec3< T > | transformVector (const Vec3< T > &v) const |
| Transform a 3D vector (applies rotation/scale only, no translation). | |
| std::array< T, 4 > | project (const Vec3< T > &v) const |
| Project a point and return clip-space coordinates (x, y, z, w). | |
Static Public Member Functions | |
| static Mat4 | identity () |
| Creates an identity matrix. | |
| static Mat4 | translation (T x, T y, T z) |
| Creates a translation matrix. | |
| static Mat4 | translation (const Vec3< T > &v) |
| static Mat4 | scale (T x, T y, T z) |
| Creates a scaling matrix. | |
| static Mat4 | scale (T s) |
| static Mat4 | rotationX (T angle) |
| Creates a rotation matrix around the X axis (angle in radians). | |
| static Mat4 | rotationY (T angle) |
| Creates a rotation matrix around the Y axis (angle in radians). | |
| static Mat4 | rotationZ (T angle) |
| Creates a rotation matrix around the Z axis (angle in radians). | |
| static Mat4 | perspective (T fovY, T aspect, T nearZ, T farZ) |
| Creates a perspective projection matrix. | |
| static Mat4 | orthographic (T left, T right, T bottom, T top, T nearZ, T farZ) |
| Creates an orthographic projection matrix. | |
| static Mat4 | lookAt (const Vec3< T > &eye, const Vec3< T > &target, const Vec3< T > &up) |
| Creates a look-at view matrix. | |
Public Attributes | |
| std::array< std::array< T, 4 >, 4 > | m |
A 4x4 matrix class for 3D transformations.
Stored in column-major order for OpenGL compatibility.
References Mat4< T >::m.
Referenced by Mat4< T >::identity().
Creates an identity matrix.
References Mat4< T >::Mat4().
References Mat4< T >::translation(), Point< T >::x, and Point< T >::y.
References Mat4< T >::scale().
Creates a rotation matrix around the X axis (angle in radians).
References Mat4< T >::m.
Creates a rotation matrix around the Y axis (angle in radians).
References Mat4< T >::m.
Creates a rotation matrix around the Z axis (angle in radians).
References Mat4< T >::m.
|
static |
Creates a perspective projection matrix.
| fovY | Field of view in the Y direction (radians) |
| aspect | Aspect ratio (width / height) |
| nearZ | Near clipping plane |
| farZ | Far clipping plane |
References Mat4< T >::m.
|
static |
Creates an orthographic projection matrix.
References Mat4< T >::m.
|
static |
Creates a look-at view matrix.
References Mat4< T >::m, Point< T >::x, and Point< T >::y.
Matrix multiplication.
References Mat4< T >::m.
Transform a 3D point (applies full transformation including translation).
References Mat4< T >::m, Point< T >::x, and Point< T >::y.
Transform a 3D vector (applies rotation/scale only, no translation).
References Mat4< T >::m, Point< T >::x, and Point< T >::y.
Project a point and return clip-space coordinates (x, y, z, w).
References Mat4< T >::m, Point< T >::x, and Point< T >::y.
Referenced by Object3D::getPosition(), Mat4< T >::lookAt(), Mat4< T >::Mat4(), Mat4< T >::operator*(), Mat4< T >::orthographic(), Mat4< T >::perspective(), Mat4< T >::project(), Mat4< T >::rotationX(), Mat4< T >::rotationY(), Mat4< T >::rotationZ(), Mat4< T >::scale(), Object3D::setPosition(), Mat4< T >::transformPoint(), Mat4< T >::transformVector(), and Mat4< T >::translation().