Aether3D Game Engine
Public Member Functions | Static Public Member Functions | Public Attributes | Static Public Attributes | List of all members
Matrix44 Struct Reference

Row-major 4x4 Matrix. More...

#include <Matrix.hpp>

Public Member Functions

 Matrix44 ()
 Constructor. Inits to identity.
 
 Matrix44 (float xDeg, float yDeg, float zDeg)
 Constructor that makes an XYZ rotation matrix.
 
 Matrix44 (const Matrix44 &other)
 
 Matrix44 (const float *data)
 
Matrix44operator= (const Matrix44 &other)
 
void Scale (float x, float y, float z)
 
void InitFrom (const float *data)
 
void MakeIdentity ()
 Resets this matrix.
 
void MakeLookAt (const Vec3 &eye, const Vec3 &center, const Vec3 &up)
 
void MakeProjection (float fovDegrees, float aspect, float nearDepth, float farDepth)
 
void MakeProjection (float left, float right, float bottom, float top, float nearDepth, float farDepth)
 
void MakeRotationXYZ (float xDeg, float yDeg, float zDeg)
 
void Print () const
 Prints the matrix to the console.
 
void Transpose (Matrix44 &out) const
 
void Translate (const Vec3 &v)
 

Static Public Member Functions

static void Invert (const Matrix44 &matrix, Matrix44 &out)
 Inverts a matrix. More...
 
static void InverseTranspose (const float m[16], float *out)
 Inverse transpose. More...
 
static void Multiply (const Matrix44 &a, const Matrix44 &b, Matrix44 &out)
 
static void TransformPoint (const Vec4 &vec, const Matrix44 &mat, Vec4 *out)
 
static void TransformPoint (const Vec3 &vec, const Matrix44 &mat, Vec3 *out)
 
static void TransformDirection (const Vec3 &dir, const Matrix44 &mat, Vec3 *out)
 

Public Attributes

float m [16]
 Member data, row-major.
 

Static Public Attributes

static const Matrix44 identity
 Identity matrix.
 
static const Matrix44 bias
 Converts depth coordinates from [-1,1] to [0,1]. This is needed to sample the shadow map texture.
 

Detailed Description

Row-major 4x4 Matrix.

Constructor & Destructor Documentation

Matrix44::Matrix44 ( const Matrix44 other)

Copy constructor.

Parameters
otherOther matrix.
Matrix44::Matrix44 ( const float *  data)
Parameters
dataColumn-major initialization data.

Member Function Documentation

void Matrix44::InitFrom ( const float *  data)
Parameters
data4x4 column-major matrix data.
void Matrix44::InverseTranspose ( const float  m[16],
float *  out 
)
static

Inverse transpose.

Parameters
mMatrix data.
outInverse transpose of m.
See also
Transpose.
void Matrix44::Invert ( const Matrix44 matrix,
Matrix44 out 
)
static

Inverts a matrix.

Parameters
matrix4x4 matrix.
outInverted matrix.
void Matrix44::MakeLookAt ( const Vec3 eye,
const Vec3 center,
const Vec3 up 
)

Makes a lookat matrix.

Parameters
eyeEye (camera) position.
centerTarget position.
upWorld up vector.
void Matrix44::MakeProjection ( float  fovDegrees,
float  aspect,
float  nearDepth,
float  farDepth 
)

Sets perspective projection (right-handed). Calculated as in gluPerspective (http://www.opengl.org/wiki/GluPerspective_code)

Parameters
fovDegreesField-of-View in degrees.
aspectAspect ratio.
nearDepthNear plane distance.
farDepthFar plane distance.
void Matrix44::MakeProjection ( float  left,
float  right,
float  bottom,
float  top,
float  nearDepth,
float  farDepth 
)

Sets orthographic projection.

Parameters
leftLeft.
rightRight.
bottomBottom.
topTop.
nearDepthNear plane distance.
farDepthFar plane distance.
void Matrix44::MakeRotationXYZ ( float  xDeg,
float  yDeg,
float  zDeg 
)

Makes a rotation around axes.

Parameters
xDegX-axis degrees.
yDegY-axis degrees.
zDegZ-axis degrees.
void Matrix44::Multiply ( const Matrix44 a,
const Matrix44 b,
Matrix44 out 
)
static
Parameters
aFirst Matrix.
bSecond Matrix.
outa * b.
Matrix44& Matrix44::operator= ( const Matrix44 other)
inline
Parameters
otherMatrix from which this matrix is initialized.
Returns
this.
void Matrix44::Scale ( float  x,
float  y,
float  z 
)
Parameters
xX
yY
zZ
void Matrix44::TransformDirection ( const Vec3 dir,
const Matrix44 mat,
Vec3 out 
)
static

Multiplies a matrix with a vector. Vector's missing w is treated as 0.

Parameters
dirDirection vector.
matMatrix.
outdir * mat.
void Matrix44::TransformPoint ( const Vec4 vec,
const Matrix44 mat,
Vec4 out 
)
static

Multiplies a matrix with a vector.

Parameters
vecVector.
matMatrix.
outvec * mat.
void Matrix44::TransformPoint ( const Vec3 vec,
const Matrix44 mat,
Vec3 out 
)
static

Multiplies a matrix with a vector. Vector's missing w is treated as 1.

Parameters
vecVector.
matMatrix.
outvec * mat.
void Matrix44::Translate ( const Vec3 v)
Parameters
vTranslation.
void Matrix44::Transpose ( Matrix44 out) const
Parameters
outResult of transpose.

The documentation for this struct was generated from the following files: