|
Back to Table of contents |
General information |
type: class
inherits: (none)
module: glowVectorAlgebraMat4f represents a 4x4 matrix of floats. It is used internally by the 3D view transform classes.
Most GLOW programs will not need to use Mat4f directly; however, it may be useful for customizing or manipulating the 3D view transform components.
Methods |
Constructors
Mat4f(void)
Creates a new matrix with the value set to the identity transform.Mat4f(GLfloat a, GLfloat b, GLfloat c, GLfloat d, GLfloat e, GLfloat f, GLfloat g, GLfloat h, GLfloat i, GLfloat j, GLfloat k, GLfloat l, GLfloat m, GLfloat n, GLfloat o, GLfloat p)
Creates a new matrix with the given values, in row-major order.Mat4f(const GLfloat* vals)
Creates a new vector, copying the given array of coordinates in column-major order. This is useful for constructing a matrix from an OpenGL matrix returned by glGetFloatv.Mat4f(const Mat4f& v)
Copy constructor.Setters
void Set(GLfloat a, GLfloat b, GLfloat c, GLfloat d, GLfloat e, GLfloat f, GLfloat g, GLfloat h, GLfloat i, GLfloat j, GLfloat k, GLfloat l, GLfloat m, GLfloat n, GLfloat o, GLfloat p)
Sets the vector to the specified values, in row-major order.void Set(const GLfloat* vals)
Sets the matrix to the specified array of coordinates in column-major order. This is useful for setting a matrix from an OpenGL matrix returned by glGetFloatv.Mat4f& operator=(const Mat4f& v)
Copies the given matrix.Mat4f& operator=(const GLfloat* vals)
Sets the matrix to the specified array of coordinates in column-major order. This is useful for setting a matrix from an OpenGL matrix returned by glGetFloatv.Misc access
void SetZero(void)
Sets the matrix to the zero transform.bool IsZero(void) const
Is this matrix the zero transform?void SetIdentity(void)
Sets the matrix to the identity transform.bool IsIdentity(void) const
Is this matrix the identity transform?void SetVal(short row, short column, GLfloat val)
Sets an indexed value in the matrix.GLfloat GetVal(short row, short column) const
Gets an indexed value in the matrix.OpenGL matrix integration
void GetGLMatrix(GLfloat* mat) const
Sets mat[0]..mat[15] to an OpenGL (column-major order) matrix matching this matrix.const GLfloat* GetGLMatrix(void) const
Returns a pointer to an OpenGL (column-major order) matrix matching this matrix.operator const GLfloat*(void) const
Cast to an OpenGL (column-major order) matrix matching this matrix.void SetGLMatrix(const GLfloat* mat)
Sets the matrix to the specified array of coordinates in OpenGL (column-major) order.Affine transforms
Use these methods to set a matrix to an affine transformation.void SetTranslation(GLfloat x, GLfloat y, GLfloat z)
void SetTranslation(const Vec3f& v)Sets the matrix to the specified translation transform.void SetRotation(GLfloat x, GLfloat y, GLfloat z, GLfloat angle)
void SetRotation(const Vec3f& axis, GLfloat angle)
void SetRotation(const Quatf& rot)Sets the matrix to the specified rotation transform. The angle must be specified in radians, and the axis should be normalized.void SetScale(GLfloat x, GLfloat y, GLfloat z)
void SetScale(const Vec3f& scale)
void SetScale(GLfloat scale)Sets the matrix to the specified scale transform. The third form indicates a uniform scalevoid SetAxisTransformation(const Vec3f& x, const Vec3f& y, const Vec3f& z)
Sets the matrix to a transformation that transforms the principal axes to the given vectors, applying the necessary rotation, scale and shear.void RemoveTranslation(void)
Removes the translation component from the matrix.Special operations
const Mat4f Inverse(void) const
Returns the inverse of this matrix, or the zero matrix if this matrix is singular.void SetInverse(const Mat4f& original)
Sets this matrix to the inverse of the given original, or the zero matrix if this matrix is singular.const Mat4f Transpose(void) const
Returns the transpose of this matrix.void SetTranspose(const Mat4f& original)
Sets this matrix to the transpose of the given original.const Mat4f Cofactors(void) const
Returns the matrix of cofactors of this matrix.void SetCofactors(const Mat4f& original)
Sets this matrix to the matrix of cofactors of the given original.GLfloat Determinant(void) const
Returns the determinant of this matrix.Arithmetic operations
Mat4f provides a full set of arithmetic operations on 4x4 matrices.
- Mat4f == Mat4f ---> bool
- matrix equality
- Mat4f != Mat4f ---> bool
- matrix inequality
- - Mat4f ---> Mat4f
- matrix negation
- Mat4f * GLfloat ---> Mat4f
- scalar multiplication
- GLfloat * Mat4f ---> Mat4f
- scalar multiplication
- Mat4f / GLfloat ---> Mat4f
- scalar division
- Mat4f *= GLfloat
- in-place scalar multiplication
- Mat4f /= GLfloat
- in-place scalar division
- Mat4f + Mat4f ---> Mat4f
- matrix addition
- Mat4f - Mat4f ---> Mat4f
- matrix subtraction
- Mat4f * Mat4f ---> Mat4f
- matrix multiplication
- Mat4f += Mat4f
- in-place matrix addition
- Mat4f -= Mat4f
- in-place matrix subtraction
- Mat4f *= Mat4f
- in-place matrix multiplication
- Mat4f * Vec3f ---> Vec3f
- application of matrix to vector
|
Back to Table of contents |
The GLOW Toolkit