OGRE-Next  4.0.0unstable
Object-Oriented Graphics Rendering Engine
Ogre::ArrayMatrixAf4x3 Class Reference

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

#include <OgreArrayMatrixAf4x3SSE2.h>

Public Member Functions

 ArrayMatrixAf4x3 ()
 
 ArrayMatrixAf4x3 ()
 
 ArrayMatrixAf4x3 ()
 
void decomposition (ArrayVector3 &position, ArrayVector3 &scale, ArrayQuaternion &orientation) const
 Decompose a Matrix4 to orientation / scale / position. More...
 
void decomposition (ArrayVector3 &position, ArrayVector3 &scale, ArrayQuaternion &orientation) const
 Decompose a Matrix4 to orientation / scale / position. More...
 
void decomposition (ArrayVector3 &position, ArrayVector3 &scale, ArrayQuaternion &orientation) const
 Decompose a Matrix4 to orientation / scale / position. 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 fromQuaternion (const ArrayQuaternion &q)
 Converts the given quaternion to a 3x3 matrix representation and fill our values. More...
 
void loadFromAoS (const Matrix4 *RESTRICT_ALIAS *src)
 
void loadFromAoS (const Matrix4 *RESTRICT_ALIAS *src)
 
void loadFromAoS (const Matrix4 *RESTRICT_ALIAS *src)
 
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 Matrix4 *RESTRICT_ALIAS src)
 Converts ARRAY_PACKED_REALS matrices into this ArrayMatrix. More...
 
void loadFromAoS (const SimpleMatrixAf4x3 *RESTRICT_ALIAS *src)
 
void loadFromAoS (const SimpleMatrixAf4x3 *RESTRICT_ALIAS *src)
 
void loadFromAoS (const SimpleMatrixAf4x3 *RESTRICT_ALIAS *src)
 
void loadFromAoS (const SimpleMatrixAf4x3 *RESTRICT_ALIAS src)
 
void loadFromAoS (const SimpleMatrixAf4x3 *RESTRICT_ALIAS src)
 
void loadFromAoS (const SimpleMatrixAf4x3 *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 ArrayMatrixAf4x3 &rhs)
 Prefer the update version 'a *= b' A LOT over 'a = a * b' (copying from an ArrayMatrix4 is 256 bytes!) More...
 
FORCEINLINE void operator*= (const ArrayMatrixAf4x3 &rhs)
 Prefer the update version 'a *= b' A LOT over 'a = a * b' (copying from an ArrayMatrix4 is 256 bytes!) More...
 
FORCEINLINE void operator*= (const ArrayMatrixAf4x3 &rhs)
 Prefer the update version 'a *= b' A LOT over 'a = a * b' (copying from an ArrayMatrix4 is 256 bytes!) More...
 
void retain (ArrayMaskR orientation, ArrayMaskR scale)
 Strips orientation and/or scale components out of this matrix based on the input using branchless selection. More...
 
void retain (ArrayMaskR orientation, ArrayMaskR scale)
 Strips orientation and/or scale components out of this matrix based on the input using branchless selection. More...
 
void retain (ArrayMaskR orientation, ArrayMaskR scale)
 Strips orientation and/or scale components out of this matrix based on the input using branchless selection. 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 setToInverse ()
 Calculates the inverse of the matrix. More...
 
void setToInverse ()
 Calculates the inverse of the matrix. More...
 
void setToInverse ()
 Calculates the inverse of the matrix. More...
 
void setToInverseDegeneratesAsIdentity ()
 Calculates the inverse of the matrix. More...
 
void setToInverseDegeneratesAsIdentity ()
 Calculates the inverse of the matrix. More...
 
void setToInverseDegeneratesAsIdentity ()
 Calculates the inverse of the matrix. More...
 
void storeToAoS (SimpleMatrixAf4x3 *RESTRICT_ALIAS src) const
 
void storeToAoS (SimpleMatrixAf4x3 *RESTRICT_ALIAS src) const
 
void storeToAoS (SimpleMatrixAf4x3 *RESTRICT_ALIAS src) const
 
void streamToAoS (Matrix4 *RESTRICT_ALIAS dst) const
 Converts these matrices contained in this ArrayMatrix to AoS form and stores them in dst. More...
 
void streamToAoS (Matrix4 *RESTRICT_ALIAS dst) const
 Converts these matrices contained in this ArrayMatrix to AoS form and stores them in dst. More...
 
void streamToAoS (Matrix4 *RESTRICT_ALIAS dst) const
 Converts these matrices contained in this ArrayMatrix to AoS form and stores them in dst. More...
 
void streamToAoS (SimpleMatrixAf4x3 *RESTRICT_ALIAS src) const
 
void streamToAoS (SimpleMatrixAf4x3 *RESTRICT_ALIAS src) const
 
void streamToAoS (SimpleMatrixAf4x3 *RESTRICT_ALIAS src) const
 

Static Public Member Functions

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

Public Attributes

ArrayReal mChunkBase [12]
 

Static Public Attributes

static const ArrayMatrixAf4x3 IDENTITY
 

Detailed Description

Cache-friendly container of AFFINE 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 + 4 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

◆ ArrayMatrixAf4x3() [1/3]

Ogre::ArrayMatrixAf4x3::ArrayMatrixAf4x3 ( )
inline

◆ ArrayMatrixAf4x3() [2/3]

Ogre::ArrayMatrixAf4x3::ArrayMatrixAf4x3 ( )
inline

◆ ArrayMatrixAf4x3() [3/3]

Ogre::ArrayMatrixAf4x3::ArrayMatrixAf4x3 ( )
inline

Member Function Documentation

◆ createAllFromMatrix4() [1/3]

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

References setAll().

◆ createAllFromMatrix4() [2/3]

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

References setAll().

◆ createAllFromMatrix4() [3/3]

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

References setAll().

◆ decomposition() [1/3]

void Ogre::ArrayMatrixAf4x3::decomposition ( ArrayVector3 position,
ArrayVector3 scale,
ArrayQuaternion orientation 
) const
inline

Decompose a Matrix4 to orientation / scale / position.

◆ decomposition() [2/3]

void Ogre::ArrayMatrixAf4x3::decomposition ( ArrayVector3 position,
ArrayVector3 scale,
ArrayQuaternion orientation 
) const
inline

Decompose a Matrix4 to orientation / scale / position.

◆ decomposition() [3/3]

void Ogre::ArrayMatrixAf4x3::decomposition ( ArrayVector3 position,
ArrayVector3 scale,
ArrayQuaternion orientation 
) const
inline

Decompose a Matrix4 to orientation / scale / position.

◆ fromQuaternion() [1/3]

void Ogre::ArrayMatrixAf4x3::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
qThe quaternion to convert from.

◆ fromQuaternion() [2/3]

void Ogre::ArrayMatrixAf4x3::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
qThe quaternion to convert from.

◆ fromQuaternion() [3/3]

void Ogre::ArrayMatrixAf4x3::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
qThe quaternion to convert from.

◆ loadFromAoS() [1/12]

void Ogre::ArrayMatrixAf4x3::loadFromAoS ( const Matrix4 *RESTRICT_ALIAS src)
inline

◆ loadFromAoS() [2/12]

void Ogre::ArrayMatrixAf4x3::loadFromAoS ( const Matrix4 *RESTRICT_ALIAS src)
inline

◆ loadFromAoS() [3/12]

void Ogre::ArrayMatrixAf4x3::loadFromAoS ( const Matrix4 *RESTRICT_ALIAS src)
inline

◆ loadFromAoS() [4/12]

void Ogre::ArrayMatrixAf4x3::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() [5/12]

void Ogre::ArrayMatrixAf4x3::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/12]

void Ogre::ArrayMatrixAf4x3::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() [7/12]

void Ogre::ArrayMatrixAf4x3::loadFromAoS ( const SimpleMatrixAf4x3 *RESTRICT_ALIAS src)
inline

◆ loadFromAoS() [8/12]

void Ogre::ArrayMatrixAf4x3::loadFromAoS ( const SimpleMatrixAf4x3 *RESTRICT_ALIAS src)
inline

◆ loadFromAoS() [9/12]

void Ogre::ArrayMatrixAf4x3::loadFromAoS ( const SimpleMatrixAf4x3 *RESTRICT_ALIAS src)
inline

◆ loadFromAoS() [10/12]

void Ogre::ArrayMatrixAf4x3::loadFromAoS ( const SimpleMatrixAf4x3 *RESTRICT_ALIAS  src)
inline

◆ loadFromAoS() [11/12]

void Ogre::ArrayMatrixAf4x3::loadFromAoS ( const SimpleMatrixAf4x3 *RESTRICT_ALIAS  src)
inline

◆ loadFromAoS() [12/12]

void Ogre::ArrayMatrixAf4x3::loadFromAoS ( const SimpleMatrixAf4x3 *RESTRICT_ALIAS  src)
inline

◆ makeTransform() [1/3]

void Ogre::ArrayMatrixAf4x3::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::ArrayMatrixAf4x3::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::ArrayMatrixAf4x3::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::ArrayMatrixAf4x3::operator* ( const ArrayVector3 rhs) const
inline

◆ operator*() [2/3]

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

◆ operator*() [3/3]

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

◆ operator*=() [1/3]

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

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

◆ operator*=() [2/3]

FORCEINLINE void Ogre::ArrayMatrixAf4x3::operator*= ( const ArrayMatrixAf4x3 rhs)

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

◆ operator*=() [3/3]

FORCEINLINE void Ogre::ArrayMatrixAf4x3::operator*= ( const ArrayMatrixAf4x3 rhs)

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

◆ retain() [1/3]

void Ogre::ArrayMatrixAf4x3::retain ( ArrayMaskR  orientation,
ArrayMaskR  scale 
)
inline

Strips orientation and/or scale components out of this matrix based on the input using branchless selection.

Remarks
Scale is always assumed to be positive. Negating the scale is the same as rotating 180° and/or skewing. If negative scale was applied, it is assumed it was done using orientation/skewing alone (if orientation is stripped, the matrix will look in the opposite direction as if scale was positive, if scale is stripped, the matrix will keep looking in the opposite direction as if the scale were still negative) This behavior mimics that of major modeling tools.

◆ retain() [2/3]

void Ogre::ArrayMatrixAf4x3::retain ( ArrayMaskR  orientation,
ArrayMaskR  scale 
)
inline

Strips orientation and/or scale components out of this matrix based on the input using branchless selection.

Remarks
Scale is always assumed to be positive. Negating the scale is the same as rotating 180° and/or skewing. If negative scale was applied, it is assumed it was done using orientation/skewing alone (if orientation is stripped, the matrix will look in the opposite direction as if scale was positive, if scale is stripped, the matrix will keep looking in the opposite direction as if the scale were still negative) This behavior mimics that of major modeling tools.

◆ retain() [3/3]

void Ogre::ArrayMatrixAf4x3::retain ( ArrayMaskR  orientation,
ArrayMaskR  scale 
)
inline

Strips orientation and/or scale components out of this matrix based on the input using branchless selection.

Remarks
Scale is always assumed to be positive. Negating the scale is the same as rotating 180° and/or skewing. If negative scale was applied, it is assumed it was done using orientation/skewing alone (if orientation is stripped, the matrix will look in the opposite direction as if scale was positive, if scale is stripped, the matrix will keep looking in the opposite direction as if the scale were still negative) This behavior mimics that of major modeling tools.

◆ setAll() [1/3]

void Ogre::ArrayMatrixAf4x3::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::ArrayMatrixAf4x3::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::ArrayMatrixAf4x3::setAll ( const Matrix4 m)
inline

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

References Ogre::Matrix4::_m.

◆ setToInverse() [1/3]

void Ogre::ArrayMatrixAf4x3::setToInverse ( )
inline

Calculates the inverse of the matrix.

If used against degenerate matrices, it may cause NaNs and Infs on those. Use setToInverseDegeneratesAsIdentity() if you want to deal with degenerate matrices.

◆ setToInverse() [2/3]

void Ogre::ArrayMatrixAf4x3::setToInverse ( )
inline

Calculates the inverse of the matrix.

If used against degenerate matrices, it may cause NaNs and Infs on those. Use setToInverseDegeneratesAsIdentity() if you want to deal with degenerate matrices.

◆ setToInverse() [3/3]

void Ogre::ArrayMatrixAf4x3::setToInverse ( )
inline

Calculates the inverse of the matrix.

If used against degenerate matrices, it may cause NaNs and Infs on those. Use setToInverseDegeneratesAsIdentity() if you want to deal with degenerate matrices.

◆ setToInverseDegeneratesAsIdentity() [1/3]

void Ogre::ArrayMatrixAf4x3::setToInverseDegeneratesAsIdentity ( )
inline

Calculates the inverse of the matrix.

If one (or more) of the matrices are degenerate (don't have an inverse), those are set to identity.

◆ setToInverseDegeneratesAsIdentity() [2/3]

void Ogre::ArrayMatrixAf4x3::setToInverseDegeneratesAsIdentity ( )
inline

Calculates the inverse of the matrix.

If one (or more) of the matrices are degenerate (don't have an inverse), those are set to identity.

◆ setToInverseDegeneratesAsIdentity() [3/3]

void Ogre::ArrayMatrixAf4x3::setToInverseDegeneratesAsIdentity ( )
inline

Calculates the inverse of the matrix.

If one (or more) of the matrices are degenerate (don't have an inverse), those are set to identity.

◆ storeToAoS() [1/3]

void Ogre::ArrayMatrixAf4x3::storeToAoS ( SimpleMatrixAf4x3 *RESTRICT_ALIAS  src) const
inline

◆ storeToAoS() [2/3]

void Ogre::ArrayMatrixAf4x3::storeToAoS ( SimpleMatrixAf4x3 *RESTRICT_ALIAS  src) const
inline

◆ storeToAoS() [3/3]

void Ogre::ArrayMatrixAf4x3::storeToAoS ( SimpleMatrixAf4x3 *RESTRICT_ALIAS  src) const
inline

◆ streamToAoS() [1/6]

void Ogre::ArrayMatrixAf4x3::streamToAoS ( 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

◆ streamToAoS() [2/6]

void Ogre::ArrayMatrixAf4x3::streamToAoS ( 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

◆ streamToAoS() [3/6]

void Ogre::ArrayMatrixAf4x3::streamToAoS ( 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

◆ streamToAoS() [4/6]

void Ogre::ArrayMatrixAf4x3::streamToAoS ( SimpleMatrixAf4x3 *RESTRICT_ALIAS  src) const
inline

◆ streamToAoS() [5/6]

void Ogre::ArrayMatrixAf4x3::streamToAoS ( SimpleMatrixAf4x3 *RESTRICT_ALIAS  src) const
inline

◆ streamToAoS() [6/6]

void Ogre::ArrayMatrixAf4x3::streamToAoS ( SimpleMatrixAf4x3 *RESTRICT_ALIAS  src) const
inline

Member Data Documentation

◆ IDENTITY

static const ArrayMatrixAf4x3 Ogre::ArrayMatrixAf4x3::IDENTITY
static

◆ mChunkBase

ArrayReal Ogre::ArrayMatrixAf4x3::mChunkBase

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