OGRE-Next: Ogre::ArrayMatrix4 Class Reference

| OGRE-Next 3.0.0 Object-Oriented Graphics Rendering Engine

Loading...
Searching...
No Matches
Ogre::ArrayMatrix4 Class Reference
Core » Math

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

## 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

## 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 see ArrayVector3 & see ArrayQuaternion instead Architectures where the cache line == 32 bytes may want to set ARRAY_PACKED_REALS = 2 depending on their needs
  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

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

## ◆ ArrayMatrix4() [2/6]

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

References ArrayMatrix4(), and mChunkBase.

## ◆ ArrayMatrix4() [3/6]

Ogre::ArrayMatrix4::ArrayMatrix4 | ( |  | ) |
| inline

## ◆ ArrayMatrix4() [4/6]

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

References ArrayMatrix4(), and mChunkBase.

## ◆ ArrayMatrix4() [5/6]

Ogre::ArrayMatrix4::ArrayMatrix4 | ( |  | ) |
| inline

## ◆ ArrayMatrix4() [6/6]

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

References ArrayMatrix4(), and mChunkBase.

## Member Function Documentation

## ◆ createAllFromMatrix4() [1/3]

ArrayMatrix4 Ogre::ArrayMatrix4::createAllFromMatrix4 | ( | const Matrix4 & | m | ) |
| inlinestatic

References ArrayMatrix4(), and setAll().

## ◆ createAllFromMatrix4() [2/3]

ArrayMatrix4 Ogre::ArrayMatrix4::createAllFromMatrix4 | ( | const Matrix4 & | m | ) |
| inlinestatic

References ArrayMatrix4(), Ogre::Matrix4::_m, and mChunkBase.

## ◆ createAllFromMatrix4() [3/3]

ArrayMatrix4 Ogre::ArrayMatrix4::createAllFromMatrix4 | ( | const Matrix4 & | m | ) |
| inlinestatic

References ArrayMatrix4(), and 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

  The | quaternion 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

  q | The quaternion 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

  q | The quaternion to convert from.

## ◆ getAsMatrix4() [1/6]

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

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

Referenced by getAsMatrix4().

## ◆ getAsMatrix4() [2/6]

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

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

## ◆ getAsMatrix4() [3/6]

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

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

## ◆ 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)

References getAsMatrix4().

## ◆ 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)

References getAsMatrix4().

## ◆ 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)

References getAsMatrix4().

## ◆ 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.

References ArrayMatrix4(), and IDENTITY.

## ◆ 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.

References ArrayMatrix4(), and IDENTITY.

## ◆ 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

References RESTRICT_ALIAS.

## ◆ 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

References RESTRICT_ALIAS.

## ◆ loadFromAoS() [3/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

References RESTRICT_ALIAS.

## ◆ loadFromAoS() [4/6]

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

References RESTRICT_ALIAS.

## ◆ loadFromAoS() [5/6]

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

References RESTRICT_ALIAS.

## ◆ loadFromAoS() [6/6]

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

References RESTRICT_ALIAS.

## ◆ 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!).

References ArrayMatrix4().

## ◆ 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!).

References ArrayMatrix4().

## ◆ 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!).

References ArrayMatrix4().

## ◆ 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

  rkMatrix | The other matrix

References ArrayMatrix4(), and mChunkBase.

## ◆ 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

  rkMatrix | The other matrix

References ArrayMatrix4(), and mChunkBase.

## ◆ 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

  rkMatrix | The other matrix

References ArrayMatrix4(), and mChunkBase.

## ◆ 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, and mChunkBase.

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, and mChunkBase.

## ◆ 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, and mChunkBase.

## ◆ setFromMatrix4() [1/3]

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

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

## ◆ setFromMatrix4() [2/3]

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

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

## ◆ setFromMatrix4() [3/3]

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

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

## ◆ 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

References RESTRICT_ALIAS.

## ◆ 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

References RESTRICT_ALIAS.

## ◆ 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

References RESTRICT_ALIAS.

## Member Data Documentation

## ◆ IDENTITY

const ArrayMatrix4 Ogre::ArrayMatrix4::IDENTITY
| static

Referenced by isAffine().

## ◆ mChunkBase

ArrayReal Ogre::ArrayMatrix4::mChunkBase

Referenced by ArrayMatrix4(), createAllFromMatrix4(), getAsMatrix4(), operator=(), setAll(), and setFromMatrix4().

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

- C/OgreArrayMatrix4.h
- NEON/Single/OgreArrayMatrix4.h
- SSE2/Single/OgreArrayMatrix4.h