OGRE  2.0
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties 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-2014 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 
124  virtual void softwareVertexMorph(
125  Real t,
126  const float *srcPos1, const float *srcPos2,
127  float *dstPos,
128  size_t pos1VSize, size_t pos2VSize, size_t dstVSize,
129  size_t numVertices,
130  bool morphNormals) = 0;
131 
141  virtual void concatenateAffineMatrices(
142  const Matrix4& baseMatrix,
143  const Matrix4* srcMatrices,
144  Matrix4* dstMatrices,
145  size_t numMatrices) = 0;
146 
158  virtual void calculateFaceNormals(
159  const float *positions,
160  const EdgeData::Triangle *triangles,
161  Vector4 *faceNormals,
162  size_t numTriangles) = 0;
163 
180  virtual void calculateLightFacing(
181  const Vector4& lightPos,
182  const Vector4* faceNormals,
183  char* lightFacings,
184  size_t numFaces) = 0;
185 
200  virtual void extrudeVertices(
201  const Vector4& lightPos,
202  Real extrudeDist,
203  const float* srcPositions,
204  float* destPositions,
205  size_t numVertices) = 0;
206  };
207 
212  template <class T>
213  static FORCEINLINE const T* rawOffsetPointer(const T* ptr, ptrdiff_t offset)
214  {
215  return (const T*)((const char*)(ptr) + offset);
216  }
217 
218  template <class T>
219  static FORCEINLINE T* rawOffsetPointer(T* ptr, ptrdiff_t offset)
220  {
221  return (T*)((char*)(ptr) + offset);
222  }
223 
228  template <class T>
229  static FORCEINLINE void advanceRawPointer(const T*& ptr, ptrdiff_t offset)
230  {
231  ptr = rawOffsetPointer(ptr, offset);
232  }
233 
234  template <class T>
235  static FORCEINLINE void advanceRawPointer(T*& ptr, ptrdiff_t offset)
236  {
237  ptr = rawOffsetPointer(ptr, offset);
238  }
242 }
243 
244 #endif // __OptimisedUtil_H__
static OptimisedUtil * msImplementation
Store a pointer to the implementation.
Class encapsulating a standard 4x4 homogeneous matrix.
Definition: OgreMatrix4.h:79
float Real
Software floating point type.
#define _OgreExport
Definition: OgrePlatform.h:255
Basic triangle structure.
static FORCEINLINE const T * rawOffsetPointer(const T *ptr, ptrdiff_t offset)
Returns raw offseted of the given pointer.
Utility class for provides optimised functions.
static OptimisedUtil * getImplementation(void)
Gets the implementation of this class.
static FORCEINLINE void advanceRawPointer(const T *&ptr, ptrdiff_t offset)
Advance the pointer with raw offset.
#define FORCEINLINE
Definition: OgrePlatform.h:104
4-dimensional homogeneous vector.
Definition: OgreVector4.h:45