OGRE  2.2.4
Object-Oriented Graphics Rendering Engine
Ogre::ArrayMatrix4 Class Reference

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

#include <OgreArrayMatrix4.h>

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

Constructor & Destructor Documentation

◆ ArrayMatrix4() [1/6]

Ogre::ArrayMatrix4::ArrayMatrix4 ( )
inline

◆ ArrayMatrix4() [2/6]

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

References mChunkBase.

◆ ArrayMatrix4() [3/6]

Ogre::ArrayMatrix4::ArrayMatrix4 ( )
inline

◆ ArrayMatrix4() [4/6]

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

References mChunkBase.

◆ ArrayMatrix4() [5/6]

Ogre::ArrayMatrix4::ArrayMatrix4 ( )
inline

◆ ArrayMatrix4() [6/6]

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

References mChunkBase.

Member Function Documentation

◆ createAllFromMatrix4() [1/3]

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

References setAll().

◆ createAllFromMatrix4() [2/3]

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

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

◆ createAllFromMatrix4() [3/3]

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

References setAll().

◆ fromQuaternion() [1/3]

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.

◆ fromQuaternion() [2/3]

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.

◆ fromQuaternion() [3/3]

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.

◆ getAsMatrix4() [1/6]

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

◆ getAsMatrix4() [2/6]

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

◆ getAsMatrix4() [3/6]

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

◆ getAsMatrix4() [4/6]

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)

◆ getAsMatrix4() [5/6]

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)

◆ getAsMatrix4() [6/6]

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)

◆ isAffine() [1/3]

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.

◆ isAffine() [2/3]

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.

◆ isAffine() [3/3]

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.

◆ loadFromAoS() [1/6]

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

◆ loadFromAoS() [2/6]

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

◆ loadFromAoS() [3/6]

void Ogre::ArrayMatrix4::loadFromAoS ( const SimpleMatrix4 *RESTRICT_ALIAS  src)
inline

◆ loadFromAoS() [4/6]

void Ogre::ArrayMatrix4::loadFromAoS ( const SimpleMatrix4 *RESTRICT_ALIAS  src)
inline

◆ loadFromAoS() [5/6]

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

◆ loadFromAoS() [6/6]

void Ogre::ArrayMatrix4::loadFromAoS ( const SimpleMatrix4 *RESTRICT_ALIAS  src)
inline

◆ makeTransform() [1/3]

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.

◆ makeTransform() [2/3]

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.

◆ makeTransform() [3/3]

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.

◆ operator*() [1/3]

ArrayVector3 Ogre::ArrayMatrix4::operator* ( const ArrayVector3 rhs) const
inline

◆ operator*() [2/3]

ArrayVector3 Ogre::ArrayMatrix4::operator* ( const ArrayVector3 rhs) const
inline

◆ operator*() [3/3]

ArrayVector3 Ogre::ArrayMatrix4::operator* ( const ArrayVector3 rhs) const
inline

◆ operator*=() [1/3]

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!)

◆ operator*=() [2/3]

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!)

◆ operator*=() [3/3]

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!)

◆ operator=() [1/3]

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

References mChunkBase, Ogre::operator*(), and RESTRICT_ALIAS.

◆ operator=() [2/3]

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

References mChunkBase, Ogre::operator*(), and RESTRICT_ALIAS.

◆ operator=() [3/3]

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

References mChunkBase, Ogre::operator*(), and RESTRICT_ALIAS.

◆ setAll() [1/3]

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

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

References Ogre::Matrix4::_m.

Referenced by createAllFromMatrix4().

◆ setAll() [2/3]

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

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

References Ogre::Matrix4::_m.

◆ setAll() [3/3]

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

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

References Ogre::Matrix4::_m.

◆ setFromMatrix4() [1/3]

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

◆ setFromMatrix4() [2/3]

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

◆ setFromMatrix4() [3/3]

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

◆ storeToAoS() [1/3]

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

◆ storeToAoS() [2/3]

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

◆ storeToAoS() [3/3]

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

◆ operator* [1/3]

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

◆ operator* [2/3]

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

◆ operator* [3/3]

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

Member Data Documentation

◆ IDENTITY

static const ArrayMatrix4 Ogre::ArrayMatrix4::IDENTITY
static

◆ mChunkBase

ArrayReal Ogre::ArrayMatrix4::mChunkBase

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