Programming
Fundamentals
Setting Up Development Environment
UnigineScript
High-Level Systems
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine and Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Node-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
Rendering-Related Classes

Unigine::Unigine::mat4 Struct

Header:#include <UnigineMathLib.h>

Matrix of 4x4 float components.

To use this structure, include the UnigineMathLib.h file.

mat4 Class

Members


mat4(const vec4 & col0, const vec4 & col1, const vec4 & col2, const vec4 & col3)

Arguments

  • const vec4 & col0
  • const vec4 & col1
  • const vec4 & col2
  • const vec4 & col3

mat4(const quat & q, const vec3 & v)

Arguments

  • const quat & q
  • const vec3 & v

mat4(const mat3 & m, const vec3 & v)

Arguments

  • const mat3 & m
  • const vec3 & v

mat4(const mat3 & m)

Arguments

  • const mat3 & m

mat4(const mat2 & m)

Arguments

  • const mat2 & m

mat4(float v)

Arguments

  • float v

mat4(const mat4 & m)

Arguments

  • const mat4 & m

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.

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.

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 set(const mat2 & m)

Arguments

  • const mat2 & m

void set(const mat3 & m, const vec3 & v)

Arguments

  • const mat3 & m
  • const vec3 & v

void set(const quat & q, const vec3 & v)

Arguments

  • const quat & q
  • const vec3 & v

void set(const mat3 & m)

Arguments

  • const mat3 & m

void set(const quat & q)

Arguments

  • const quat & q

void set(const mat4 & m)

Arguments

  • const mat4 & m

void set(const dmat4 & m)

Arguments

  • const dmat4 & m

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.

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 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.

float * get()

Get a pointer to the matrix.

Return value

Pointer to the matrix.

const float * get() const

Get a constant pointer to the matrix.

Return value

Pointer to the matrix.

vec3 getBack()

void setColumn(int column, const vec4 & v)

Set matrix column.

Arguments

  • int column - The column number.
  • const vec4 & v - The column value.

vec4 getColumn(int column) const

Get matrix column.

Arguments

  • int column - The column number.

Return value

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.

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 setDiagonal(const vec4 & v)

Arguments

  • const vec4 & v

vec4 getDiagonal()

vec3 getDown()

vec3 getForward()

void setIdentity()

Set identity matrix.

vec3 getLeft()

vec3 getRight()

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 setRow(int row, const vec4 & v)

Set matrix row.

Arguments

  • int row - The row number.
  • const vec4 & v - The row value.

vec4 getRow(int row) const

Get matrix row.

Arguments

  • int row - The row number.

Return value

Tme 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.

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 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.

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.

vec3 getUp()

void setZero()

const float * operator const float *()

const void * operator const void *()

float * operator float *()

void * operator void *()

mat4 & operator*=(const mat4 & m)

Matrix multiplication.

Arguments

  • const mat4 & m - The value of the matrix.

Return value

The resulting matrix.

mat4 & operator*=(float v)

Arguments

  • float v

mat4 & operator+=(const mat4 & m)

Arguments

  • const mat4 & m

mat4 operator-()

mat4 & operator-=(const mat4 & m)

Arguments

  • const mat4 & m

mat4 & operator=(const mat4 & m)

Arguments

  • const mat4 & m

float & operator[](int i)

Array access.

Arguments

  • int i - Array item index.

Return value

The array item.

float operator[](int i) const

Constant array access.

Arguments

  • int i - Array item index.

Return value

The array item.

void sse(const __m128 & v0, const __m128 & v1, const __m128 & v2, const __m128 & v3)

Arguments

  • const __m128 & v0
  • const __m128 & v1
  • const __m128 & v2
  • const __m128 & v3

void sse0(const __m128 & v)

Arguments

  • const __m128 & v

__m128 sse0()

__m128 sse1()

void sse1(const __m128 & v)

Arguments

  • const __m128 & v

__m128 sse2()

void sse2(const __m128 & v)

Arguments

  • const __m128 & v

void sse3(const __m128 & v)

Arguments

  • const __m128 & v

__m128 sse3()


int IDENTITY

int ONE

int ZERO

Last update: 2017-07-03