# Ogre::OptimisedUtil Class Reference

Utility class for provides optimised functions. More...

`#include <OgreOptimisedUtil.h>`

List of all members.

## Public Member Functions

| OptimisedUtil (void)
virtual | ~OptimisedUtil ()

virtual void

softwareVertexSkinning (const float *srcPosPtr, float *destPosPtr, const float *srcNormPtr, float *destNormPtr, const float *blendWeightPtr, const unsigned char *blendIndexPtr, const Matrix4 *const *blendMatrices, size_t srcPosStride, size_t destPosStride, size_t srcNormStride, size_t destNormStride, size_t blendWeightStride, size_t blendIndexStride, size_t numWeightsPerVertex, size_t numVertices)=0

| Performs software vertex skinning.
virtual void | softwareVertexMorph (Real t, const float *srcPos1, const float *srcPos2, float *dstPos, size_t numVertices)=0
| Performs a software vertex morph, of the kind used for morph animation although it can be used for other purposes.
virtual void | concatenateAffineMatrices (const Matrix4 &baseMatrix, const Matrix4 *srcMatrices, Matrix4 *dstMatrices, size_t numMatrices)=0
| Concatenate an affine matrix to an array of affine matrices.
virtual void | calculateFaceNormals (const float *positions, const EdgeData::Triangle *triangles, Vector4 *faceNormals, size_t numTriangles)=0
| Calculate the face normals for the triangles based on position information.
virtual void | calculateLightFacing (const Vector4 &lightPos, const Vector4 *faceNormals, char *lightFacings, size_t numFaces)=0
| Calculate the light facing state of the triangle's face normals.
virtual void | extrudeVertices (const Vector4 &lightPos, Real extrudeDist, const float *srcPositions, float *destPositions, size_t numVertices)=0
| Extruding vertices by a fixed distance based on light position.

## Static Public Member Functions

static OptimisedUtil * | getImplementation (void)
| Gets the implementation of this class.

## Static Protected Member Functions

static OptimisedUtil * | _detectImplementation (void)
| Detect best implementation based on run-time environment.

## Static Protected Attributes

static OptimisedUtil * | msImplementation
| Store a pointer to the implementation.

## Private Member Functions

| OptimisedUtil (const OptimisedUtil &rhs)
| Privated copy constructor, to prevent misuse.
OptimisedUtil & | operator= (const OptimisedUtil &rhs)
| Privated operator=, to prevent misuse.

## Detailed Description

Utility class for provides optimised functions.

Note:
  This class are supposed used by internal engine only.

Definition at line 41 of file OgreOptimisedUtil.h.

## Constructor & Destructor Documentation

Ogre::OptimisedUtil::OptimisedUtil | ( | const OptimisedUtil & | rhs | ) | `[private]`

Privated copy constructor, to prevent misuse.

Ogre::OptimisedUtil::OptimisedUtil | ( | void |  | ) |

Definition at line 58 of file OgreOptimisedUtil.h.

virtual Ogre::OptimisedUtil::~OptimisedUtil | ( |  | ) | `[virtual]`

Definition at line 60 of file OgreOptimisedUtil.h.

## Member Function Documentation

OptimisedUtil& Ogre::OptimisedUtil::operator= | ( | const OptimisedUtil & | rhs | ) | `[private]`

Privated operator=, to prevent misuse.

static OptimisedUtil* Ogre::OptimisedUtil::_detectImplementation | ( | void |  | ) | `[static, protected]`

Detect best implementation based on run-time environment.

static OptimisedUtil* Ogre::OptimisedUtil::getImplementation | ( | void |  | ) | `[static]`

Gets the implementation of this class.

Note:
  Don't cache the pointer returned by this function, it'll change due run-time environment detection to pick up the best implementation.

Definition at line 67 of file OgreOptimisedUtil.h.

virtual void Ogre::OptimisedUtil::softwareVertexSkinning | ( | const float * | srcPosPtr,
|  | float * | destPosPtr,
|  | const float * | srcNormPtr,
|  | float * | destNormPtr,
|  | const float * | blendWeightPtr,
|  | const unsigned char * | blendIndexPtr,
|  | const Matrix4 *const * | blendMatrices,
|  | size_t | srcPosStride,
|  | size_t | destPosStride,
|  | size_t | srcNormStride,
|  | size_t | destNormStride,
|  | size_t | blendWeightStride,
|  | size_t | blendIndexStride,
|  | size_t | numWeightsPerVertex,
|  | size_t | numVertices |
| ) |  |  | `[pure virtual]`

Performs software vertex skinning.

Parameters:

  | srcPosPtr | Pointer to source position buffer.
  | destPosPtr | Pointer to destination position buffer.
  | srcNormPtr | Pointer to source normal buffer, if NULL, means blend position only.
  | destNormPtr | Pointer to destination normal buffer, it's ignored if srcNormPtr is NULL.
  | blendWeightPtr | Pointer to blend weight buffer.
  | blendIndexPtr | Pointer to blend index buffer.
  | blendMatrices | An array of pointer of blend matrix, the matrix must be aligned to SIMD alignment, but not necessary for the array itself.
  | srcPosStride | The stride of source position in bytes.
  | destPosStride | The stride of destination position in bytes.
  | srcNormStride | The stride of source normal in bytes, it's ignored if srcNormPtr is NULL.
  | destNormStride | The stride of destination normal in bytes, it's ignored if srcNormPtr is NULL.
  | blendWeightStride | The stride of blend weight buffer in bytes.
  | blendIndexStride | The stride of blend index buffer in bytes.
  | numWeightsPerVertex | Number of blend weights per-vertex, as well as for blend indices.
  | numVertices | Number of vertices to blend.

virtual void Ogre::OptimisedUtil::softwareVertexMorph | ( | Real | t,
|  | const float * | srcPos1,
|  | const float * | srcPos2,
|  | float * | dstPos,
|  | size_t | numVertices |
| ) |  |  | `[pure virtual]`

Performs a software vertex morph, of the kind used for morph animation although it can be used for other purposes.

Remarks:
  This function will linearly interpolate positions between two source buffers, into a third buffer.

Parameters:

  | t | Parametric distance between the start and end positions
  | srcPos1 | Pointer to buffer for the start positions
  | srcPos2 | Pointer to buffer for the end positions
  | dstPos | Pointer to buffer for the destination positions
  | numVertices | Number of vertices to morph, which agree with the number in start, end and destination buffer. Bear in mind three floating-point values per vertex

virtual void Ogre::OptimisedUtil::concatenateAffineMatrices | ( | const Matrix4 & | baseMatrix,
|  | const Matrix4 * | srcMatrices,
|  | Matrix4 * | dstMatrices,
|  | size_t | numMatrices |
| ) |  |  | `[pure virtual]`

Concatenate an affine matrix to an array of affine matrices.

Note:
  An affine matrix is a 4x4 matrix with row 3 equal to (0, 0, 0, 1), e.g. no projective coefficients.

Parameters:

  | baseMatrix | The matrix used as first operand.
  | srcMatrices | An array of matrix used as second operand.
  | dstMatrices | An array of matrix to store matrix concatenate results.
  | numMatrices | Number of matrices in the array.

virtual void Ogre::OptimisedUtil::calculateFaceNormals | ( | const float * | positions,
|  | const EdgeData::Triangle * | triangles,
|  | Vector4 * | faceNormals,
|  | size_t | numTriangles |
| ) |  |  | `[pure virtual]`

Calculate the face normals for the triangles based on position information.

Parameters:

  | positions | Pointer to position information, which packed in (x, y, z) format, indexing by vertex index in the triangle. No alignment requests.
  | triangles | The triangles need to calculate face normal, the vertex positions is indexed by vertex index to position information.
  | faceNormals | The array of Vector4 used to store triangles face normal, Must be aligned to SIMD alignment.
  | numTriangles | Number of triangles to calculate face normal.

virtual void Ogre::OptimisedUtil::calculateLightFacing | ( | const Vector4 & | lightPos,
|  | const Vector4 * | faceNormals,
|  | char * | lightFacings,
|  | size_t | numFaces |
| ) |  |  | `[pure virtual]`

Calculate the light facing state of the triangle's face normals.

Remarks:
  This is normally the first stage of calculating a silhouette, i.e. establishing which tris are facing the light and which are facing away.

Parameters:

  | lightPos | 4D position of the light in object space, note that for directional lights (which have no position), the w component is 0 and the x/y/z position are the direction.
  | faceNormals | An array of face normals for the triangles, the face normal are unit vector orthogonal to the triangles, plus distance from origin. This array must be aligned to SIMD alignment.
  | lightFacings | An array of flags for store light facing state results, the result flag is true if corresponding face normal facing the light, false otherwise. This array no alignment requires.
  | numFaces | Number of face normals to calculate.

virtual void Ogre::OptimisedUtil::extrudeVertices | ( | const Vector4 & | lightPos,
|  | Real | extrudeDist,
|  | const float * | srcPositions,
|  | float * | destPositions,
|  | size_t | numVertices |
| ) |  |  | `[pure virtual]`

Extruding vertices by a fixed distance based on light position.

Parameters:

  | lightPos | 4D light position, when w=0.0f this represents a directional light, otherwise, w must be equal to 1.0f, which represents a point light.
  | extrudeDist | The distance to extrude.
  | srcPositions | Pointer to source vertex's position buffer, which the position is a 3D vector packed in xyz format. No SIMD alignment requirement but loss performance for unaligned data.
  | destPositions | Pointer to destination vertex's position buffer, which the position is a 3D vector packed in xyz format. No SIMD alignment requirement but loss performance for unaligned data.
  | numVertices | Number of vertices need to extruding, which agree with source and destination buffers.

## Member Data Documentation

OptimisedUtil* Ogre::OptimisedUtil::msImplementation`[static, protected]`

Store a pointer to the implementation.

Definition at line 51 of file OgreOptimisedUtil.h.

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

- OgreOptimisedUtil.h

Copyright © 2008 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sat Apr 11 14:29:43 2009