This page has been translated automatically.
Программирование
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
Внимание! Эта версия документация УСТАРЕЛА, поскольку относится к более ранней версии SDK! Пожалуйста, переключитесь на самую актуальную документацию для последней версии SDK.
Внимание! Эта версия документации описывает устаревшую версию SDK, которая больше не поддерживается! Пожалуйста, обновитесь до последней версии SDK.

Math Matrix Functions

mat4 cubeTransform(int face)

Returns cube viewing matrix for the given cube face.

Arguments

  • int face - Cube face number.

Return value

Cube viewing matrix.

mat4 frustum(float left, float right, float bottom, float top, float znear, float zfar)

Returns perspective projection matrix:
2.0 * znear / (right - left) 0.0 (right + left) / (right - left) 0.0
0.0 2.0 * znear / (top - bottom) (top + bottom) / (top - bottom) 0.0
0.0 0.0 -(zfar + znear) / (zfar - znear) -2.0 * zfar * znear / (zfar - znear)
0.0 0.0 -1.0 0.0

Coordinates of top, left, right, bottom are set relatively to center point of the znear plane.

There are two different points (A and B) on the picture above. Since the top, left, right, bottom are coordinates relatively to the center point of the znear plane, coordinates of the A point should be A(left, bottom, znear). Coordinates of the B point are B(k * left, k * bottom, zfar), where k = zfar/znear.

Arguments

  • float left - Left coordinate of the near clipping plane relatively to the center.
  • float right - Right coordinate of the near clipping plane relatively to the center.
  • float bottom - Bottom coordinate of the near clipping plane relatively to the center.
  • float top - Top coordinate of the near clipping plane relatively to the center.
  • float znear - Distance to the near depth clipping plane.
  • float zfar - Distance to the farther depth clipping plane.

Return value

Perspective projection matrix.

mat4 inverse4(const mat4 & m)

Return inverse of 3x4 matrix.

Arguments

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

Return value

The resulting matrix.

dmat4 inverse(const dmat4 & m)

Return inverse matrix.

Arguments

  • const dmat4 & m - The value of the first matrix.

Return value

The resulting matrix.

mat4 inverse(const mat4 & m)

Return inverse of 4x4 matrix.

Arguments

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

Return value

The resulting matrix.

mat4 lookAt(const vec3 & position, const vec3 & direction, const vec3 & up)

Return viewing matrix.

Arguments

  • const vec3 & position - Position coordinates of the target point.
  • const vec3 & direction - Direction of the vector.
  • const vec3 & up - Direction of the up vector.

Return value

The viewing matrix.

dmat4 lookAt(const dvec3 & position, const dvec3 & direction, const vec3 & up)

Return viewing matrix.

Arguments

  • const dvec3 & position - Position coordinates of the target point.
  • const dvec3 & direction - Direction of the vector.
  • const vec3 & up - Direction of the up vector.

Return value

The viewing matrix.

mat4 obliqueProjection(const mat4 & projection, const vec4 & plane)

Return oblique projection matrix.

Arguments

  • const mat4 & projection - Projection matrix.
  • const vec4 & plane - Clipping plane.

Return value

The oblique projection matrix.

quat orthoTangent(const vec4 & tangent, const vec3 & normal)

Creates the ortho triangle tangent space basis.

Arguments

  • const vec4 & tangent - Tangent vector.
  • const vec3 & normal - Normal vector.

Return value

The tangent basis.

quat orthoTangent(const vec3 & tangent, const vec3 & binormal, const vec3 & normal)

Creates the ortho triangle tangent space basis.

Arguments

  • const vec3 & tangent - Tangent vector.
  • const vec3 & binormal - Binormal vector.
  • const vec3 & normal - Normal vector.

Return value

The tangent basis.

mat4 perspective(float fov, float aspect, float znear, float zfar)

Returns perspective projection matrix.

Arguments

  • float fov - Field of view angle.
  • float aspect - Aspect ratio. The aspect ratio is the ratio of width to height.
  • float znear - Nearest depth clipping plane.
  • float zfar - Farther depth clipping plane.

Return value

Perspective projection matrix.

mat4 reflect(const vec4 & plane)

Return reflection matrix.

Arguments

  • const vec4 & plane - Reflection plane.

Return value

The reflection matrix.

dmat4 reflect(const dvec4 & plane)

Return reflection matrix.

Arguments

  • const dvec4 & plane - Reflection plane.

Return value

The reflection matrix.

mat4 rotateX(float angle)

Returns matrix of rotation at the given angle around X axis:
1.0 0.0 0.0 0.0
0.0 cos -sin 0.0
0.0 sin cos 0.0
0.0 0.0 0.0 1.0

Arguments

  • float angle - Rotation angle, degrees.

Return value

Rotation matrix.

dmat4 rotateX(double angle)

Return X rotation matrix.

Arguments

  • double angle - Rotation angle (in degrees).

Return value

The resulting matrix.

mat4 rotateY(float angle)

Returns matrix of rotation at the given angle around Y axis:
cos 0.0 sin 0.0
0.0 1.0 0.0 0.0
-sin 0.0 cos 0.0
0.0 0.0 0.0 1.0

Arguments

  • float angle - Rotation angle, degrees.

Return value

Rotation matrix.

dmat4 rotateY(double angle)

Return Y rotation matrix.

Arguments

  • double angle - Rotation angle (in degrees).

Return value

The resulting matrix.

mat4 rotateZ(float angle)

Returns matrix of rotation at the given angle around Z axis:
cos -sin 0.0 0.0
sin cos 0.0 0.0
0.0 0.0 1.0 0.0
0.0 0.0 0.0 1.0

Arguments

  • float angle - Rotation angle, degrees.

Return value

Rotation matrix.

dmat4 rotateZ(double angle)

Return Z rotation matrix.

Arguments

  • double angle - Rotation angle (in degrees).

Return value

The resulting matrix.

mat4 rotate(const vec3 & axis, float angle)

Return rotation matrix.

Arguments

  • const vec3 & axis - Rotation axis.
  • float angle - Rotation angle (in degrees).

Return value

The resulting matrix.

dmat4 rotate(const dvec3 & axis, double angle)

Return rotation matrix.

Arguments

  • const dvec3 & axis - Rotation axis.
  • double angle - Rotation angle (in degrees).

Return value

The resulting matrix.

mat4 rotation(const mat4 & m)

Return rotation matrix.

Arguments

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

Return value

The resulting matrix.

mat4 scale(const vec3 & v)

Return scaling matrix.

Arguments

  • const vec3 & v - The value of the scaling vector.

Return value

The resulting matrix.

dmat4 scale(const dvec3 & v)

Return scaling matrix.

Arguments

  • const dvec3 & v - The value of the scaling vector.

Return value

The resulting matrix.

dmat4 setTo(const dvec3 & position, const dvec3 & direction, const vec3 & up)

Return placing matrix.

Arguments

  • const dvec3 & position - Position coordinates of the target point.
  • const dvec3 & direction - Direction of the vector.
  • const vec3 & up - Direction of the up vector.

Return value

The placing matrix.

mat4 setTo(const vec3 & position, const vec3 & direction, const vec3 & up)

Return placing matrix.

Arguments

  • const vec3 & position - Position coordinates of the target point.
  • const vec3 & direction - Direction of the vector.
  • const vec3 & up - Direction of the up vector.

Return value

The placing matrix.

mat4 symmetryProjection(const mat4 & projection)

Return symmetry projection matrix.

Arguments

  • const mat4 & projection - Projection matrix.

Return value

The symmetry projection matrix.

mat4 translate(const vec3 & v)

Return translation matrix.

Arguments

  • const vec3 & v - The value of the translation vector.

Return value

The resulting matrix.

dmat4 translate(const dvec3 & v)

Return translation matrix.

Arguments

  • const dvec3 & v - The value of the translation vector.

Return value

The resulting matrix.

mat4 transpose3(const mat4 & m)

Return transposed rotation matrix.

Arguments

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

Return value

The resulting matrix.

mat4 transpose(const mat4 & m)

Return transpose matrix.

Arguments

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

Return value

The resulting matrix.
Last update: 03.07.2017
Build: ()