OgreOptimisedUtil.h
Go to the documentation of this file.
/*
-----------------------------------------------------------------------------
This source file is part of OGRE
(Object-oriented Graphics Rendering Engine)
For the latest info, see http://www.ogre3d.org/
Copyright (c) 2000-2013 Torus Knot Software Ltd
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
-----------------------------------------------------------------------------
*/
#ifndef __OptimisedUtil_H__
#define __OptimisedUtil_H__
#include "OgrePrerequisites.h"
#include "OgreEdgeListBuilder.h"
#include <cstddef>
namespace Ogre {
class _OgreExport OptimisedUtil
{
private:
OptimisedUtil(const OptimisedUtil& rhs); /* do nothing, should not use */
OptimisedUtil& operator=(const OptimisedUtil& rhs); /* do not use */
protected:
static OptimisedUtil* msImplementation;
static OptimisedUtil* _detectImplementation(void);
public:
// Default constructor
OptimisedUtil(void) {}
// Destructor
virtual ~OptimisedUtil() {}
static OptimisedUtil* getImplementation(void) { return msImplementation; }
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;
virtual void softwareVertexMorph(
Real t,
const float *srcPos1, const float *srcPos2,
float *dstPos,
size_t pos1VSize, size_t pos2VSize, size_t dstVSize,
size_t numVertices,
bool morphNormals) = 0;
virtual void concatenateAffineMatrices(
const Matrix4& baseMatrix,
const Matrix4* srcMatrices,
Matrix4* dstMatrices,
size_t numMatrices) = 0;
virtual void calculateFaceNormals(
const float *positions,
const EdgeData::Triangle *triangles,
Vector4 *faceNormals,
size_t numTriangles) = 0;
virtual void calculateLightFacing(
const Vector4& lightPos,
const Vector4* faceNormals,
char* lightFacings,
size_t numFaces) = 0;
virtual void extrudeVertices(
const Vector4& lightPos,
Real extrudeDist,
const float* srcPositions,
float* destPositions,
size_t numVertices) = 0;
};
template <class T>
static FORCEINLINE const T* rawOffsetPointer(const T* ptr, ptrdiff_t offset)
{
return (const T*)((const char*)(ptr) + offset);
}
template <class T>
static FORCEINLINE T* rawOffsetPointer(T* ptr, ptrdiff_t offset)
{
return (T*)((char*)(ptr) + offset);
}
template <class T>
static FORCEINLINE void advanceRawPointer(const T*& ptr, ptrdiff_t offset)
{
ptr = rawOffsetPointer(ptr, offset);
}
template <class T>
static FORCEINLINE void advanceRawPointer(T*& ptr, ptrdiff_t offset)
{
ptr = rawOffsetPointer(ptr, offset);
}
}
#endif // __OptimisedUtil_H__
Ogre::OptimisedUtil::msImplementation
static OptimisedUtil * msImplementation
Store a pointer to the implementation.
Definition: OgreOptimisedUtil.h:57
_OgreExport
#define _OgreExport
Definition: OgrePlatform.h:257
Ogre::OptimisedUtil::OptimisedUtil
OptimisedUtil(void)
Definition: OgreOptimisedUtil.h:64
Ogre::Vector4
4-dimensional homogeneous vector.
Definition: OgreVector4.h:45
OgreEdgeListBuilder.h
Ogre::Real
float Real
Software floating point type.
Definition: OgrePrerequisites.h:70
Ogre::OptimisedUtil::getImplementation
static OptimisedUtil * getImplementation(void)
Gets the implementation of this class.
Definition: OgreOptimisedUtil.h:73
Ogre::Matrix4
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:78
Ogre::advanceRawPointer
static FORCEINLINE void advanceRawPointer(const T *&ptr, ptrdiff_t offset)
Advance the pointer with raw offset.
Definition: OgreOptimisedUtil.h:229
OgrePrerequisites.h
Ogre
Definition: OgreAndroidLogListener.h:34
Ogre::EdgeData::Triangle
Basic triangle structure.
Definition: OgreEdgeListBuilder.h:59
Ogre::OptimisedUtil::~OptimisedUtil
virtual ~OptimisedUtil()
Definition: OgreOptimisedUtil.h:66
FORCEINLINE
#define FORCEINLINE
Definition: OgrePlatform.h:102
Ogre::OptimisedUtil
Utility class for provides optimised functions.
Definition: OgreOptimisedUtil.h:47
Ogre::rawOffsetPointer
static FORCEINLINE const T * rawOffsetPointer(const T *ptr, ptrdiff_t offset)
Returns raw offseted of the given pointer.
Definition: OgreOptimisedUtil.h:213

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.