ClanLib
2.3.7
|
4D matrix More...
#include <mat2.h>
Public Member Functions | |
Operations | |
CL_Mat4< Type > & | multiply (const CL_Mat4< Type > &mult) |
Multiply this matrix and a specified matrix. More... | |
CL_Mat4< Type > & | add (const CL_Mat4< Type > &add_matrix) |
Add this matrix and a specified matrix. More... | |
CL_Mat4< Type > & | subtract (const CL_Mat4< Type > &sub_matrix) |
Subtract this matrix and a specified matrix. More... | |
CL_Mat4< Type > & | scale_self (Type x, Type y, Type z) |
Scale this matrix. More... | |
CL_Mat4< Type > & | translate_self (Type x, Type y, Type z) |
Translate this matrix. More... | |
double | det () const |
Calculate the matrix determinant of this matrix. More... | |
CL_Mat4< Type > & | adjoint () |
Calculate the adjoint (or known as adjugate) of this matrix. More... | |
CL_Mat4< Type > & | inverse () |
Calculate the matrix inverse of this matrix. More... | |
CL_Mat4< Type > & | transpose () |
Calculate the transpose of this matrix. More... | |
Operators | |
operator Type const * () const | |
Operator that returns the matrix as a array. More... | |
operator Type * () | |
Operator that returns the matrix as a array. More... | |
Type & | operator[] (int i) |
Operator that returns the matrix cell at the given index. More... | |
const Type & | operator[] (int i) const |
Operator that returns the matrix cell at the given index. More... | |
Type & | operator[] (unsigned int i) |
Operator that returns the matrix cell at the given index. More... | |
const Type & | operator[] (unsigned int i) const |
Operator that returns the matrix cell at the given index. More... | |
CL_Mat4< Type > & | operator= (const CL_Mat4< Type > ©) |
Copy assignment operator. More... | |
CL_Mat4< Type > & | operator= (const CL_Mat3< Type > ©) |
Copy assignment operator. More... | |
CL_Mat4< Type > & | operator= (const CL_Mat2< Type > ©) |
Copy assignment operator. More... | |
CL_Mat4< Type > | operator* (const CL_Mat4< Type > &mult) const |
Multiplication operator. More... | |
CL_Mat4< Type > | operator+ (const CL_Mat4< Type > &add_matrix) const |
Addition operator. More... | |
CL_Mat4< Type > | operator- (const CL_Mat4< Type > &sub_matrix) const |
Subtraction operator. More... | |
bool | operator== (const CL_Mat4< Type > &other) |
Equality operator. More... | |
bool | operator!= (const CL_Mat4< Type > &other) |
Not-equal operator. More... | |
Construction | |
CL_Mat4 () | |
Constructs a 4x4 matrix (null) More... | |
CL_Mat4 (const CL_Mat4< Type > ©) | |
Constructs a 4x4 matrix (copied) More... | |
CL_Mat4 (const CL_Mat2< Type > ©) | |
Constructs a 4x4 matrix (copied from a 2d matrix) More... | |
CL_Mat4 (const CL_Mat3< Type > ©) | |
Constructs a 4x4 matrix (copied from a 3d matrix) More... | |
CL_Mat4 (const float *init_matrix) | |
Constructs a 4x4 matrix (copied from a array of floats) More... | |
CL_Mat4 (const double *init_matrix) | |
Constructs a 4x4 matrix (copied from a array of doubles) More... | |
CL_Mat4 (const cl_byte64 *init_matrix) | |
Constructs a 4x4 matrix (copied from a array of 64 bit integers) More... | |
CL_Mat4 (const cl_byte32 *init_matrix) | |
Constructs a 4x4 matrix (copied from a array of 32 bit integers) More... | |
CL_Mat4 (const cl_byte16 *init_matrix) | |
Constructs a 4x4 matrix (copied from a array of 16 bit integers) More... | |
CL_Mat4 (const cl_byte8 *init_matrix) | |
Constructs a 4x4 matrix (copied from a array of 8 bit integers) More... | |
static CL_Mat4< Type > | null () |
Create a zero matrix. More... | |
static CL_Mat4< Type > | identity () |
Create the identity matrix. More... | |
static CL_Mat4< Type > | frustum (Type left, Type right, Type bottom, Type top, Type z_near, Type z_far) |
Create a frustum matrix. More... | |
static CL_Mat4< Type > | perspective (Type field_of_view_y_degrees, Type aspect, Type z_near, Type z_far) |
Create a perspective matrix. More... | |
static CL_Mat4< Type > | ortho (Type left, Type right, Type bottom, Type top, Type z_near, Type z_far) |
Create a ortho matrix. More... | |
static CL_Mat4< Type > | ortho_2d (Type left, Type right, Type bottom, Type top) |
Create a ortho_2d matrix. More... | |
static CL_Mat4< Type > | rotate (const CL_Angle &angle, Type x, Type y, Type z, bool normalize=true) |
Create a rotation matrix. More... | |
static CL_Mat4< Type > | rotate (const CL_Angle &angle_x, const CL_Angle &angle_y, const CL_Angle &angle_z, CL_EulerOrder order) |
Create a rotation matrix using euler angles. More... | |
static CL_Mat4< Type > | scale (Type x, Type y, Type z) |
Create a scale matrix. More... | |
static CL_Mat4< Type > | translate (Type x, Type y, Type z) |
Create a translation matrix. More... | |
static CL_Mat4< Type > | look_at (Type eye_x, Type eye_y, Type eye_z, Type center_x, Type center_y, Type center_z, Type up_x, Type up_y, Type up_z) |
Create the "look at" matrix. More... | |
static CL_Mat4< Type > | multiply (const CL_Mat4< Type > &matrix_1, const CL_Mat4< Type > &matrix_2) |
Multiply 2 matrices. More... | |
static CL_Mat4< Type > | add (const CL_Mat4< Type > &matrix_1, const CL_Mat4< Type > &matrix_2) |
Add 2 matrices. More... | |
static CL_Mat4< Type > | subtract (const CL_Mat4< Type > &matrix_1, const CL_Mat4< Type > &matrix_2) |
Subtract 2 matrices. More... | |
static CL_Mat4< Type > | adjoint (const CL_Mat4< Type > &matrix) |
Calculate the adjoint (or known as Adjugate or Conjugate Transpose) of a matrix. More... | |
static CL_Mat4< Type > | inverse (const CL_Mat4< Type > &matrix) |
Calculate the matrix inverse of a matrix. More... | |
static CL_Mat4< Type > | transpose (const CL_Mat4< Type > &matrix) |
Calculate the transpose of a matrix. More... | |
Attributes | |
Type | matrix [16] |
The matrix (in column-major format) More... | |
Type | get_origin_x () const |
Returns the x coordinate for the point (0,0,0) multiplied with this matrix. More... | |
Type | get_origin_y () const |
Returns the y coordinate for the point (0,0,0) multiplied with this matrix. More... | |
Type | get_origin_z () const |
Returns the z coordinate for the point (0,0,0) multiplied with this matrix. More... | |
CL_Vec3< Type > | get_euler (CL_EulerOrder order) const |
Extract the euler angles (in radians) from a matrix (in column-major format) More... | |
CL_Vec3< Type > | get_transformed_point (const CL_Vec3< Type > &vector) const |
Get a transformed point from the matrix (in column-major format) More... | |
4D matrix
These matrix templates are defined for: int (CL_Mat4i), float (CL_Mat4f), double (CL_Mat4d)
Constructs a 4x4 matrix (null)
References CL_Mat4< Type >::matrix.
Constructs a 4x4 matrix (copied)
References CL_Mat4< Type >::matrix.
Constructs a 4x4 matrix (copied from a 2d matrix)
Constructs a 4x4 matrix (copied from a 3d matrix)
Constructs a 4x4 matrix (copied from a array of floats)
References CL_Mat4< Type >::matrix.
Constructs a 4x4 matrix (copied from a array of doubles)
References CL_Mat4< Type >::matrix.
Constructs a 4x4 matrix (copied from a array of 64 bit integers)
References CL_Mat4< Type >::matrix.
Constructs a 4x4 matrix (copied from a array of 32 bit integers)
References CL_Mat4< Type >::matrix.
Constructs a 4x4 matrix (copied from a array of 16 bit integers)
References CL_Mat4< Type >::matrix.
Constructs a 4x4 matrix (copied from a array of 8 bit integers)
References CL_Mat4< Type >::matrix.
|
static |
Add 2 matrices.
This adds the matrix as follows: result = matrix1 + matrix2
matrix_1 | = First Matrix to add |
matrix_2 | = Second Matrix to add |
Referenced by CL_Mat4< Type >::operator+().
Add this matrix and a specified matrix.
This adds the matrix as follows: this = mult + this
add_matrix | = Matrix to add |
|
static |
Calculate the adjoint (or known as Adjugate or Conjugate Transpose) of a matrix.
matrix | = The matrix to use |
Calculate the adjoint (or known as adjugate) of this matrix.
double CL_Mat4< Type >::det | ( | ) | const |
Calculate the matrix determinant of this matrix.
|
static |
Create a frustum matrix.
Matrix is created in the Column-Major matrix format (opengl native)
CL_Vec3<Type> CL_Mat4< Type >::get_euler | ( | CL_EulerOrder | order) | const |
Extract the euler angles (in radians) from a matrix (in column-major format)
|
inline |
Returns the x coordinate for the point (0,0,0) multiplied with this matrix.
References CL_Mat4< Type >::matrix.
|
inline |
Returns the y coordinate for the point (0,0,0) multiplied with this matrix.
References CL_Mat4< Type >::matrix.
|
inline |
Returns the z coordinate for the point (0,0,0) multiplied with this matrix.
References CL_Mat4< Type >::matrix.
CL_Vec3<Type> CL_Mat4< Type >::get_transformed_point | ( | const CL_Vec3< Type > & | vector) | const |
Get a transformed point from the matrix (in column-major format)
Create the identity matrix.
|
static |
Calculate the matrix inverse of a matrix.
Creates a zero matrix if the determinent == 0
matrix | = The matrix to use |
Calculate the matrix inverse of this matrix.
Creates a zero matrix if the determinent == 0
|
static |
Create the "look at" matrix.
Matrix is created in the Column-Major matrix format (opengl native)
eye_x | = Eye position X |
eye_y | = Eye position Y |
eye_z | = Eye position Z |
center_x | = Center X |
center_y | = Center Y |
center_z | = Center Z |
up_x | = Translation X |
up_y | = Translation Y |
up_z | = Translation Z |
|
static |
Multiply 2 matrices.
This multiplies the matrix as follows: result = matrix1 * matrix2
matrix_1 | = First Matrix to multiply |
matrix_2 | = Second Matrix to multiply |
Referenced by CL_Mat4< Type >::operator*().
Multiply this matrix and a specified matrix.
This multiplies the matrix as follows: this = mult * this
mult | = Matrix to multiply |
Create a zero matrix.
|
inline |
Operator that returns the matrix as a array.
References CL_Mat4< Type >::matrix.
|
inline |
Operator that returns the matrix as a array.
References CL_Mat4< Type >::matrix.
Not-equal operator.
|
inline |
Multiplication operator.
References CL_Mat4< Type >::multiply().
|
inline |
Addition operator.
References CL_Mat4< Type >::add().
|
inline |
Subtraction operator.
References CL_Mat4< Type >::subtract().
|
inline |
Copy assignment operator.
References CL_Mat4< Type >::matrix.
Copy assignment operator.
Copy assignment operator.
Equality operator.
References CL_Mat4< Type >::matrix.
|
inline |
Operator that returns the matrix cell at the given index.
References CL_Mat4< Type >::matrix.
|
inline |
Operator that returns the matrix cell at the given index.
References CL_Mat4< Type >::matrix.
|
inline |
Operator that returns the matrix cell at the given index.
References CL_Mat4< Type >::matrix.
|
inline |
Operator that returns the matrix cell at the given index.
References CL_Mat4< Type >::matrix.
|
static |
Create a ortho matrix.
Matrix is created in the Column-Major matrix format (opengl native)
|
static |
Create a ortho_2d matrix.
Matrix is created in the Column-Major matrix format (opengl native)
|
static |
Create a perspective matrix.
Matrix is created in the Column-Major matrix format (opengl native)
|
static |
Create a rotation matrix.
Matrix is created in the Column-Major matrix format (opengl native)
angle | = Angle to rotate by |
x | = Amount to rotate in the X axis |
y | = Amount to rotate in the Y axis |
z | = Amount to rotate in the Z axis |
normalize | = true = Normalize x,y,z before creating rotation matrix |
|
static |
Create a rotation matrix using euler angles.
Matrix is created in the Column-Major matrix format (opengl native)
|
static |
Create a scale matrix.
x | = Scale X |
y | = Scale Y |
z | = Scale Z |
Scale this matrix.
This is faster than using: multiply(CL_Mat4<Type>::scale(x,y,z) )
x | = Scale X |
y | = Scale Y |
z | = Scale Z |
|
static |
Subtract 2 matrices.
This subtracts the matrix as follows: result = matrix1 - matrix2
matrix_1 | = First Matrix to subtract |
matrix_2 | = Second Matrix to subtract |
Referenced by CL_Mat4< Type >::operator-().
CL_Mat4<Type>& CL_Mat4< Type >::subtract | ( | const CL_Mat4< Type > & | sub_matrix) |
Subtract this matrix and a specified matrix.
This subtracts the matrix as follows: this = mult - this
sub_matrix | = Matrix to subtract |
|
static |
Create a translation matrix.
Matrix is created in the Column-Major matrix format (opengl native)
x | = Translate X |
y | = Translate Y |
z | = Translate Z |
Translate this matrix.
Matrix is assumed to be in the Column-Major matrix format (opengl native)
This is faster than using: multiply(CL_Mat4<Type>::translate(x,y,z) )
x | = Translate X |
y | = Translate Y |
z | = Translate Z |
|
static |
Calculate the transpose of a matrix.
matrix | = The matrix to use |
Calculate the transpose of this matrix.
Type CL_Mat4< Type >::matrix[16] |
The matrix (in column-major format)
Referenced by CL_Mat4< Type >::CL_Mat4(), CL_Mat4< Type >::get_origin_x(), CL_Mat4< Type >::get_origin_y(), CL_Mat4< Type >::get_origin_z(), CL_Mat4< Type >::operator Type *(), CL_Mat4< Type >::operator Type const *(), CL_Mat4< Type >::operator=(), CL_Mat4< Type >::operator==(), CL_Mat4< Type >::operator[](), and CL_ProgramObject::set_uniform_matrix().