Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members | Related Pages

# OgreOptimisedUtil.h

Go to the documentation of this file.

    00001 /*
    00002 -----------------------------------------------------------------------------
    00003 This source file is part of OGRE
    00004     (Object-oriented Graphics Rendering Engine)
    00005 For the latest info, see http://www.ogre3d.org/
    00006
    00007 Copyright (c) 2000-2006 Torus Knot Software Ltd
    00008 Also see acknowledgements in Readme.html
    00009
    00010 This program is free software; you can redistribute it and/or modify it under
    00011 the terms of the GNU Lesser General Public License as published by the Free Software
    00012 Foundation; either version 2 of the License, or (at your option) any later
    00013 version.
    00014
    00015 This program is distributed in the hope that it will be useful, but WITHOUT
    00016 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
    00017 FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
    00018
    00019 You should have received a copy of the GNU Lesser General Public License along with
    00020 this program; if not, write to the Free Software Foundation, Inc., 59 Temple
    00021 Place - Suite 330, Boston, MA 02111-1307, USA, or go to
    00022 http://www.gnu.org/copyleft/lesser.txt.
    00023
    00024 You may alternatively use this source under the terms of a specific version of
    00025 the OGRE Unrestricted License provided you have obtained such a license from
    00026 Torus Knot Software Ltd.
    00027 -----------------------------------------------------------------------------
    00028 */
    00029 #ifndef __OptimisedUtil_H__
    00030 #define __OptimisedUtil_H__
    00031
    00032 #include "OgrePrerequisites.h"
    00033 #include "OgreEdgeListBuilder.h"
    00034
    00035 namespace Ogre {
    00036
    00041     class _OgreExport OptimisedUtil
    00042     {
    00043     private:
    00045         OptimisedUtil(const OptimisedUtil& rhs); /* do nothing, should not use */
    00047         OptimisedUtil& operator=(const OptimisedUtil& rhs); /* do not use */
    00048
    00049     protected:
    00051         static OptimisedUtil* msImplementation;
    00052
    00054         static OptimisedUtil* _detectImplementation(void);
    00055
    00056     public:
    00057         // Default constructor
    00058         OptimisedUtil(void) {}
    00059         // Destructor
    00060         virtual ~OptimisedUtil() {}
    00061
    00067         static OptimisedUtil* getImplementation(void) { return msImplementation; }
    00068
    00093         virtual void softwareVertexSkinning(
    00094             const float *srcPosPtr, float *destPosPtr,
    00095             const float *srcNormPtr, float *destNormPtr,
    00096             const float *blendWeightPtr, const unsigned char* blendIndexPtr,
    00097             const Matrix4* const* blendMatrices,
    00098             size_t srcPosStride, size_t destPosStride,
    00099             size_t srcNormStride, size_t destNormStride,
    00100             size_t blendWeightStride, size_t blendIndexStride,
    00101             size_t numWeightsPerVertex,
    00102             size_t numVertices) = 0;
    00103
    00117         virtual void softwareVertexMorph(
    00118             Real t,
    00119             const float *srcPos1, const float *srcPos2,
    00120             float *dstPos,
    00121             size_t numVertices) = 0;
    00122
    00132         virtual void concatenateAffineMatrices(
    00133             const Matrix4& baseMatrix,
    00134             const Matrix4* srcMatrices,
    00135             Matrix4* dstMatrices,
    00136             size_t numMatrices) = 0;
    00137
    00149         virtual void calculateFaceNormals(
    00150             const float *positions,
    00151             const EdgeData::Triangle *triangles,
    00152             Vector4 *faceNormals,
    00153             size_t numTriangles) = 0;
    00154
    00171         virtual void calculateLightFacing(
    00172             const Vector4& lightPos,
    00173             const Vector4* faceNormals,
    00174             char* lightFacings,
    00175             size_t numFaces) = 0;
    00176
    00191         virtual void extrudeVertices(
    00192             const Vector4& lightPos,
    00193             Real extrudeDist,
    00194             const float* srcPositions,
    00195             float* destPositions,
    00196             size_t numVertices) = 0;
    00197     };
    00198
    00203     template <class T>
    00204     static FORCEINLINE T* rawOffsetPointer(T* ptr, ptrdiff_t offset)
    00205     {
    00206         return (T*)((char*)(ptr) + offset);
    00207     }
    00208
    00213     template <class T>
    00214     static FORCEINLINE void advanceRawPointer(T*& ptr, ptrdiff_t offset)
    00215     {
    00216         ptr = rawOffsetPointer(ptr, offset);
    00217     }
    00218
    00219 }
    00220
    00221 #endif  // __OptimisedUtil_H__

Copyright © 2000-2005 by The OGRE Team
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Thu Mar 6 09:46:26 2008