SLProject 4.0.000
|
4x4 matrix template class More...
#include <SLMat4.h>
Public Member Functions | |
SLMat4 () | |
Sets identity matrix. More... | |
SLMat4 (const SLMat4 &A) | |
Sets mat by other SLMat4. More... | |
SLMat4 (const SLMat3f &A) | |
Sets mat by other SLMat3. More... | |
SLMat4 (const T *M) | |
Sets mat by array. More... | |
SLMat4 (T M0, T M4, T M8, T M12, T M1, T M5, T M9, T M13, T M2, T M6, T M10, T M14, T M3, T M7, T M11, T M15) | |
SLMat4 (T tx, T ty, T tz) | |
Sets translate matrix. More... | |
SLMat4 (T degAng, T axis_x, T axis_y, T axis_z) | |
Sets rotation matrix. More... | |
SLMat4 (T scale_xyz) | |
Sets scaling matrix. More... | |
SLMat4 (const SLVec3< T > &translationVec) | |
Sets translate matrix. More... | |
SLMat4 (const SLVec3< T > &fromUnitVec, const SLVec3< T > &toUnitVec) | |
Sets rotation matrix. More... | |
SLMat4 (const SLVec3< T > &translation, const SLMat3< T > &rotation, const SLVec3< T > &scale) | |
Set matrix by translation, rotation & scale. More... | |
void | setMatrix (const SLMat4 &A) |
Set matrix by other 4x4 matrix. More... | |
void | setMatrix (const SLMat3f &A) |
Set matrix by other 3x3 matrix. More... | |
void | setMatrix (const SLMat4 *A) |
Set matrix by other matrix pointer. More... | |
void | setMatrix (const T *M) |
Set matrix by float[16] array. More... | |
void | setMatrix (T M0, T M4, T M8, T M12, T M1, T M5, T M9, T M13, T M2, T M6, T M10, T M14, T M3, T M7, T M11, T M15) |
Set matrix by components. More... | |
void | setMatrix (const SLVec3< T > &translation, const SLMat3< T > &rotation, const SLVec3< T > &scale) |
Set matrix by translation, rotation & scale. More... | |
void | setMatrix (const int16_t i, const SLfloat value) |
void | setRotation (const SLMat3< T > &rotation) |
Set 3x3 submatrix describing the rotational part. More... | |
void | setTranslation (const SLVec3< T > &translation) |
Set vector as submatrix describing the translational part. More... | |
void | m (int i, T val) |
const T * | m () const |
T | m (int i) const |
SLMat3< T > | mat3 () const |
SLMat4< T > & | operator= (const SLMat4 &A) |
assignment operator More... | |
SLMat4< T > | operator* (const SLMat4 &A) const |
matrix-matrix multiplication More... | |
SLMat4< T > & | operator*= (const SLMat4 &A) |
matrix-matrix multiplication More... | |
SLMat4< T > | operator+ (const SLMat4 &A) const |
matrix-matrix addition More... | |
SLVec3< T > | operator* (const SLVec3< T > &v) const |
SLVec3 mult w. persp div. More... | |
SLVec4< T > | operator* (const SLVec4< T > &v) const |
SLVec4 mult. More... | |
SLMat4< T > | operator* (T a) const |
scalar mult More... | |
SLMat4< T > & | operator*= (T a) |
scalar mult More... | |
SLMat4< T > | operator/ (T a) const |
scalar division More... | |
SLMat4< T > & | operator/= (T a) |
scalar division More... | |
T & | operator() (int row, int col) |
const T & | operator() (int row, int col) const |
SLbool | isEqual (const SLMat4 &A, SLfloat epsilon=0.01f) |
Returns true if one element of the matrix differs more than epsilon. More... | |
void | multiply (const SLMat4 &A) |
SLVec3< T > | multVec (SLVec3< T > v) const |
SLVec4< T > | multVec (SLVec4< T > v) const |
void | add (const SLMat4 &A) |
void | translate (T tx, T ty, T tz=0) |
void | translate (const SLVec2< T > &t) |
void | translate (const SLVec3< T > &t) |
void | rotate (T degAng, T axisx, T axisy, T axisz) |
void | rotate (T degAng, const SLVec3< T > &axis) |
void | rotate (const SLVec3< T > &fromUnitVec, const SLVec3< T > &toUnitVec) |
void | scale (T sxyz) |
void | scale (T sx, T sy, T sz) |
void | scale (const SLVec3< T > &sxyz) |
void | frustum (T l, T r, T b, T t, T n, T f) |
Defines a view frustum projection matrix equivalent to glFrustum. More... | |
void | perspective (T fov, T aspect, T n, T f) |
Defines a perspective projection matrix with a field of view angle. More... | |
void | perspectiveCenteredPP (T w, T h, T fx, T fy, T cx, T cy, T n, T f) |
Defines a projection matrix for a calibrated camera, the principle point has to be centered (from intrinsics matrix) More... | |
void | ortho (T l, T r, T b, T t, T n, T f) |
Defines a orthographic projection matrix with a field of view angle. More... | |
void | viewport (T x, T y, T ww, T wh, T n=0.0f, T f=1.0f) |
Defines the viewport matrix. More... | |
void | lookAt (T EyeX, T EyeY, T EyeZ, T AtX=0, T AtY=0, T AtZ=0, T UpX=0, T UpY=0, T UpZ=0) |
Defines the a view matrix as the corresponding gluLookAt function. More... | |
void | lookAt (const SLVec3< T > &Eye, const SLVec3< T > &At=SLVec3< T >::ZERO, const SLVec3< T > &Up=SLVec3< T >::ZERO) |
Defines the a view matrix as the corresponding gluLookAt function. More... | |
void | lookAt (SLVec3< T > *eye, SLVec3< T > *at, SLVec3< T > *up, SLVec3< T > *right) const |
Reads out of the matrix the look at parameters. More... | |
void | lightAt (T PosX, T PosY, T PosZ, T AtX=0, T AtY=0, T AtZ=0, T UpX=0, T UpY=0, T UpZ=0) |
Defines the a model matrix for light positioning. More... | |
void | lightAt (const SLVec3< T > &pos, const SLVec3< T > &At=SLVec3< T >::ZERO, const SLVec3< T > &Up=SLVec3< T >::ZERO) |
Defines the a model matrix for light positioning. More... | |
void | posAtUp (T PosX, T PosY, T PosZ, T dirAtX=0, T dirAtY=0, T dirAtZ=0, T dirUpX=0, T dirUpY=0, T dirUpZ=0) |
Same as lightAt. More... | |
void | posAtUp (const SLVec3< T > &pos, const SLVec3< T > &dirAt=SLVec3< T >::ZERO, const SLVec3< T > &dirUp=SLVec3< T >::ZERO) |
Same as lightAt. More... | |
SLVec3< T > | translation () const |
SLVec3< T > | axisX () const |
SLVec3< T > | axisY () const |
SLVec3< T > | axisZ () const |
void | translation (T tx, T ty, T tz, SLbool keepLinear=true) |
Sets the translation with or without overwriting the linear submatrix. More... | |
void | translation (const SLVec3< T > &t, SLbool keepLinear=true) |
void | rotation (T degAng, const SLVec3< T > &axis, SLbool keepTranslation=true) |
Sets the rotation with or without overwriting the translation. More... | |
void | rotation (T degAng, T axisx, T axisy, T axisz, SLbool keepTranslation=true) |
void | rotation (const SLVec3< T > &fromUnitVec, const SLVec3< T > &toUnitVec) |
void | scaling (T sxyz, SLbool keepTrans=true) |
Sets the scaling with or without overwriting the translation. More... | |
void | scaling (const SLVec3< T > &sxyz, SLbool keepTrans=true) |
void | scaling (T sx, T sy, T sz, SLbool keepTranslation=true) |
void | fromEulerAnglesZXZ (double angle1RAD, double angle2RAD, double angle3RAD, bool keepTranslation=true) |
void | fromEulerAnglesXYZ (double angle1RAD, double angle2RAD, double angle3RAD, bool keepTranslation=true) |
void | toEulerAnglesZYX (T &zRotRAD, T &yRotRAD, T &xRotRAD) |
void | toEulerAnglesXYZ (T &xRotRAD, T &yRotRAD, T &zRotRAD) |
SLVec3< T > | toEulerAngles (int order) |
void | identity () |
Sets the identity matrix. More... | |
void | transpose () |
Sets the transposed matrix by swaping around the main diagonal. More... | |
SLMat4< T > | transposed () |
Returns the transposed of the matrix and leaves the itself unchanged. More... | |
void | invert () |
Inverts the matrix. More... | |
SLMat4< T > | inverted () const |
Computes the inverse of a 4x4 non-singular matrix. More... | |
SLMat3< T > | inverseTransposed () |
T | trace () const |
void | compose (SLVec3f trans, SLVec3f rotEulerRAD, SLVec3f scale) |
void | decompose (SLVec3f &trans, SLVec4f &rotQuat, SLVec3f &scale) |
void | decompose (SLVec3f &trans, SLMat3f &rotMat, SLVec3f &scale) |
void | decompose (SLVec3f &trans, SLVec3f &rotEulerRAD, SLVec3f &scale) |
void | print (const SLchar *str=nullptr) const |
SLstring | toString () const |
Static Public Member Functions | |
static void | swap (T &a, T &b) |
Private Attributes | |
T | _m [16] |
The 16 elements of the matrix. More... | |
4x4 matrix template class
Implements a 4 by 4 matrix template class. An array of 16 floats or double is used instead of a 2D array [4][4] to be compliant with OpenGL. The index layout is as follows:
| 0 4 8 12 | | 1 5 9 13 | M = | 2 6 10 14 | | 3 7 11 15 |
Vectors are interpreted as column vectors when applying matrix multiplications. This means a vector is as a single column, 4-row matrix. The result is that the transformations implemented by the matrices happens right-to-left e.g. if vector V is to be transformed by M1 then M2 then M3, the calculation would be M3 * M2 * M1 * V. The order that matrices are concatenated is vital since matrix multiplication is not commutative, i.e. you can get a different result if you concatenate in the wrong order. The use of column vectors and right-to-left ordering is the standard in most mathematical texts, and is the same as used in OpenGL. It is, however, the opposite of Direct3D, which has inexplicably chosen to differ from the accepted standard and uses row vectors and left-to-right matrix multiplication.
SLMat4< T >::SLMat4 | ( | T | M0, |
T | M4, | ||
T | M8, | ||
T | M12, | ||
T | M1, | ||
T | M5, | ||
T | M9, | ||
T | M13, | ||
T | M2, | ||
T | M6, | ||
T | M10, | ||
T | M14, | ||
T | M3, | ||
T | M7, | ||
T | M11, | ||
T | M15 | ||
) |
Sets rotation matrix.
Sets translate matrix.
SLMat4< T >::SLMat4 | ( | const SLVec3< T > & | fromUnitVec, |
const SLVec3< T > & | toUnitVec | ||
) |
Sets rotation matrix.
SLMat4< T >::SLMat4 | ( | const SLVec3< T > & | translation, |
const SLMat3< T > & | rotation, | ||
const SLVec3< T > & | scale | ||
) |
Set matrix by translation, rotation & scale.
Adds the matrix to an other matrix A.
Composes the matrix from a translation vector, a rotation Euler angle vector and the scaling factors.
void SLMat4< T >::decompose | ( | SLVec3f & | trans, |
SLMat3f & | rotMat, | ||
SLVec3f & | scale | ||
) |
Decomposes the matrix into a translation vector, a 3x3 rotation matrix and the scaling factors using polar decomposition introduced by Ken Shoemake. See the paper in lib-SLExternal/Shoemake/polar-decomp.pdf
void SLMat4< T >::decompose | ( | SLVec3f & | trans, |
SLVec3f & | rotEulerRAD, | ||
SLVec3f & | scale | ||
) |
Decomposes the matrix into a translation vector, a rotation Euler angle vector and the scaling factors using polar decomposition introduced by Ken Shoemake. See the paper in lib-SLExternal/Shoemake/polar-decomp.pdf
void SLMat4< T >::decompose | ( | SLVec3f & | trans, |
SLVec4f & | rotQuat, | ||
SLVec3f & | scale | ||
) |
Decomposes the matrix into a translation vector, a rotation quaternion and the scaling factors using polar decomposition introduced by Ken Shoemake. See the paper in lib-SLExternal/Shoemake/polar-decomp.pdf
void SLMat4< T >::fromEulerAnglesXYZ | ( | double | angle1RAD, |
double | angle2RAD, | ||
double | angle3RAD, | ||
bool | keepTranslation = true |
||
) |
Sets the linear 3x3 submatrix as a rotation matrix from the 3 euler angles in radians around the z-axis, y-axis & x-axis. By default the translation components are set to 0. See: http://en.wikipedia.org/wiki/Euler_angles
void SLMat4< T >::fromEulerAnglesZXZ | ( | double | angle1RAD, |
double | angle2RAD, | ||
double | angle3RAD, | ||
bool | keepTranslation = true |
||
) |
Sets the linear 3x3 submatrix as a rotation matrix from the 3 euler angles in radians around the z-axis, x-axis & z-axis. By default the translation components are set to 0. See: http://en.wikipedia.org/wiki/Euler_angles
void SLMat4< T >::frustum | ( | T | l, |
T | r, | ||
T | b, | ||
T | t, | ||
T | n, | ||
T | f | ||
) |
Defines a view frustum projection matrix equivalent to glFrustum.
Defines a view frustum projection matrix equivalent to OpenGL's glFrustum.
The view frustum is the truncated view pyramid of a central projection that is defined with the folowing parameters:
l | Distance from the center of projection (COP) to the left border on the near clipping plane. |
r | Distance from the COP to the right border on the near clipping plane. |
b | Distance from the COP to the bottom border on the near clipping plane. |
t | Distance from the COP to the top border on the near clipping plane. |
n | Distance from the eye to near clipping plane of the view frustum. |
f | Distance from the eye to far clipping plane of the view frustum. |
void SLMat4< T >::identity |
Sets the identity matrix.
Computes the inverse transposed matrix of the upper left 3x3 matrix for the transformation of vertex normals.
void SLMat4< T >::invert |
Inverts the matrix.
Computes the inverse of a 4x4 non-singular matrix.
Returns true if one element of the matrix differs more than epsilon.
void SLMat4< T >::lightAt | ( | const SLVec3< T > & | pos, |
const SLVec3< T > & | At = SLVec3<T>::ZERO , |
||
const SLVec3< T > & | Up = SLVec3<T>::ZERO |
||
) |
Defines the a model matrix for light positioning.
Defines the a model matrix for positioning a light source.
Utility method for defining the transformation matrix for a spot light. There is no equivalent function for this purpose in OpenGL. /param pos Vector to the position of the light source. /param At Vector to a target point where a spot light shines to.
void SLMat4< T >::lightAt | ( | T | PosX, |
T | PosY, | ||
T | PosZ, | ||
T | AtX = 0 , |
||
T | AtY = 0 , |
||
T | AtZ = 0 , |
||
T | UpX = 0 , |
||
T | UpY = 0 , |
||
T | UpZ = 0 |
||
) |
Defines the a model matrix for light positioning.
Defines the a model matrix for positioning a light at pos and shining at At
void SLMat4< T >::lookAt | ( | const SLVec3< T > & | Eye, |
const SLVec3< T > & | At = SLVec3<T>::ZERO , |
||
const SLVec3< T > & | Up = SLVec3<T>::ZERO |
||
) |
Defines the a view matrix as the corresponding gluLookAt function.
Defines the view matrix with an eye position, a look at point and an up vector.
This method is equivalent to the OpenGL function gluLookAt.
Eye | Vector to the position of the eye (view point). |
At | Vector to the target point. |
Up | Vector that points from the viewpoint upwards. If Up is a zero vector a default up vector is calculated with a default look-right vector (VZ) that lies in the x-z plane. |
void SLMat4< T >::lookAt | ( | SLVec3< T > * | eye, |
SLVec3< T > * | at, | ||
SLVec3< T > * | up, | ||
SLVec3< T > * | ri | ||
) | const |
Reads out of the matrix the look at parameters.
This method retrieves the eye position the look at, up & right vector out of the view matrix. Attention: The look-at is normalized vector, not a point.
void SLMat4< T >::lookAt | ( | T | EyeX, |
T | EyeY, | ||
T | EyeZ, | ||
T | AtX = 0 , |
||
T | AtY = 0 , |
||
T | AtZ = 0 , |
||
T | UpX = 0 , |
||
T | UpY = 0 , |
||
T | UpZ = 0 |
||
) |
Defines the a view matrix as the corresponding gluLookAt function.
Defines the view matrix with an eye position, a look at point and an up vector.
This method is equivalent to the OpenGL function gluLookAt.
|
inline |
|
inline |
|
inline |
Multiplies the matrix with a another matrix. Corresponds to the OpenGL function glMultMatrix*.
Matrix - 3D vector multiplication with perspective division
Matrix - 4D vector multiplication
|
inline |
|
inline |
matrix-matrix multiplication
Matrix - matrix multiplication
SLVec3 mult w. persp div.
Matrix - 3D vector multiplication with perspective division
SLVec4 mult.
Matrix - 4D vector multiplication
scalar mult
Scalar multiplication.
matrix-matrix multiplication
matrix-matrix addition
assignment operator
Matrix assignment with instance
void SLMat4< T >::ortho | ( | T | l, |
T | r, | ||
T | b, | ||
T | t, | ||
T | n, | ||
T | f | ||
) |
Defines a orthographic projection matrix with a field of view angle.
Defines a ortographic projection matrix equivalent to OpenGL's glOrtho.
l | Distance from the center of projection (COP) to the left border on the near clipping plane. |
r | Distance from the COP to the right border on the near clipping plane. |
b | Distance from the COP to the bottom border on the near clipping plane. |
t | Distance from the COP to the top border on the near clipping plane. |
n | Distance from the eye to near clipping plane of the view frustum. |
f | Distance from the eye to far clipping plane of the view frustum. |
void SLMat4< T >::perspective | ( | T | fov, |
T | aspect, | ||
T | n, | ||
T | f | ||
) |
Defines a perspective projection matrix with a field of view angle.
Defines a view frustum projection matrix for a perspective projection.
This method is equivalent to the OpenGL function gluPerspective except that instead of the window aspect the window width and height have to be passed.
fov | Vertical field of view angle (zoom angle) |
aspect | aspect ratio of of the viewport = width / height |
n | Distance from the eye to near clipping plane of the view frustum. |
f | Distance from the eye to far clipping plane of the view frustum. |
void SLMat4< T >::perspectiveCenteredPP | ( | T | w, |
T | h, | ||
T | fx, | ||
T | fy, | ||
T | cx, | ||
T | cy, | ||
T | n, | ||
T | f | ||
) |
Defines a projection matrix for a calibrated camera, the principle point has to be centered (from intrinsics matrix)
Defines a projection matrix for a calibrated camera (from intrinsics matrix) Attention: The principle point has to be centered
This should give an exact result. http://kgeorge.github.io/2014/03/08/calculating-opengl-perspective-matrix-from-opencv-intrinsic-matrix (see also https://stackoverflow.com/questions/22064084/how-to-create-perspective-projection-matrix-given-focal-points-and-camera-princ but the other solutions did not work as well)
void SLMat4< T >::posAtUp | ( | const SLVec3< T > & | pos, |
const SLVec3< T > & | dirAt = SLVec3<T>::ZERO , |
||
const SLVec3< T > & | dirUp = SLVec3<T>::ZERO |
||
) |
Same as lightAt.
void SLMat4< T >::posAtUp | ( | T | PosX, |
T | PosY, | ||
T | PosZ, | ||
T | dirAtX = 0 , |
||
T | dirAtY = 0 , |
||
T | dirAtZ = 0 , |
||
T | dirUpX = 0 , |
||
T | dirUpY = 0 , |
||
T | dirUpZ = 0 |
||
) |
Same as lightAt.
Prints out the matrix row by row.
void SLMat4< T >::rotate | ( | const SLVec3< T > & | fromUnitVec, |
const SLVec3< T > & | toUnitVec | ||
) |
Multiplies the matrix with a rotation matrix created with a rotation between two vectors.
Multiplies the matrix with a rotation matrix. Corresponds to the OpenGL function glRotate*.
void SLMat4< T >::rotate | ( | T | degAng, |
T | axisx, | ||
T | axisy, | ||
T | axisz | ||
) |
Multiplies the matrix with a rotation matrix. Corresponds to the OpenGL function glRotate*.
Defines a rotation matrix that rotates the vector from to the vector to. Code and explanation comes from the paper "Efficiently build a matrix to ratate one vector to another" from Thomas Mueller and John Hughes in the Journal of Graphic Tools, volume 4.
void SLMat4< T >::rotation | ( | T | degAng, |
const SLVec3< T > & | axis, | ||
SLbool | keepTranslation = true |
||
) |
Sets the rotation with or without overwriting the translation.
Sets the linear 3x3 submatrix as a rotation matrix with a rotation of degAng degrees around an axis. By default the translation components are set to 0.
void SLMat4< T >::rotation | ( | T | degAng, |
T | axisx, | ||
T | axisy, | ||
T | axisz, | ||
SLbool | keepTranslation = true |
||
) |
Sets the linear 3x3 submatrix as a rotation matrix with a rotation of degAng degrees around an axis. By default the translation components are set to 0.
Multiplies the matrix with a scaling matrix. Corresponds to the OpenGL function glScale*.
void SLMat4< T >::scale | ( | T | sx, |
T | sy, | ||
T | sz | ||
) |
Multiplies the matrix with a scaling matrix. Corresponds to the OpenGL function glScale*.
void SLMat4< T >::scale | ( | T | sxyz | ) |
Multiplies the matrix with a scaling matrix. Corresponds to the OpenGL function glScale*.
Sets the linear 3x3 submatrix as a scaling matrix with the scaling vector s. By default the translation components are set to 0.
Sets the linear 3x3 submatrix as a scaling matrix with the scaling f_actors sx, sy and sz. By default the translation components are set to 0.
Sets the scaling with or without overwriting the translation.
Sets the linear 3x3 submatrix as a scaling matrix with the scaling vector s. By default the translation components are set to 0.
Set matrix by other 4x4 matrix.
Set matrix by other matrix pointer.
void SLMat4< T >::setMatrix | ( | const SLVec3< T > & | translation, |
const SLMat3< T > & | rotation, | ||
const SLVec3< T > & | scale | ||
) |
Set matrix by translation, rotation & scale.
void SLMat4< T >::setMatrix | ( | const T * | M | ) |
Set matrix by float[16] array.
void SLMat4< T >::setMatrix | ( | T | M0, |
T | M4, | ||
T | M8, | ||
T | M12, | ||
T | M1, | ||
T | M5, | ||
T | M9, | ||
T | M13, | ||
T | M2, | ||
T | M6, | ||
T | M10, | ||
T | M14, | ||
T | M3, | ||
T | M7, | ||
T | M11, | ||
T | M15 | ||
) |
Set matrix by components.
Set 3x3 submatrix describing the rotational part.
rotation | Set 3x3 submatrix describing the rotational part |
Set vector as submatrix describing the translational part.
translation | Set vector as submatrix describing the translational part |
|
inlinestatic |
void SLMat4< T >::toEulerAnglesXYZ | ( | T & | xRotRAD, |
T & | yRotRAD, | ||
T & | zRotRAD | ||
) |
Gets one set of possible x-y-z euler angles that will generate this matrix Assumes that upper 3x3 is a rotation matrix Source: Essential Mathematics for Games and Interactive Applications A Programmer's Guide 2nd edition by James M. Van Verth and Lars M. Bishop
void SLMat4< T >::toEulerAnglesZYX | ( | T & | zRotRAD, |
T & | yRotRAD, | ||
T & | xRotRAD | ||
) |
Gets one set of possible z-y-x euler angles that will generate this matrix Assumes that upper 3x3 is a rotation matrix Source: Essential Mathematics for Games and Interactive Applications A Programmer's Guide 2nd edition by James M. Van Verth and Lars M. Bishop
|
inline |
Returns the trace of the matrix that is the sum of the diagonal components.
Multiplies the matrix with a translation matrix. Corresponds to the OpenGL function glTranslate*.
Multiplies the matrix with a translation matrix. Corresponds to the OpenGL function glTranslate*.
void SLMat4< T >::translate | ( | T | tx, |
T | ty, | ||
T | tz = 0 |
||
) |
Multiplies the matrix with a translation matrix. Corresponds to the OpenGL function glTranslate*.
void SLMat4< T >::translation | ( | const SLVec3< T > & | t, |
SLbool | keepLinear = true |
||
) |
Sets the translation components. By default the linear 3x3 submatrix containing rotations and scaling is reset to identity.
Sets the translation with or without overwriting the linear submatrix.
Sets the translation components. By default the linear 3x3 submatrix containing rotations and scaling is reset to identity.
void SLMat4< T >::transpose |
Sets the transposed matrix by swaping around the main diagonal.
Returns the transposed of the matrix and leaves the itself unchanged.
void SLMat4< T >::viewport | ( | T | x, |
T | y, | ||
T | ww, | ||
T | wh, | ||
T | n = 0.0f , |
||
T | f = 1.0f |
||
) |
Defines the viewport matrix.
Defines a viewport matrix as it will be produced by glViewport.
x | left window coord. in px. |
y | top window coord. in px. |
ww | window width in px. |
wh | window height in px. |
n | near depth range (default 0) |
f | far depth range (default 1) |
|
private |
The 16 elements of the matrix.