OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
Ogre::ArrayMatrix4 Class Reference

Cache-friendly container of 4x4 matrices represented as a SoA array. More...

#include <OgreArrayMatrix4.h>

+ Collaboration diagram for Ogre::ArrayMatrix4:

Public Member Functions

 ArrayMatrix4 ()
 
 ArrayMatrix4 ()
 
 ArrayMatrix4 ()
 
 ArrayMatrix4 (const ArrayMatrix4 &copy)
 
 ArrayMatrix4 (const ArrayMatrix4 &copy)
 
 ArrayMatrix4 (const ArrayMatrix4 &copy)
 
void fromQuaternion (const ArrayQuaternion &q)
 Converts the given quaternion to a 3x3 matrix representation and fill our values. More...
 
void fromQuaternion (const ArrayQuaternion &q)
 Converts the given quaternion to a 3x3 matrix representation and fill our values. More...
 
void fromQuaternion (const ArrayQuaternion &q)
 Converts the given quaternion to a 3x3 matrix representation and fill our values. More...
 
void getAsMatrix4 (Matrix4 &out, size_t index) const
 
void getAsMatrix4 (Matrix4 &out, size_t index) const
 
void getAsMatrix4 (Matrix4 &out, size_t index) const
 
Matrix4 getAsMatrix4 (size_t index) const
 STRONGLY Prefer using. More...
 
Matrix4 getAsMatrix4 (size_t index) const
 STRONGLY Prefer using. More...
 
Matrix4 getAsMatrix4 (size_t index) const
 STRONGLY Prefer using. More...
 
bool isAffine () const
 Check whether or not the matrix is affine matrix. More...
 
bool isAffine () const
 Check whether or not the matrix is affine matrix. More...
 
bool isAffine () const
 Check whether or not the matrix is affine matrix. More...
 
void loadFromAoS (const Matrix4 *RESTRICT_ALIAS src)
 Converts ARRAY_PACKED_REALS matrices into this ArrayMatrix. More...
 
void loadFromAoS (const Matrix4 *RESTRICT_ALIAS src)
 Converts ARRAY_PACKED_REALS matrices into this ArrayMatrix. More...
 
void loadFromAoS (const SimpleMatrix4 *RESTRICT_ALIAS src)
 
void loadFromAoS (const SimpleMatrix4 *RESTRICT_ALIAS src)
 
void loadFromAoS (const Matrix4 *RESTRICT_ALIAS src)
 Converts ARRAY_PACKED_REALS matrices into this ArrayMatrix. More...
 
void loadFromAoS (const SimpleMatrix4 *RESTRICT_ALIAS src)
 
void makeTransform (const ArrayVector3 &position, const ArrayVector3 &scale, const ArrayQuaternion &orientation)
 Building a Matrix4 from orientation / scale / position. More...
 
void makeTransform (const ArrayVector3 &position, const ArrayVector3 &scale, const ArrayQuaternion &orientation)
 Building a Matrix4 from orientation / scale / position. More...
 
void makeTransform (const ArrayVector3 &position, const ArrayVector3 &scale, const ArrayQuaternion &orientation)
 Building a Matrix4 from orientation / scale / position. More...
 
ArrayVector3 operator* (const ArrayVector3 &rhs) const
 
ArrayVector3 operator* (const ArrayVector3 &rhs) const
 
ArrayVector3 operator* (const ArrayVector3 &rhs) const
 
void operator*= (const ArrayMatrix4 &rhs)
 Prefer the update version 'a *= b' A LOT over 'a = a * b' (copying from an ArrayMatrix4 is 256 bytes!) More...
 
void operator*= (const ArrayMatrix4 &rhs)
 Prefer the update version 'a *= b' A LOT over 'a = a * b' (copying from an ArrayMatrix4 is 256 bytes!) More...
 
void operator*= (const ArrayMatrix4 &rhs)
 Prefer the update version 'a *= b' A LOT over 'a = a * b' (copying from an ArrayMatrix4 is 256 bytes!) More...
 
ArrayMatrix4operator= (const ArrayMatrix4 &rkMatrix)
 Assigns the value of the other matrix. More...
 
ArrayMatrix4operator= (const ArrayMatrix4 &rkMatrix)
 Assigns the value of the other matrix. More...
 
ArrayMatrix4operator= (const ArrayMatrix4 &rkMatrix)
 Assigns the value of the other matrix. More...
 
void setAll (const Matrix4 &m)
 Sets all packed matrices to the same value as the scalar input matrix. More...
 
void setAll (const Matrix4 &m)
 Sets all packed matrices to the same value as the scalar input matrix. More...
 
void setAll (const Matrix4 &m)
 Sets all packed matrices to the same value as the scalar input matrix. More...
 
void setFromMatrix4 (const Matrix4 &m, size_t index)
 
void setFromMatrix4 (const Matrix4 &m, size_t index)
 
void setFromMatrix4 (const Matrix4 &m, size_t index)
 
void storeToAoS (Matrix4 *RESTRICT_ALIAS dst) const
 Converts these matrices contained in this ArrayMatrix to AoS form and stores them in dst. More...
 
void storeToAoS (Matrix4 *RESTRICT_ALIAS dst) const
 Converts these matrices contained in this ArrayMatrix to AoS form and stores them in dst. More...
 
void storeToAoS (Matrix4 *RESTRICT_ALIAS dst) const
 Converts these matrices contained in this ArrayMatrix to AoS form and stores them in dst. More...
 

Static Public Member Functions

static ArrayMatrix4 createAllFromMatrix4 (const Matrix4 &m)
 
static ArrayMatrix4 createAllFromMatrix4 (const Matrix4 &m)
 
static ArrayMatrix4 createAllFromMatrix4 (const Matrix4 &m)
 

Public Attributes

ArrayReal mChunkBase [16]
 

Static Public Attributes

static const ArrayMatrix4 IDENTITY
 

Friends

ArrayMatrix4 operator* (const ArrayMatrix4 &lhs, const ArrayMatrix4 &rhs)
 
ArrayMatrix4 operator* (const ArrayMatrix4 &lhs, const ArrayMatrix4 &rhs)
 
ArrayMatrix4 operator* (const ArrayMatrix4 &lhs, const ArrayMatrix4 &rhs)
 

Detailed Description

Cache-friendly container of 4x4 matrices represented as a SoA array.

Remarks
ArrayMatrix4 is a SIMD & cache-friendly version of Matrix4. An operation on an ArrayMatrix4 is done on 4 vectors at a time (the actual amount is defined by ARRAY_PACKED_REALS) Assuming ARRAY_PACKED_REALS == 4, the memory layout will be as following: mChunkBase mChunkBase + 3 a00b00c00d00 a01b01c01d01 Extracting one Matrix4 needs 256 bytes, which needs 4 line fetches for common cache lines of 64 bytes. Make sure extractions are made sequentially to avoid cache trashing and excessive bandwidth consumption, and prefer working on ArrayVector3 & ArrayQuaternion instead Architectures where the cache line == 32 bytes may want to set ARRAY_PACKED_REALS = 2 depending on their needs

Definition at line 69 of file C/OgreArrayMatrix4.h.

Constructor & Destructor Documentation

Ogre::ArrayMatrix4::ArrayMatrix4 ( )
inline

Definition at line 74 of file C/OgreArrayMatrix4.h.

Ogre::ArrayMatrix4::ArrayMatrix4 ( const ArrayMatrix4 copy)
inline

Definition at line 75 of file C/OgreArrayMatrix4.h.

References mChunkBase.

Ogre::ArrayMatrix4::ArrayMatrix4 ( )
inline

Definition at line 74 of file NEON/Single/OgreArrayMatrix4.h.

Ogre::ArrayMatrix4::ArrayMatrix4 ( const ArrayMatrix4 copy)
inline

Definition at line 75 of file NEON/Single/OgreArrayMatrix4.h.

References mChunkBase.

Ogre::ArrayMatrix4::ArrayMatrix4 ( )
inline

Definition at line 74 of file SSE2/Single/OgreArrayMatrix4.h.

Ogre::ArrayMatrix4::ArrayMatrix4 ( const ArrayMatrix4 copy)
inline

Definition at line 75 of file SSE2/Single/OgreArrayMatrix4.h.

References mChunkBase.

Member Function Documentation

static ArrayMatrix4 Ogre::ArrayMatrix4::createAllFromMatrix4 ( const Matrix4 m)
inlinestatic

Definition at line 148 of file C/OgreArrayMatrix4.h.

References setAll().

static ArrayMatrix4 Ogre::ArrayMatrix4::createAllFromMatrix4 ( const Matrix4 m)
inlinestatic

Definition at line 148 of file NEON/Single/OgreArrayMatrix4.h.

References Ogre::Matrix4::_m, and mChunkBase.

static ArrayMatrix4 Ogre::ArrayMatrix4::createAllFromMatrix4 ( const Matrix4 m)
inlinestatic

Definition at line 148 of file SSE2/Single/OgreArrayMatrix4.h.

References setAll().

void Ogre::ArrayMatrix4::fromQuaternion ( const ArrayQuaternion q)
inline

Converts the given quaternion to a 3x3 matrix representation and fill our values.

Remarks
Similar to
See also
Quaternion::ToRotationMatrix, this function will take the input quaternion and overwrite the first 3x3 subset of this matrix. The 4th row & columns are left untouched. This function is defined in ArrayMatrix4 to avoid including this header into ArrayQuaternion. The idea is that ArrayMatrix4 requires ArrayQuaternion, and ArrayQuaternion requires ArrayVector3. Simple dependency order
Parameters
Thequaternion to convert from.
void Ogre::ArrayMatrix4::fromQuaternion ( const ArrayQuaternion q)
inline

Converts the given quaternion to a 3x3 matrix representation and fill our values.

Remarks
Similar to
See also
Quaternion::ToRotationMatrix, this function will take the input quaternion and overwrite the first 3x3 subset of this matrix. The 4th row & columns are left untouched. This function is defined in ArrayMatrix4 to avoid including this header into ArrayQuaternion. The idea is that ArrayMatrix4 requires ArrayQuaternion, and ArrayQuaternion requires ArrayVector3. Simple dependency order
Parameters
Thequaternion to convert from.
void Ogre::ArrayMatrix4::fromQuaternion ( const ArrayQuaternion q)
inline

Converts the given quaternion to a 3x3 matrix representation and fill our values.

Remarks
Similar to
See also
Quaternion::ToRotationMatrix, this function will take the input quaternion and overwrite the first 3x3 subset of this matrix. The 4th row & columns are left untouched. This function is defined in ArrayMatrix4 to avoid including this header into ArrayQuaternion. The idea is that ArrayMatrix4 requires ArrayQuaternion, and ArrayQuaternion requires ArrayVector3. Simple dependency order
Parameters
Thequaternion to convert from.
void Ogre::ArrayMatrix4::getAsMatrix4 ( Matrix4 out,
size_t  index 
) const
inline

Definition at line 90 of file C/OgreArrayMatrix4.h.

References Ogre::Matrix4::_m, ARRAY_PACKED_REALS, and RESTRICT_ALIAS.

void Ogre::ArrayMatrix4::getAsMatrix4 ( Matrix4 out,
size_t  index 
) const
inline
void Ogre::ArrayMatrix4::getAsMatrix4 ( Matrix4 out,
size_t  index 
) const
inline
Matrix4 Ogre::ArrayMatrix4::getAsMatrix4 ( size_t  index) const
inline

STRONGLY Prefer using.

See also
getAsMatrix4() because this function may have more overhead (the other one is faster)

Definition at line 106 of file NEON/Single/OgreArrayMatrix4.h.

Matrix4 Ogre::ArrayMatrix4::getAsMatrix4 ( size_t  index) const
inline

STRONGLY Prefer using.

See also
getAsMatrix4() because this function may have more overhead (the other one is faster)

Definition at line 106 of file C/OgreArrayMatrix4.h.

Matrix4 Ogre::ArrayMatrix4::getAsMatrix4 ( size_t  index) const
inline

STRONGLY Prefer using.

See also
getAsMatrix4() because this function may have more overhead (the other one is faster)

Definition at line 106 of file SSE2/Single/OgreArrayMatrix4.h.

bool Ogre::ArrayMatrix4::isAffine ( ) const
inline

Check whether or not the matrix is affine matrix.

Remarks
An affine matrix is a 4x4 matrix with row 3 equal to (0, 0, 0, 1), e.g. no projective coefficients.
bool Ogre::ArrayMatrix4::isAffine ( ) const
inline

Check whether or not the matrix is affine matrix.

Remarks
An affine matrix is a 4x4 matrix with row 3 equal to (0, 0, 0, 1), e.g. no projective coefficients.
bool Ogre::ArrayMatrix4::isAffine ( ) const
inline

Check whether or not the matrix is affine matrix.

Remarks
An affine matrix is a 4x4 matrix with row 3 equal to (0, 0, 0, 1), e.g. no projective coefficients.
void Ogre::ArrayMatrix4::loadFromAoS ( const Matrix4 *RESTRICT_ALIAS  src)
inline

Converts ARRAY_PACKED_REALS matrices into this ArrayMatrix.

Remarks
'src' must be aligned and assumed to have enough memory for ARRAY_PACKED_REALS matrices
void Ogre::ArrayMatrix4::loadFromAoS ( const Matrix4 *RESTRICT_ALIAS  src)
inline

Converts ARRAY_PACKED_REALS matrices into this ArrayMatrix.

Remarks
'src' must be aligned and assumed to have enough memory for ARRAY_PACKED_REALS matrices
void Ogre::ArrayMatrix4::loadFromAoS ( const SimpleMatrix4 *RESTRICT_ALIAS  src)
inline
void Ogre::ArrayMatrix4::loadFromAoS ( const SimpleMatrix4 *RESTRICT_ALIAS  src)
inline
void Ogre::ArrayMatrix4::loadFromAoS ( const Matrix4 *RESTRICT_ALIAS  src)
inline

Converts ARRAY_PACKED_REALS matrices into this ArrayMatrix.

Remarks
'src' must be aligned and assumed to have enough memory for ARRAY_PACKED_REALS matrices
void Ogre::ArrayMatrix4::loadFromAoS ( const SimpleMatrix4 *RESTRICT_ALIAS  src)
inline
void Ogre::ArrayMatrix4::makeTransform ( const ArrayVector3 position,
const ArrayVector3 scale,
const ArrayQuaternion orientation 
)
inline

Building a Matrix4 from orientation / scale / position.

Remarks
Transform is performed in the order scale, rotate, translation, i.e. translation is independent of orientation axes, scale does not affect size of translation, rotation and scaling are always centered on the origin.
void Ogre::ArrayMatrix4::makeTransform ( const ArrayVector3 position,
const ArrayVector3 scale,
const ArrayQuaternion orientation 
)
inline

Building a Matrix4 from orientation / scale / position.

Remarks
Transform is performed in the order scale, rotate, translation, i.e. translation is independent of orientation axes, scale does not affect size of translation, rotation and scaling are always centered on the origin.
void Ogre::ArrayMatrix4::makeTransform ( const ArrayVector3 position,
const ArrayVector3 scale,
const ArrayQuaternion orientation 
)
inline

Building a Matrix4 from orientation / scale / position.

Remarks
Transform is performed in the order scale, rotate, translation, i.e. translation is independent of orientation axes, scale does not affect size of translation, rotation and scaling are always centered on the origin.
ArrayVector3 Ogre::ArrayMatrix4::operator* ( const ArrayVector3 rhs) const
inline
ArrayVector3 Ogre::ArrayMatrix4::operator* ( const ArrayVector3 rhs) const
inline
ArrayVector3 Ogre::ArrayMatrix4::operator* ( const ArrayVector3 rhs) const
inline
void Ogre::ArrayMatrix4::operator*= ( const ArrayMatrix4 rhs)
inline

Prefer the update version 'a *= b' A LOT over 'a = a * b' (copying from an ArrayMatrix4 is 256 bytes!)

void Ogre::ArrayMatrix4::operator*= ( const ArrayMatrix4 rhs)
inline

Prefer the update version 'a *= b' A LOT over 'a = a * b' (copying from an ArrayMatrix4 is 256 bytes!)

void Ogre::ArrayMatrix4::operator*= ( const ArrayMatrix4 rhs)
inline

Prefer the update version 'a *= b' A LOT over 'a = a * b' (copying from an ArrayMatrix4 is 256 bytes!)

ArrayMatrix4& Ogre::ArrayMatrix4::operator= ( const ArrayMatrix4 rkMatrix)
inline

Assigns the value of the other matrix.

Does not reference the ptr address, but rather perform a memory copy

Parameters
rkmatrixThe other matrix

Definition at line 160 of file SSE2/Single/OgreArrayMatrix4.h.

References mChunkBase.

ArrayMatrix4& Ogre::ArrayMatrix4::operator= ( const ArrayMatrix4 rkMatrix)
inline

Assigns the value of the other matrix.

Does not reference the ptr address, but rather perform a memory copy

Parameters
rkmatrixThe other matrix

Definition at line 160 of file C/OgreArrayMatrix4.h.

References mChunkBase.

ArrayMatrix4& Ogre::ArrayMatrix4::operator= ( const ArrayMatrix4 rkMatrix)
inline

Assigns the value of the other matrix.

Does not reference the ptr address, but rather perform a memory copy

Parameters
rkmatrixThe other matrix

Definition at line 175 of file NEON/Single/OgreArrayMatrix4.h.

References mChunkBase.

void Ogre::ArrayMatrix4::setAll ( const Matrix4 m)
inline

Sets all packed matrices to the same value as the scalar input matrix.

Definition at line 128 of file C/OgreArrayMatrix4.h.

References Ogre::Matrix4::_m.

Referenced by createAllFromMatrix4().

void Ogre::ArrayMatrix4::setAll ( const Matrix4 m)
inline

Sets all packed matrices to the same value as the scalar input matrix.

Definition at line 128 of file SSE2/Single/OgreArrayMatrix4.h.

References Ogre::Matrix4::_m.

void Ogre::ArrayMatrix4::setAll ( const Matrix4 m)
inline

Sets all packed matrices to the same value as the scalar input matrix.

Definition at line 128 of file NEON/Single/OgreArrayMatrix4.h.

References Ogre::Matrix4::_m.

void Ogre::ArrayMatrix4::setFromMatrix4 ( const Matrix4 m,
size_t  index 
)
inline
void Ogre::ArrayMatrix4::setFromMatrix4 ( const Matrix4 m,
size_t  index 
)
inline
void Ogre::ArrayMatrix4::setFromMatrix4 ( const Matrix4 m,
size_t  index 
)
inline

Definition at line 114 of file C/OgreArrayMatrix4.h.

References Ogre::Matrix4::_m, ARRAY_PACKED_REALS, and RESTRICT_ALIAS.

void Ogre::ArrayMatrix4::storeToAoS ( Matrix4 *RESTRICT_ALIAS  dst) const
inline

Converts these matrices contained in this ArrayMatrix to AoS form and stores them in dst.

Remarks
'dst' must be aligned and assumed to have enough memory for ARRAY_PACKED_REALS matrices
void Ogre::ArrayMatrix4::storeToAoS ( Matrix4 *RESTRICT_ALIAS  dst) const
inline

Converts these matrices contained in this ArrayMatrix to AoS form and stores them in dst.

Remarks
'dst' must be aligned and assumed to have enough memory for ARRAY_PACKED_REALS matrices
void Ogre::ArrayMatrix4::storeToAoS ( Matrix4 *RESTRICT_ALIAS  dst) const
inline

Converts these matrices contained in this ArrayMatrix to AoS form and stores them in dst.

Remarks
'dst' must be aligned and assumed to have enough memory for ARRAY_PACKED_REALS matrices

Friends And Related Function Documentation

ArrayMatrix4 operator* ( const ArrayMatrix4 lhs,
const ArrayMatrix4 rhs 
)
friend
ArrayMatrix4 operator* ( const ArrayMatrix4 lhs,
const ArrayMatrix4 rhs 
)
friend
ArrayMatrix4 operator* ( const ArrayMatrix4 lhs,
const ArrayMatrix4 rhs 
)
friend

Member Data Documentation

static const ArrayMatrix4 Ogre::ArrayMatrix4::IDENTITY
static

Definition at line 214 of file C/OgreArrayMatrix4.h.

ArrayReal Ogre::ArrayMatrix4::mChunkBase

Definition at line 72 of file C/OgreArrayMatrix4.h.

Referenced by ArrayMatrix4(), createAllFromMatrix4(), and operator=().


The documentation for this class was generated from the following file: