OgrePrerequisites.h
Go to the documentation of this file.

    00001 /*-------------------------------------------------------------------------
    00002 This source file is a part of OGRE
    00003 (Object-oriented Graphics Rendering Engine)
    00004
    00005 For the latest info, see http://www.ogre3d.org/
    00006
    00007 Copyright (c) 2000-2012 Torus Knot Software Ltd
    00008 Permission is hereby granted, free of charge, to any person obtaining a copy
    00009 of this software and associated documentation files (the "Software"), to deal
    00010 in the Software without restriction, including without limitation the rights
    00011 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    00012 copies of the Software, and to permit persons to whom the Software is
    00013 furnished to do so, subject to the following conditions:
    00014
    00015 The above copyright notice and this permission notice shall be included in
    00016 all copies or substantial portions of the Software.
    00017
    00018 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    00019 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00020 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    00021 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    00022 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    00023 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    00024 THE SOFTWARE
    00025 -------------------------------------------------------------------------*/
    00026 #ifndef __OgrePrerequisites_H__
    00027 #define __OgrePrerequisites_H__
    00028
    00029 // Platform-specific stuff
    00030 #include "OgrePlatform.h"
    00031
    00032 // Needed for OGRE_WCHAR_T_STRINGS below
    00033 #include <string>
    00034
    00035
    00036 // configure memory tracking
    00037 #if OGRE_DEBUG_MODE
    00038 #   if OGRE_MEMORY_TRACKER_DEBUG_MODE
    00039 #       define OGRE_MEMORY_TRACKER 1
    00040 #   else
    00041 #       define OGRE_MEMORY_TRACKER 0
    00042 #   endif
    00043 #else
    00044 #   if OGRE_MEMORY_TRACKER_RELEASE_MODE
    00045 #       define OGRE_MEMORY_TRACKER 1
    00046 #   else
    00047 #       define OGRE_MEMORY_TRACKER 0
    00048 #   endif
    00049 #endif
    00050
    00051
    00052
    00053
    00054 namespace Ogre {
    00055     // Define ogre version
    00056     #define OGRE_VERSION_MAJOR 1
    00057     #define OGRE_VERSION_MINOR 8
    00058     #define OGRE_VERSION_PATCH 1
    00059     #define OGRE_VERSION_SUFFIX ""
    00060     #define OGRE_VERSION_NAME "Byatis"
    00061
    00062     #define OGRE_VERSION    ((OGRE_VERSION_MAJOR << 16) | (OGRE_VERSION_MINOR << 8) | OGRE_VERSION_PATCH)
    00063
    00064     // define the real number values to be used
    00065     // default to use 'float' unless precompiler option set
    00066     #if OGRE_DOUBLE_PRECISION == 1
    00067
    00070         typedef double Real;
    00071     #else
    00072
    00075         typedef float Real;
    00076     #endif
    00077
    00078     #if OGRE_COMPILER == OGRE_COMPILER_GNUC && OGRE_COMP_VER >= 310 && !defined(STLPORT)
    00079     #   if OGRE_COMP_VER >= 430
    00080     #       define HashMap ::std::tr1::unordered_map
    00081     #       define HashSet ::std::tr1::unordered_set
    00082     #    else
    00083     #       define HashMap ::__gnu_cxx::hash_map
    00084     #       define HashSet ::__gnu_cxx::hash_set
    00085     #    endif
    00086     #elif OGRE_COMPILER == OGRE_COMPILER_CLANG
    00087     #    if defined(_LIBCPP_VERSION)
    00088     #       define HashMap ::std::unordered_map
    00089     #       define HashSet ::std::unordered_set
    00090     #    else
    00091     #       define HashMap ::std::tr1::unordered_map
    00092     #       define HashSet ::std::tr1::unordered_set
    00093     #    endif
    00094     #else
    00095     #   if OGRE_COMPILER == OGRE_COMPILER_MSVC
    00096     #       if OGRE_COMP_VER >= 1600 // VC++ 10.0
    00097     #           define HashMap ::std::tr1::unordered_map
    00098     #           define HashSet ::std::tr1::unordered_set
    00099     #       elif OGRE_COMP_VER > 1300 && !defined(_STLP_MSVC)
    00100     #           define HashMap ::stdext::hash_map
    00101     #           define HashSet ::stdext::hash_set
    00102     #       else
    00103     #           define HashMap ::std::hash_map
    00104     #           define HashSet ::std::hash_set
    00105     #       endif
    00106     #   else
    00107     #       define HashMap ::std::hash_map
    00108     #       define HashSet ::std::hash_set
    00109     #   endif
    00110     #endif
    00111
    00112     #define OGRE_DEFINE_STATIC_LOCAL(type, name, arguments) \
    00113         static type& name = *new type arguments
    00114
    00117     typedef unsigned char uchar;
    00118     typedef unsigned short ushort;
    00119     typedef unsigned int uint;
    00120     typedef unsigned long ulong;
    00121
    00122     // Useful threading defines
    00123 #include "Threading/OgreThreadDefines.h"
    00124
    00125 // Pre-declare classes
    00126 // Allows use of pointers in header files without including individual .h
    00127 // so decreases dependencies between files
    00128     class Angle;
    00129     class Animation;
    00130     class AnimationState;
    00131     class AnimationStateSet;
    00132     class AnimationTrack;
    00133     class Archive;
    00134     class ArchiveFactory;
    00135     class ArchiveManager;
    00136     class AutoParamDataSource;
    00137     class AxisAlignedBox;
    00138     class AxisAlignedBoxSceneQuery;
    00139     class Billboard;
    00140     class BillboardChain;
    00141     class BillboardSet;
    00142     class Bone;
    00143     class Camera;
    00144     class Codec;
    00145     class ColourValue;
    00146     class ConfigDialog;
    00147     template <typename T> class Controller;
    00148     template <typename T> class ControllerFunction;
    00149     class ControllerManager;
    00150     template <typename T> class ControllerValue;
    00151     class DefaultWorkQueue;
    00152     class Degree;
    00153     class DepthBuffer;
    00154     class DynLib;
    00155     class DynLibManager;
    00156     class EdgeData;
    00157     class EdgeListBuilder;
    00158     class Entity;
    00159     class ErrorDialog;
    00160     class ExternalTextureSourceManager;
    00161     class Factory;
    00162     class Font;
    00163     class FontPtr;
    00164     class FontManager;
    00165     struct FrameEvent;
    00166     class FrameListener;
    00167     class Frustum;
    00168     class GpuProgram;
    00169     class GpuProgramPtr;
    00170     class GpuProgramManager;
    00171     class GpuProgramUsage;
    00172     class HardwareIndexBuffer;
    00173     class HardwareOcclusionQuery;
    00174     class HardwareVertexBuffer;
    00175     class HardwarePixelBuffer;
    00176     class HardwarePixelBufferSharedPtr;
    00177     class HighLevelGpuProgram;
    00178     class HighLevelGpuProgramPtr;
    00179     class HighLevelGpuProgramManager;
    00180     class HighLevelGpuProgramFactory;
    00181     class IndexData;
    00182     class InstanceBatch;
    00183     class InstanceBatchHW;
    00184     class InstanceBatchHW_VTF;
    00185     class InstanceBatchShader;
    00186     class InstanceBatchVTF;
    00187     class InstanceManager;
    00188     class InstancedEntity;
    00189     class IntersectionSceneQuery;
    00190     class IntersectionSceneQueryListener;
    00191     class Image;
    00192     class KeyFrame;
    00193     class Light;
    00194     class Log;
    00195     class LogManager;
    00196     class LodStrategy;
    00197     class ManualResourceLoader;
    00198     class ManualObject;
    00199     class Material;
    00200     class MaterialPtr;
    00201     class MaterialManager;
    00202     class Math;
    00203     class Matrix3;
    00204     class Matrix4;
    00205     class MemoryManager;
    00206     class Mesh;
    00207     class MeshPtr;
    00208     class MeshSerializer;
    00209     class MeshSerializerImpl;
    00210     class MeshManager;
    00211     class MovableObject;
    00212     class MovablePlane;
    00213     class Node;
    00214     class NodeAnimationTrack;
    00215     class NodeKeyFrame;
    00216     class NumericAnimationTrack;
    00217     class NumericKeyFrame;
    00218     class Overlay;
    00219     class OverlayContainer;
    00220     class OverlayElement;
    00221     class OverlayElementFactory;
    00222     class OverlayManager;
    00223     class Particle;
    00224     class ParticleAffector;
    00225     class ParticleAffectorFactory;
    00226     class ParticleEmitter;
    00227     class ParticleEmitterFactory;
    00228     class ParticleSystem;
    00229     class ParticleSystemManager;
    00230     class ParticleSystemRenderer;
    00231     class ParticleSystemRendererFactory;
    00232     class ParticleVisualData;
    00233     class Pass;
    00234     class PatchMesh;
    00235     class PixelBox;
    00236     class Plane;
    00237     class PlaneBoundedVolume;
    00238     class Plugin;
    00239     class Pose;
    00240     class ProgressiveMesh;
    00241     class Profile;
    00242     class Profiler;
    00243     class Quaternion;
    00244     class Radian;
    00245     class Ray;
    00246     class RaySceneQuery;
    00247     class RaySceneQueryListener;
    00248     class Renderable;
    00249     class RenderPriorityGroup;
    00250     class RenderQueue;
    00251     class RenderQueueGroup;
    00252     class RenderQueueInvocation;
    00253     class RenderQueueInvocationSequence;
    00254     class RenderQueueListener;
    00255     class RenderObjectListener;
    00256     class RenderSystem;
    00257     class RenderSystemCapabilities;
    00258     class RenderSystemCapabilitiesManager;
    00259     class RenderSystemCapabilitiesSerializer;
    00260     class RenderTarget;
    00261     class RenderTargetListener;
    00262     class RenderTexture;
    00263     class MultiRenderTarget;
    00264     class RenderWindow;
    00265     class RenderOperation;
    00266     class Resource;
    00267     class ResourceBackgroundQueue;
    00268     class ResourceGroupManager;
    00269     class ResourceManager;
    00270     class RibbonTrail;
    00271     class Root;
    00272     class SceneManager;
    00273     class SceneManagerEnumerator;
    00274     class SceneNode;
    00275     class SceneQuery;
    00276     class SceneQueryListener;
    00277     class ScriptCompiler;
    00278     class ScriptCompilerManager;
    00279     class ScriptLoader;
    00280     class Serializer;
    00281     class ShadowCaster;
    00282     class ShadowRenderable;
    00283     class ShadowTextureManager;
    00284     class SimpleRenderable;
    00285     class SimpleSpline;
    00286     class Skeleton;
    00287     class SkeletonPtr;
    00288     class SkeletonInstance;
    00289     class SkeletonManager;
    00290     class Sphere;
    00291     class SphereSceneQuery;
    00292     class StaticGeometry;
    00293     class StreamSerialiser;
    00294     class StringConverter;
    00295     class StringInterface;
    00296     class SubEntity;
    00297     class SubMesh;
    00298     class TagPoint;
    00299     class Technique;
    00300     class TempBlendedBufferInfo;
    00301     class ExternalTextureSource;
    00302     class TextureUnitState;
    00303     class Texture;
    00304     class TexturePtr;
    00305     class TextureManager;
    00306     class TransformKeyFrame;
    00307     class Timer;
    00308     class UserObjectBindings;
    00309     class Vector2;
    00310     class Vector3;
    00311     class Vector4;
    00312     class Viewport;
    00313     class VertexAnimationTrack;
    00314     class VertexBufferBinding;
    00315     class VertexData;
    00316     class VertexDeclaration;
    00317     class VertexMorphKeyFrame;
    00318     class WireBoundingBox;
    00319     class WorkQueue;
    00320     class Compositor;
    00321     class CompositorManager;
    00322     class CompositorChain;
    00323     class CompositorInstance;
    00324     class CompositorLogic;
    00325     class CompositionTechnique;
    00326     class CompositionPass;
    00327     class CompositionTargetPass;
    00328     class CustomCompositionPass;
    00329 }
    00330
    00331 /* Include all the standard header *after* all the configuration
    00332 settings have been made.
    00333 */
    00334 #include "OgreStdHeaders.h"
    00335 #include "OgreMemoryAllocatorConfig.h"
    00336
    00337
    00338 namespace Ogre
    00339 {
    00340 #if OGRE_STRING_USE_CUSTOM_MEMORY_ALLOCATOR
    00341     #if OGRE_WCHAR_T_STRINGS
    00342         typedef std::basic_string<wchar_t, std::char_traits<wchar_t>, STLAllocator<wchar_t,GeneralAllocPolicy > >   _StringBase;
    00343     #else
    00344         typedef std::basic_string<char, std::char_traits<char>, STLAllocator<char,GeneralAllocPolicy > >    _StringBase;
    00345     #endif
    00346
    00347     #if OGRE_WCHAR_T_STRINGS
    00348         typedef std::basic_stringstream<wchar_t,std::char_traits<wchar_t>,STLAllocator<wchar_t,GeneralAllocPolicy >> _StringStreamBase;
    00349     #else
    00350         typedef std::basic_stringstream<char,std::char_traits<char>,STLAllocator<char,GeneralAllocPolicy > > _StringStreamBase;
    00351     #endif
    00352
    00353     #define StdStringT(T) std::basic_string<T, std::char_traits<T>, std::allocator<T> >
    00354     #define CustomMemoryStringT(T) std::basic_string<T, std::char_traits<T>, STLAllocator<T,GeneralAllocPolicy> >
    00355
    00356     template<typename T>
    00357     bool operator <(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
    00358     {
    00359         return l.compare(0,l.length(),o.c_str(),o.length())<0;
    00360     }
    00361     template<typename T>
    00362     bool operator <(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
    00363     {
    00364         return l.compare(0,l.length(),o.c_str(),o.length())<0;
    00365     }
    00366     template<typename T>
    00367     bool operator <=(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
    00368     {
    00369         return l.compare(0,l.length(),o.c_str(),o.length())<=0;
    00370     }
    00371     template<typename T>
    00372     bool operator <=(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
    00373     {
    00374         return l.compare(0,l.length(),o.c_str(),o.length())<=0;
    00375     }
    00376     template<typename T>
    00377     bool operator >(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
    00378     {
    00379         return l.compare(0,l.length(),o.c_str(),o.length())>0;
    00380     }
    00381     template<typename T>
    00382     bool operator >(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
    00383     {
    00384         return l.compare(0,l.length(),o.c_str(),o.length())>0;
    00385     }
    00386     template<typename T>
    00387     bool operator >=(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
    00388     {
    00389         return l.compare(0,l.length(),o.c_str(),o.length())>=0;
    00390     }
    00391     template<typename T>
    00392     bool operator >=(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
    00393     {
    00394         return l.compare(0,l.length(),o.c_str(),o.length())>=0;
    00395     }
    00396
    00397     template<typename T>
    00398     bool operator ==(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
    00399     {
    00400         return l.compare(0,l.length(),o.c_str(),o.length())==0;
    00401     }
    00402     template<typename T>
    00403     bool operator ==(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
    00404     {
    00405         return l.compare(0,l.length(),o.c_str(),o.length())==0;
    00406     }
    00407
    00408     template<typename T>
    00409     bool operator !=(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
    00410     {
    00411         return l.compare(0,l.length(),o.c_str(),o.length())!=0;
    00412     }
    00413     template<typename T>
    00414     bool operator !=(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
    00415     {
    00416         return l.compare(0,l.length(),o.c_str(),o.length())!=0;
    00417     }
    00418
    00419     template<typename T>
    00420     CustomMemoryStringT(T) operator +=(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
    00421     {
    00422         return CustomMemoryStringT(T)(l)+=o.c_str();
    00423     }
    00424     template<typename T>
    00425     CustomMemoryStringT(T) operator +=(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
    00426     {
    00427         return CustomMemoryStringT(T)(l.c_str())+=o.c_str();
    00428     }
    00429
    00430     template<typename T>
    00431     CustomMemoryStringT(T) operator +(const CustomMemoryStringT(T)& l,const StdStringT(T)& o)
    00432     {
    00433         return CustomMemoryStringT(T)(l)+=o.c_str();
    00434     }
    00435
    00436     template<typename T>
    00437     CustomMemoryStringT(T) operator +(const StdStringT(T)& l,const CustomMemoryStringT(T)& o)
    00438     {
    00439         return CustomMemoryStringT(T)(l.c_str())+=o.c_str();
    00440     }
    00441
    00442     template<typename T>
    00443     CustomMemoryStringT(T) operator +(const T* l,const CustomMemoryStringT(T)& o)
    00444     {
    00445         return CustomMemoryStringT(T)(l)+=o;
    00446     }
    00447
    00448     #undef StdStringT
    00449     #undef CustomMemoryStringT
    00450
    00451 #else
    00452     #if OGRE_WCHAR_T_STRINGS
    00453         typedef std::wstring _StringBase;
    00454     #else
    00455         typedef std::string _StringBase;
    00456     #endif
    00457
    00458     #if OGRE_WCHAR_T_STRINGS
    00459         typedef std::basic_stringstream<wchar_t,std::char_traits<wchar_t>,std::allocator<wchar_t> > _StringStreamBase;
    00460     #else
    00461         typedef std::basic_stringstream<char,std::char_traits<char>,std::allocator<char> > _StringStreamBase;
    00462     #endif
    00463
    00464 #endif
    00465
    00466     typedef _StringBase String;
    00467     typedef _StringStreamBase StringStream;
    00468     typedef StringStream stringstream;
    00469
    00470 }
    00471
    00472 //for stl container
    00473 namespace Ogre
    00474 {
    00475     template <typename T, typename A = STLAllocator<T, GeneralAllocPolicy> >
    00476     struct deque
    00477     {
    00478 #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
    00479        typedef typename std::deque<T, A> type;
    00480        typedef typename std::deque<T, A>::iterator iterator;
    00481        typedef typename std::deque<T, A>::const_iterator const_iterator;
    00482 #else
    00483         typedef typename std::deque<T> type;
    00484         typedef typename std::deque<T>::iterator iterator;
    00485         typedef typename std::deque<T>::const_iterator const_iterator;
    00486 #endif
    00487     };
    00488
    00489     template <typename T, typename A = STLAllocator<T, GeneralAllocPolicy> >
    00490     struct vector
    00491     {
    00492 #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
    00493         typedef typename std::vector<T, A> type;
    00494         typedef typename std::vector<T, A>::iterator iterator;
    00495         typedef typename std::vector<T, A>::const_iterator const_iterator;
    00496 #else
    00497         typedef typename std::vector<T> type;
    00498         typedef typename std::vector<T>::iterator iterator;
    00499         typedef typename std::vector<T>::const_iterator const_iterator;
    00500 #endif
    00501     };
    00502
    00503     template <typename T, typename A = STLAllocator<T, GeneralAllocPolicy> >
    00504     struct list
    00505     {
    00506 #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
    00507        typedef typename std::list<T, A> type;
    00508        typedef typename std::list<T, A>::iterator iterator;
    00509        typedef typename std::list<T, A>::const_iterator const_iterator;
    00510 #else
    00511         typedef typename std::list<T> type;
    00512         typedef typename std::list<T>::iterator iterator;
    00513         typedef typename std::list<T>::const_iterator const_iterator;
    00514 #endif
    00515     };
    00516
    00517     template <typename T, typename P = std::less<T>, typename A = STLAllocator<T, GeneralAllocPolicy> >
    00518     struct set
    00519     {
    00520 #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
    00521        typedef typename std::set<T, P, A> type;
    00522        typedef typename std::set<T, P, A>::iterator iterator;
    00523        typedef typename std::set<T, P, A>::const_iterator const_iterator;
    00524 #else
    00525         typedef typename std::set<T, P> type;
    00526         typedef typename std::set<T, P>::iterator iterator;
    00527         typedef typename std::set<T, P>::const_iterator const_iterator;
    00528 #endif
    00529     };
    00530
    00531     template <typename K, typename V, typename P = std::less<K>, typename A = STLAllocator<std::pair<const K, V>, GeneralAllocPolicy> >
    00532     struct map
    00533     {
    00534 #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
    00535        typedef typename std::map<K, V, P, A> type;
    00536        typedef typename std::map<K, V, P, A>::iterator iterator;
    00537        typedef typename std::map<K, V, P, A>::const_iterator const_iterator;
    00538 #else
    00539         typedef typename std::map<K, V, P> type;
    00540         typedef typename std::map<K, V, P>::iterator iterator;
    00541         typedef typename std::map<K, V, P>::const_iterator const_iterator;
    00542 #endif
    00543     };
    00544
    00545     template <typename K, typename V, typename P = std::less<K>, typename A = STLAllocator<std::pair<const K, V>, GeneralAllocPolicy> >
    00546     struct multimap
    00547     {
    00548 #if OGRE_CONTAINERS_USE_CUSTOM_MEMORY_ALLOCATOR
    00549         typedef typename std::multimap<K, V, P, A> type;
    00550         typedef typename std::multimap<K, V, P, A>::iterator iterator;
    00551         typedef typename std::multimap<K, V, P, A>::const_iterator const_iterator;
    00552 #else
    00553         typedef typename std::multimap<K, V, P> type;
    00554         typedef typename std::multimap<K, V, P>::iterator iterator;
    00555         typedef typename std::multimap<K, V, P>::const_iterator const_iterator;
    00556 #endif
    00557     };
    00558
    00559 } // Ogre
    00560
    00561 #endif // __OgrePrerequisites_H__
    00562
    00563

Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sun Sep 2 2012 07:27:22