OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OgreOptimisedUtil.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4  (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2011 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __OptimisedUtil_H__
29 #define __OptimisedUtil_H__
30 
31 #include "OgrePrerequisites.h"
32 #include "OgreEdgeListBuilder.h"
33 #include <cstddef>
34 
35 namespace Ogre {
36 
48  {
49  private:
51  OptimisedUtil(const OptimisedUtil& rhs); /* do nothing, should not use */
53  OptimisedUtil& operator=(const OptimisedUtil& rhs); /* do not use */
54 
55  protected:
58 
60  static OptimisedUtil* _detectImplementation(void);
61 
62  public:
63  // Default constructor
64  OptimisedUtil(void) {}
65  // Destructor
66  virtual ~OptimisedUtil() {}
67 
73  static OptimisedUtil* getImplementation(void) { return msImplementation; }
74 
99  virtual void softwareVertexSkinning(
100  const float *srcPosPtr, float *destPosPtr,
101  const float *srcNormPtr, float *destNormPtr,
102  const float *blendWeightPtr, const unsigned char* blendIndexPtr,
103  const Matrix4* const* blendMatrices,
104  size_t srcPosStride, size_t destPosStride,
105  size_t srcNormStride, size_t destNormStride,
106  size_t blendWeightStride, size_t blendIndexStride,
107  size_t numWeightsPerVertex,
108  size_t numVertices) = 0;
109 
123  virtual void softwareVertexMorph(
124  Real t,
125  const float *srcPos1, const float *srcPos2,
126  float *dstPos,
127  size_t numVertices) = 0;
128 
138  virtual void concatenateAffineMatrices(
139  const Matrix4& baseMatrix,
140  const Matrix4* srcMatrices,
141  Matrix4* dstMatrices,
142  size_t numMatrices) = 0;
143 
155  virtual void calculateFaceNormals(
156  const float *positions,
157  const EdgeData::Triangle *triangles,
158  Vector4 *faceNormals,
159  size_t numTriangles) = 0;
160 
177  virtual void calculateLightFacing(
178  const Vector4& lightPos,
179  const Vector4* faceNormals,
180  char* lightFacings,
181  size_t numFaces) = 0;
182 
197  virtual void extrudeVertices(
198  const Vector4& lightPos,
199  Real extrudeDist,
200  const float* srcPositions,
201  float* destPositions,
202  size_t numVertices) = 0;
203  };
204 
209  template <class T>
210  static FORCEINLINE T* rawOffsetPointer(T* ptr, ptrdiff_t offset)
211  {
212  return (T*)((char*)(ptr) + offset);
213  }
214 
219  template <class T>
220  static FORCEINLINE void advanceRawPointer(T*& ptr, ptrdiff_t offset)
221  {
222  ptr = rawOffsetPointer(ptr, offset);
223  }
227 }
228 
229 #endif // __OptimisedUtil_H__
static OptimisedUtil * msImplementation
Store a pointer to the implementation.
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:78
float Real
Software floating point type.
#define _OgreExport
Definition: OgrePlatform.h:203
Basic triangle structure.
static FORCEINLINE void advanceRawPointer(T *&ptr, ptrdiff_t offset)
Advance the pointer with raw offset.
Utility class for provides optimised functions.
static OptimisedUtil * getImplementation(void)
Gets the implementation of this class.
static FORCEINLINE T * rawOffsetPointer(T *ptr, ptrdiff_t offset)
Returns raw offseted of the given pointer.
#define FORCEINLINE
Definition: OgrePlatform.h:91
4-dimensional homogeneous vector.
Definition: OgreVector4.h:45