Home | Namespaces | Hierarchy | Alphabetical List | Class list | Files | Namespace Members | Class members | File members |
#include <Matrix4.h>
Public Member Functions | |
void | buildProjectionMatrixInfinitePerspectiveFov (f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear) |
Builds a right-handed infinite perspective projection matrix based on a field of view. | |
void | buildProjectionMatrixOrtho (f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar) |
Builds a right-handed orthogonal projection matrix. | |
void | buildProjectionMatrixOrtho (f32 left, f32 right, f32 bottom, f32 top, f32 zNear, f32 zFar) |
Builds a right-handed orthogonal projection matrix with left/right and bottom/top instead of only width and height. | |
void | buildProjectionMatrixPerspective (f32 widthOfViewVolume, f32 heightOfViewVolume, f32 zNear, f32 zFar) |
Builds a right-handed perspective projection matrix. | |
void | buildProjectionMatrixPerspectiveFov (f32 fieldOfViewRadians, f32 aspectRatio, f32 zNear, f32 zFar) |
Builds a right-handed perspective projection matrix based on a field of view. | |
void | buildShadowMatrix (vector3d light, plane3d plane, f32 point=1.0f) |
void | buildViewMatrix (const vector3d &position, const vector3d &target, const vector3d &upVector) |
Builds a right-handed look-at matrix. | |
f32 * | get () |
const f32 * | get () const |
matrix4 | getInverse () const |
Returns the inversed matrix is exists else it returns the current matrix. | |
vector3d | getRotationDegrees () const |
Returns the rotation, as set by setRotation(). This code was originally written by Chev. | |
vector3d | getScale () const |
Get Scale. | |
vector3d | getTranslation () const |
Gets the current translation. | |
matrix4 | getTransposed () const |
Returns transposed matrix. | |
bool | hasInverse () |
Returns if the matrix has an inverse. | |
void | inverseRotateVect (vector3d &vect) const |
Rotate a vector by the inverse of the rotation part of this matrix. | |
void | inverseTranslateVector (vector3d &vect) const |
Translate a vector by the inverse of the translation part of this matrix. | |
bool | isIdentity () |
Returns true if the matrix is the identity matrix. | |
void | makeIdentity () |
Set matrix to identity. | |
matrix4 (f32 m00, f32 m01, f32 m02, f32 m03, f32 m10, f32 m11, f32 m12, f32 m13, f32 m20, f32 m21, f32 m22, f32 m23, f32 m30, f32 m31, f32 m32, f32 m33) | |
matrix4 () | |
bool | operator!= (const matrix4 &other) const |
Returns true if other matrix is not equal to this matrix. | |
f32 & | operator() (s32 row, s32 col) |
Simple operator for directly accessing every element of the matrix. | |
const f32 & | operator() (s32 row, s32 col) const |
Simple operator for directly accessing every element of the matrix. | |
matrix4 | operator* (const matrix4 &other) const |
Multiply by another matrix. | |
matrix4 & | operator*= (const matrix4 &other) |
Multiply by another matrix. | |
matrix4 | operator+ (const matrix4 &other) const |
Add by another matrix. | |
matrix4 & | operator+= (const matrix4 &other) |
Add by another matrix. | |
matrix4 | operator- () const |
matrix4 | operator- (const matrix4 &other) const |
Subtract by another matrix. | |
matrix4 & | operator-= (const matrix4 &other) |
Subtract by another matrix. | |
matrix4 & | operator= (const matrix4 &other) |
Sets this matrix equal to the other matrix. | |
bool | operator== (const matrix4 &other) const |
Returns true if other matrix is equal to this matrix. | |
f32 & | operator[] (u32 index) |
Simple operator for linearly accessing every element of the matrix. | |
const f32 & | operator[] (u32 index) const |
Simple operator for linearly accessing every element of the matrix. | |
void | rotateVector (vector3d &vect) const |
Rotate a vector by the rotation part of this matrix. | |
void | set (f32 m00, f32 m01, f32 m02, f32 m03, f32 m10, f32 m11, f32 m12, f32 m13, f32 m20, f32 m21, f32 m22, f32 m23, f32 m30, f32 m31, f32 m32, f32 m33) |
void | set (const matrix4 &other) |
void | setInverseRotationDegrees (const vector3d &rotation) |
Make an inverted rotation matrix from Euler angles. The 4th row and column are unmodified. | |
void | setInverseRotationRadians (const vector3d &rotation) |
Make an inverted rotation matrix from Euler angles. The 4th row and column are unmodified. | |
void | setInverseTranslation (const vector3d &translation) |
Set the inverse translation of the current matrix. Will erase any previous values. | |
void | setRotationDegrees (const vector3d &rotation) |
Make a rotation matrix from Euler angles. The 4th row and column are unmodified. | |
void | setRotationRadians (const vector3d &rotation) |
Make a rotation matrix from Euler angles. The 4th row and column are unmodified. | |
void | setScale (const vector3d &scale) |
Set Scale. | |
void | setTranslation (const vector3d &translation) |
Set the translation of the current matrix. Will erase any previous values. | |
void | transformBox (aabox3d &box) const |
Transforms a axis aligned bounding box. | |
void | transformPlane (const plane3d &in, plane3d &out) const |
Transforms a plane by this matrix. | |
void | transformPlane (plane3d &plane) const |
Transforms a plane by this matrix. | |
void | transformVector (const vector4d &in, vector4d &out) const |
Transforms input vector by this matrix and stores result in output vector. | |
void | transformVector (const vector3d &in, vector3d &out) const |
Transforms input vector by this matrix and stores result in output vector. | |
void | transformVector (vector4d &vect) const |
Transforms the vector by this matrix. | |
void | transformVector (vector3d &vect) const |
Transforms the vector by this matrix. | |
void | translateVector (vector3d &vect) const |
Translate a vector by the translation part of this matrix. | |
Static Public Attributes | |
static const matrix4 | IDENTITY |
static const matrix4 | ZERO |
Private Attributes | |
f32 | M [16] |
Matrix data, stored in row-major order. | |
Static Private Attributes | |
static float | empty = 0 |
4x4 matrix. Mostly used as transformation matrix for 3d calculations. Matrix4 is mainly used by the K_Game engine for doing transformations. The matrix is a OpenGL style matrix, row major with translations in the 4th row. The generic form M * V which shows the layout of the matrix entries is shown below: [ m[ 0] m[ 1] m[ 2] m[ 3] ] {x} | m[ 4] m[ 5] m[ 6] m[ 7] | * {y} | m[ 8] m[ 9] m[10] m[11] | {z} [ m[12] m[13] m[14] m[15] ] {1}
core::matrix4::matrix4 | ( | ) | [inline] |
References makeIdentity().
core::matrix4::matrix4 | ( | f32 | m00, |
f32 | m01, | ||
f32 | m02, | ||
f32 | m03, | ||
f32 | m10, | ||
f32 | m11, | ||
f32 | m12, | ||
f32 | m13, | ||
f32 | m20, | ||
f32 | m21, | ||
f32 | m22, | ||
f32 | m23, | ||
f32 | m30, | ||
f32 | m31, | ||
f32 | m32, | ||
f32 | m33 | ||
) | [inline] |
References M.
void core::matrix4::buildProjectionMatrixInfinitePerspectiveFov | ( | f32 | fieldOfViewRadians, |
f32 | aspectRatio, | ||
f32 | zNear | ||
) | [inline] |
Builds a right-handed infinite perspective projection matrix based on a field of view.
References M, and core::tan().
Referenced by render::Camera::updateProjection().
void core::matrix4::buildProjectionMatrixOrtho | ( | f32 | widthOfViewVolume, |
f32 | heightOfViewVolume, | ||
f32 | zNear, | ||
f32 | zFar | ||
) | [inline] |
Builds a right-handed orthogonal projection matrix.
References M.
Referenced by render::RenderManager::renderSingleOverlay(), render::RenderManager::renderVisibleOverlays(), and render::Camera::updateProjection().
void core::matrix4::buildProjectionMatrixOrtho | ( | f32 | left, |
f32 | right, | ||
f32 | bottom, | ||
f32 | top, | ||
f32 | zNear, | ||
f32 | zFar | ||
) | [inline] |
Builds a right-handed orthogonal projection matrix with left/right and bottom/top instead of only width and height.
References M.
void core::matrix4::buildProjectionMatrixPerspective | ( | f32 | widthOfViewVolume, |
f32 | heightOfViewVolume, | ||
f32 | zNear, | ||
f32 | zFar | ||
) | [inline] |
Builds a right-handed perspective projection matrix.
References M.
void core::matrix4::buildProjectionMatrixPerspectiveFov | ( | f32 | fieldOfViewRadians, |
f32 | aspectRatio, | ||
f32 | zNear, | ||
f32 | zFar | ||
) | [inline] |
Builds a right-handed perspective projection matrix based on a field of view.
References M, and core::tan().
Referenced by render::Camera::updateProjection().
Builds a matrix that flattens geometry into a plane.
light,: | light source |
plane,: | plane into which the geometry if flattened into |
point,: | value between 0 and 1, describing the light source. If this is 1, it is a point light, if it is 0, it is a directional light. |
References core::plane3d::D, core::vector3d::dotProduct(), core::plane3d::Normal, core::vector3d::normalize(), core::vector3d::X, core::vector3d::Y, and core::vector3d::Z.
void core::matrix4::buildViewMatrix | ( | const vector3d & | position, |
const vector3d & | target, | ||
const vector3d & | upVector | ||
) | [inline] |
Builds a right-handed look-at matrix.
References core::vector3d::crossProduct(), core::vector3d::dotProduct(), M, core::vector3d::normalize(), core::vector3d::X, core::vector3d::Y, and core::vector3d::Z.
Referenced by render::Camera::updateView().
f32 * core::matrix4::get | ( | ) |
References M.
Referenced by render::Shader::setParamerter().
matrix4 core::matrix4::getInverse | ( | ) | const [inline] |
Returns the inversed matrix is exists else it returns the current matrix.
Calculates the inverse of this Matrix The inverse is calculated using Cramers rule. If no inverse exists then 'false' is returned.
Referenced by render::ShaderParamData::getCurrentLightPositionObjectSpace(), render::ShaderParamData::getInverseProjectionMatrix(), render::ShaderParamData::getInverseViewMatrix(), render::ShaderParamData::getInverseViewProjectionMatrix(), render::ShaderParamData::getInverseWorldMatrix(), render::ShaderParamData::getInverseWorldViewMatrix(), and render::ShaderParamData::getInverseWorldViewProjMatrix().
vector3d core::matrix4::getRotationDegrees | ( | ) | const [inline] |
Returns the rotation, as set by setRotation(). This code was originally written by Chev.
References core::abs(), core::asin(), core::atan2(), core::cos(), and core::RADTODEG.
vector3d core::matrix4::getScale | ( | ) | const [inline] |
Get Scale.
References core::vector3d::getLength(), M, core::vector3d::X, core::vector3d::Y, and core::vector3d::Z.
Referenced by setInverseRotationRadians(), and setRotationRadians().
vector3d core::matrix4::getTranslation | ( | ) | const [inline] |
Gets the current translation.
References M.
Referenced by render::RenderManager::renderSingleOverlay(), and render::RenderManager::renderVisibleOverlays().
matrix4 core::matrix4::getTransposed | ( | ) | const [inline] |
Returns transposed matrix.
References M.
Referenced by render::ShaderParamData::getInverseTransposedProjectionMatrix(), render::ShaderParamData::getInverseTransposedViewMatrix(), render::ShaderParamData::getInverseTransposedViewProjectionMatrix(), render::ShaderParamData::getInverseTransposedWorldMatrix(), render::ShaderParamData::getInverseTransposedWorldViewMatrix(), render::ShaderParamData::getInverseTransposedWorldViewProjMatrix(), render::ShaderParamData::getTransposedProjectionMatrix(), render::ShaderParamData::getTransposedViewMatrix(), render::ShaderParamData::getTransposedViewProjectionMatrix(), render::ShaderParamData::getTransposedWorldMatrix(), render::ShaderParamData::getTransposedWorldViewMatrix(), and render::ShaderParamData::getTransposedWorldViewProjMatrix().
bool core::matrix4::hasInverse | ( | ) | [inline] |
Returns if the matrix has an inverse.
void core::matrix4::inverseRotateVect | ( | vector3d & | vect | ) | const [inline] |
Rotate a vector by the inverse of the rotation part of this matrix.
References M, core::vector3d::X, core::vector3d::Y, and core::vector3d::Z.
void core::matrix4::inverseTranslateVector | ( | vector3d & | vect | ) | const [inline] |
Translate a vector by the inverse of the translation part of this matrix.
References M, core::vector3d::X, core::vector3d::Y, and core::vector3d::Z.
bool core::matrix4::isIdentity | ( | ) | [inline] |
Returns true if the matrix is the identity matrix.
void core::matrix4::makeIdentity | ( | ) | [inline] |
bool core::matrix4::operator!= | ( | const matrix4 & | other | ) | const [inline] |
Returns true if other matrix is not equal to this matrix.
References M.
Multiply by another matrix.
References M.
Multiply by another matrix.
References M.
Add by another matrix.
References M.
Add by another matrix.
References M.
Subtract by another matrix.
References M.
Subtract by another matrix.
References M.
Sets this matrix equal to the other matrix.
References M.
bool core::matrix4::operator== | ( | const matrix4 & | other | ) | const [inline] |
Returns true if other matrix is equal to this matrix.
References M.
void core::matrix4::rotateVector | ( | vector3d & | vect | ) | const [inline] |
Rotate a vector by the rotation part of this matrix.
References M, core::vector3d::X, core::vector3d::Y, and core::vector3d::Z.
void core::matrix4::set | ( | f32 | m00, |
f32 | m01, | ||
f32 | m02, | ||
f32 | m03, | ||
f32 | m10, | ||
f32 | m11, | ||
f32 | m12, | ||
f32 | m13, | ||
f32 | m20, | ||
f32 | m21, | ||
f32 | m22, | ||
f32 | m23, | ||
f32 | m30, | ||
f32 | m31, | ||
f32 | m32, | ||
f32 | m33 | ||
) |
References M.
void core::matrix4::setInverseRotationDegrees | ( | const vector3d & | rotation | ) | [inline] |
Make an inverted rotation matrix from Euler angles. The 4th row and column are unmodified.
References core::DEGTORAD, and setInverseRotationRadians().
void core::matrix4::setInverseRotationRadians | ( | const vector3d & | rotation | ) | [inline] |
Make an inverted rotation matrix from Euler angles. The 4th row and column are unmodified.
References core::cos(), getScale(), M, setScale(), core::sin(), core::vector3d::X, core::vector3d::Y, and core::vector3d::Z.
Referenced by setInverseRotationDegrees().
void core::matrix4::setInverseTranslation | ( | const vector3d & | translation | ) | [inline] |
Set the inverse translation of the current matrix. Will erase any previous values.
References M, core::vector3d::X, core::vector3d::Y, and core::vector3d::Z.
void core::matrix4::setRotationDegrees | ( | const vector3d & | rotation | ) | [inline] |
Make a rotation matrix from Euler angles. The 4th row and column are unmodified.
References core::DEGTORAD, and setRotationRadians().
void core::matrix4::setRotationRadians | ( | const vector3d & | rotation | ) | [inline] |
Make a rotation matrix from Euler angles. The 4th row and column are unmodified.
References core::cos(), getScale(), M, setScale(), core::sin(), core::vector3d::X, core::vector3d::Y, and core::vector3d::Z.
Referenced by setRotationDegrees().
void core::matrix4::setScale | ( | const vector3d & | scale | ) | [inline] |
Set Scale.
References M, core::vector3d::X, core::vector3d::Y, and core::vector3d::Z.
Referenced by setInverseRotationRadians(), setRotationRadians(), render::Model::updateImpl(), render::Overlay::updateWorldTransform(), and render::Model::updateWorldTransform().
void core::matrix4::setTranslation | ( | const vector3d & | translation | ) | [inline] |
Set the translation of the current matrix. Will erase any previous values.
References M, core::vector3d::X, core::vector3d::Y, and core::vector3d::Z.
Referenced by render::RenderManager::renderSingleOverlay(), render::RenderManager::renderVisibleOverlays(), render::Model::updateImpl(), render::Overlay::updateWorldTransform(), and render::Model::updateWorldTransform().
void core::matrix4::transformBox | ( | aabox3d & | box | ) | const [inline] |
Transforms a axis aligned bounding box.
References core::aabox3d::addInternalPoint(), core::aabox3d::getEdges(), core::aabox3d::reset(), and transformVector().
Referenced by render::Model::updateImpl().
void core::matrix4::transformPlane | ( | plane3d & | plane | ) | const [inline] |
Transforms a plane by this matrix.
References core::plane3d::D, core::vector3d::dotProduct(), core::plane3d::getMemberPoint(), core::plane3d::Normal, and transformVector().
Referenced by render::Frustum::transform(), and transformPlane().
Transforms a plane by this matrix.
References transformPlane().
Transforms input vector by this matrix and stores result in output vector.
References M, core::vector4d::W, core::vector4d::X, core::vector4d::Y, and core::vector4d::Z.
void core::matrix4::transformVector | ( | vector4d & | vect | ) | const [inline] |
Transforms the vector by this matrix.
References M, core::vector4d::W, core::vector4d::X, core::vector4d::Y, and core::vector4d::Z.
void core::matrix4::transformVector | ( | vector3d & | vect | ) | const [inline] |
Transforms the vector by this matrix.
References M, core::vector3d::X, core::vector3d::Y, and core::vector3d::Z.
Referenced by render::ShaderParamData::getCameraPositionObjectSpace(), render::ShaderParamData::getCurrentLightDirectionObjectSpace(), render::ShaderParamData::getCurrentLightDirectionViewSpace(), render::ShaderParamData::getCurrentLightPositionObjectSpace(), render::ShaderParamData::getCurrentLightPositionViewSpace(), transformBox(), and transformPlane().
Transforms input vector by this matrix and stores result in output vector.
References M, core::vector3d::X, core::vector3d::Y, and core::vector3d::Z.
void core::matrix4::translateVector | ( | vector3d & | vect | ) | const [inline] |
Translate a vector by the translation part of this matrix.
References M, core::vector3d::X, core::vector3d::Y, and core::vector3d::Z.
float core::matrix4::empty = 0 [static, private] |
Referenced by operator()(), and operator[]().
const matrix4 core::matrix4::IDENTITY [static] |
Referenced by render::Renderable::initProperties(), render::Overlay::initProperties(), render::Model::initProperties(), render::RenderManager::render(), render::RenderDriver::RenderDriver(), render::RenderManager::renderSingleRenderable(), render::ShaderParamData::ShaderParamData(), render::Model::updateImpl(), render::Overlay::updateWorldTransform(), and render::Model::updateWorldTransform().
f32 core::matrix4::M[16] [private] |
Matrix data, stored in row-major order.
Referenced by buildProjectionMatrixInfinitePerspectiveFov(), buildProjectionMatrixOrtho(), buildProjectionMatrixPerspective(), buildProjectionMatrixPerspectiveFov(), buildViewMatrix(), get(), getScale(), getTranslation(), getTransposed(), inverseRotateVect(), inverseTranslateVector(), makeIdentity(), matrix4(), operator!=(), operator()(), operator*(), operator*=(), operator+(), operator+=(), operator-(), operator-=(), operator=(), operator==(), operator[](), rotateVector(), set(), setInverseRotationRadians(), setInverseTranslation(), setRotationRadians(), setScale(), setTranslation(), transformVector(), and translateVector().
const matrix4 core::matrix4::ZERO [static] |
Referenced by render::Camera::initProperties().
The KG Game Engine
Documentation © 2006-2011 by Kat'Oun. Generated on Sat Jul 2 2011 00:50:07 by
Doxygen
(1.7.4)
|