mat4 Struct (C++)
Matrix of 4x4 float components.
To use this structure, include the UnigineMathLib.h file.
Unigine::mat4Structure
Members
UNIGINE_DECLARE_USE_MEMORY mat4 ()
Default constructor that produces an identity matrix.explicit mat4 (const dmat4 & m)
Initialization by a matrix.Arguments
- const dmat4 & m - The value of the matrix.
explicit mat4 (const quat & q)
Initialization by a quaternion.Arguments
- const quat & q - The value of the quaternion.
explicit mat4 (const float * m, int transpose)
Initialization by a pointer to the matrix.Arguments
- const float * m - Pointer to the matrix.
- int transpose - If transpose is 0 (by default), the matrix is specified in the column major style.
mat4 & operator*= (const mat4 & m)
Matrix multiplication.Arguments
- const mat4 & m - The value of the matrix.
Return value
The resulting matrix.UNIGINE_INLINE float & operator[] (int i)
Array access.Arguments
- int i - Array item index.
Return value
The array item.UNIGINE_INLINE float operator[] (int i) const
Constant array access.Arguments
- int i - Array item index.
Return value
The array item.UNIGINE_INLINE void set (int row, int column, float v)
Set matrix item.Arguments
- int row - The row number.
- int column - The column number.
- float v - The matrix item.
UNIGINE_INLINE float & get (int row, int column)
Get matrix item.Arguments
- int row - The row number.
- int column - The column number.
Return value
The matrix item.UNIGINE_INLINE float get (int row, int column) const
Get a constant matrix item.Arguments
- int row - The row number.
- int column - The column number.
Return value
The matrix item.void set (const float * m, int transpose)
Set matrix.Arguments
- const float * m - Pointer to the matrix.
- int transpose - If transpose is 0 (by default), the matrix is specified in the column major style.
void get (float * m, int transpose) const
Get matrix.Arguments
- float * m - Pointer to the matrix.
- int transpose - If transpose is 0 (by default), the matrix is specified in the column major style.
UNIGINE_INLINE float * get ()
Get a pointer to the matrix.Return value
Pointer to the matrix.UNIGINE_INLINE const float * get () const
Get a constant pointer to the matrix.Return value
Pointer to the matrix.void setRow (int row, const vec4 & v)
Set matrix row.Arguments
- int row - The row number.
- const vec4 & v - The row value.
void setRow3 (int row, const vec3 & v)
Sets the new value for the given matrix row.Arguments
- int row - The row number.
- const vec3 & v - Row value.
vec4 getRow (int row) const
Get matrix row.Arguments
- int row - The row number.
Return value
Tme row value.vec3 getRow3 (int row) const
Returns the current value of the given matrix row. If such a row does not exist, the matrix identity is returned.Arguments
- int row - The row number.
Return value
Row value.void setColumn (int column, const vec4 & v)
Set matrix column.Arguments
- int column - The column number.
- const vec4 & v - The column value.
void setColumn3 (int column, const vec3 & v)
Sets the new value for the given matrix column.Arguments
- int column - Column number.
- const vec3 & v - Row value.
vec4 getColumn (int column) const
Get matrix column.Arguments
- int column - The column number.
Return value
The column value.vec3 getColumn3 (int column) const
Returns the current value of the given matrix column. If such a column does not exist, the matrix identity is returned.Arguments
- int column - Column number.
Return value
Row value.void setIdentity ()
Set identity matrix.void setTranslate (const vec3 & v)
Set translation matrix.Arguments
- const vec3 & v - The value of the translation vector.
vec3 getTranslate () const
Get translation part of the matrix.Return value
Matrix translation part.void setRotate (const vec3 & axis, float angle)
Set rotation matrix.Arguments
- const vec3 & axis - Rotation axis.
- float angle - Rotation angle (in degrees).
quat getRotate () const
Get rotation part of the matrix.Return value
Matrix rotation part.void setRotateX (float angle)
Set X rotation matrix.Arguments
- float angle - Rotation angle (in degrees).
void setRotateY (float angle)
Set Y rotation matrix.Arguments
- float angle - Rotation angle (in degrees).
void setRotateZ (float angle)
Set Z rotation matrix.Arguments
- float angle - Rotation angle (in degrees).
void setScale (const vec3 & v)
Set scale matrix.Arguments
- const vec3 & v - The value of the scaling vector.
vec3 getScale () const
Get scaling part of the matrix.Return value
Matrix scaling part.Unigine::mat4::Union
union {
struct
{
float m00;
float m10;
float m20;
float m30;
float m01;
float m11;
float m21;
float m31;
float m02;
float m12;
float m22;
float m32;
float m03;
float m13;
float m23;
float m33;
};
float mat[16];
};
Last update: 03.07.2017
Помогите сделать статью лучше
Была ли эта статья полезной?
(или выберите слово/фразу и нажмите Ctrl+Enter