This page has been translated automatically.
UnigineEditor
Interface Overview
Assets Workflow
Settings and Preferences
Working With Projects
Adjusting Node Parameters
Setting Up Materials
Setting Up Properties
Landscape Tool
Using Editor Tools for Specific Tasks
Extending Editor Functionality
Programming
Fundamentals
Setting Up Development Environment
Usage Examples
UnigineScript
C++
C#
UUSL (Unified UNIGINE Shader Language)
File Formats
Rebuilding the Engine Tools
GUI
Double Precision Coordinates
API
Containers
Common Functionality
Controls-Related Classes
Engine-Related Classes
Filesystem Functionality
GUI-Related Classes
Node-Related Classes
Objects-Related Classes
Networking Functionality
Pathfinding-Related Classes
Physics-Related Classes
Plugins-Related Classes
IG Plugin
CIGIConnector Plugin
Rendering-Related Classes
Warning! This version of documentation is OUTDATED, as it describes an older SDK version! Please switch to the documentation for the latest SDK version.
Warning! This version of documentation describes an old SDK version which is no longer supported! Please upgrade to the latest SDK version.

Unigine.mat4 Struct

This class represents a matrix of sixteen (4x4) float components.

mat4 Class

Properties

vec4 AxisX#

The normalized vector representing the X axis.

vec4 AxisY#

The normalized vector representing the Y axis.

vec4 AxisZ#

The normalized vector representing the Z axis.

vec4 Diagonal#

The vector with the elements of the main diagonal.

vec3 Translate#

The three-component vector with the translation part of the matrix.

vec3 Scale#

The three-component vector, representing the scaling part of the matrix.

Members


mat4 ( ) #

Default constructor. Produces an identity matrix.

mat4 ( float v ) #

Constructor. Initializes the matrix using a given scalar value.
Source code (UnigineScript)
mat4(2.0);
						
/* Creates a matrix						
| 2.0 	2.0 	2.0		2.0	|
| 2.0 	2.0 	2.0		2.0	|
| 2.0 	2.0 	2.0		2.0	|
| 2.0 	2.0 	2.0		2.0	|						
*/

Arguments

  • float v - Scalar value.

mat4 ( const mat3 & m ) #

Constructor. Initializes the matrix using a given mat3 source matrix (3x3). The matrix elements are filled using corresponding elements of the source matrix.
Output
Resulting matrix: 
    | m00  	 m01  	 m02	  0.0f | 
M=  | m10    m11  	 m12      0.0f |
    | m20    m21     m22      0.0f |
    | 0.0f   0.0f    0.0f     1.0f |

Arguments

  • const mat3 & m - Source matrix (3x3).

mat4 ( const mat4 & m ) #

Constructor. Initializes the matrix by copying a given source matrix.

Arguments

  • const mat4 & m - Source matrix.

explicit mat4 ( const dmat4 & m ) #

Constructor. Initializes the matrix using a given dmat4 source matrix (3x4). The matrix elements are filled using corresponding elements of the source matrix.

Arguments

  • const dmat4 & m - Source matrix (3x4).

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

Constructor. Initializes the matrix using given three vec4 vectors.
Output
Resulting matrix: 
    | col0.x  	 col1.x	  	col2.x	   col3.x | 
M=  | col0.y   	 col1.y	  	col2.y     col3.y |
    | col0.z   	 col1.z	  	col2.z     col3.z |
	| col0.w   	 col1.w	  	col2.w     col3.w |

Arguments

  • const vec4 & col0 - Source vector for the first column.
  • const vec4 & col1 - Source vector for the second column.
  • const vec4 & col2 - Source vector for the third column.
  • const vec4 & col3 - Source vector for the fourth column.

explicit mat4 ( const quat & q ) #

Constructor. Initializes the matrix using a given source quaternion.
Output
For the quaternion (x, y, z, w) the corresponding rotation matrix M is defined as follows:		
    | 1 - 2y² - 2z²    2xy + 2wz      	2xz - 2wy     	0.0f | 
M=  | 2xy - 2wz        1 - 2x² - 2z²    2yz + 2wx     	0.0f |
    | 2xz + 2wy        2yz - 2wx        1 - 2x² - 2y² 	0.0f |
    |  0.0f            0.0f        		0.0f 			1.0f |

Arguments

  • const quat & q - Source quaternion.

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

Constructor. Initializes the matrix using a given source mat3 matrix (3x3) and a vec3 vector.

Arguments

  • const mat3 & m - Source matrix (3x3).
  • const vec3 & v - Source vector.

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

Constructor. Initializes the matrix using a given quaternion and a vec3 vector.

Arguments

  • const quat & q - Source quaternion.
  • const vec3 & v - Source vector.

explicit mat4 ( const float * m, int transpose ) #

Constructor. Initializes the matrix using a given pointer to the source matrix.

Arguments

  • const float * m - Pointer to the source matrix.
  • int transpose - If transpose is 0 (by default), the matrix is specified in the column major style.

mat4 & Operator*= ( const mat4 & m ) #

Performs matrix multiplication.

Arguments

  • const mat4 & m - Matrix.

Return value

Resulting matrix.

mat4 & Operator*= ( float v ) #

Performs scalar multiplication.

Arguments

  • float v - Scalar value.

Return value

Resulting matrix.

mat4 & Operator*= ( vec3 v ) #

Performs vector multiplication.

Arguments

  • vec3 v - Vector.

Return value

Resulting matrix.

mat4 & Operator*= ( vec4 v ) #

Performs vector multiplication.

Arguments

  • vec4 v - Vector.

Return value

Resulting matrix.

mat4 & Operator*= ( dvec3 v ) #

Performs vector multiplication.

Arguments

  • dvec3 v - Vector.

Return value

Resulting matrix.

mat4 & Operator*= ( dvec4 v ) #

Performs vector multiplication.

Arguments

  • dvec4 v - Vector.

Return value

Resulting matrix.

mat4 & Operator+= ( const mat4 & m ) #

Performs matrix addition.

Arguments

  • const mat4 & m - Matrix.

Return value

Resulting matrix.

mat4 Operator- ( ) #

Performs matrix negation.

mat4 & Operator-= ( const mat4 & m ) #

Performs matrix subtraction.

Arguments

  • const mat4 & m - Matrix.

Return value

Resulting matrix.

float & Operator[] ( int i ) #

Performs array access to the matrix item reference using given item index.

Arguments

  • int i - Matrix item index.

Return value

Matrix item reference.

float Operator[] ( int i ) #

Performs array access to the matrix item using given item index.

Arguments

  • int i - Matrix item index.

Return value

Matrix item.
Last update: 2020-05-19
Build: ()