OgreD3D9Prerequisites.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-2012 Torus Knot Software Ltd
    00008
    00009 Permission is hereby granted, free of charge, to any person obtaining a copy
    00010 of this software and associated documentation files (the "Software"), to deal
    00011 in the Software without restriction, including without limitation the rights
    00012 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
    00013 copies of the Software, and to permit persons to whom the Software is
    00014 furnished to do so, subject to the following conditions:
    00015
    00016 The above copyright notice and this permission notice shall be included in
    00017 all copies or substantial portions of the Software.
    00018
    00019 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
    00020 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
    00021 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
    00022 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
    00023 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
    00024 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
    00025 THE SOFTWARE.
    00026 -----------------------------------------------------------------------------
    00027 */
    00028 #ifndef __D3D9PREREQUISITES_H__
    00029 #define __D3D9PREREQUISITES_H__
    00030
    00031 #include "OgrePrerequisites.h"
    00032 #ifdef __MINGW32__
    00033 #  include "WIN32/OgreMinGWSupport.h" // extra defines for MinGW to deal with DX SDK
    00034 #endif
    00035
    00036 #if OGRE_THREAD_SUPPORT
    00037 #define OGRE_LOCK_RECURSIVE_MUTEX(name)   name.lock();
    00038 #define OGRE_UNLOCK_RECURSIVE_MUTEX(name) name.unlock();
    00039 #else
    00040 #define OGRE_LOCK_RECURSIVE_MUTEX(name)
    00041 #define OGRE_UNLOCK_RECURSIVE_MUTEX(name)
    00042 #endif
    00043
    00044
    00045 #if OGRE_THREAD_SUPPORT == 1
    00046 #define D3D9_DEVICE_ACCESS_LOCK             OGRE_LOCK_RECURSIVE_MUTEX(msDeviceAccessMutex);
    00047 #define D3D9_DEVICE_ACCESS_UNLOCK           OGRE_UNLOCK_RECURSIVE_MUTEX(msDeviceAccessMutex);
    00048 #define D3D9_DEVICE_ACCESS_CRITICAL_SECTION OGRE_LOCK_MUTEX(msDeviceAccessMutex)
    00049 #else
    00050 #define D3D9_DEVICE_ACCESS_LOCK
    00051 #define D3D9_DEVICE_ACCESS_UNLOCK
    00052 #define D3D9_DEVICE_ACCESS_CRITICAL_SECTION
    00053 #endif
    00054
    00055 // Define versions for if DirectX is in use (Win32 only)
    00056 #define DIRECT3D_VERSION 0x0900
    00057
    00058 // some D3D commonly used macros
    00059 #define SAFE_DELETE(p)       { if(p) { delete (p);     (p)=NULL; } }
    00060 #define SAFE_DELETE_ARRAY(p) { if(p) { delete[] (p);   (p)=NULL; } }
    00061 #define SAFE_RELEASE(p)      { if(p) { (p)->Release(); (p)=NULL; } }
    00062
    00063 // enable extended d3d debug
    00064 #if OGRE_DEBUG_MODE
    00065 #   define D3D_DEBUG_INFO
    00066 #endif
    00067
    00068 #define WIN32_LEAN_AND_MEAN
    00069 #if !defined(NOMINMAX) && defined(_MSC_VER)
    00070 #   define NOMINMAX // required to stop windows.h messing up std::min
    00071 #endif
    00072 #include <d3d9.h>
    00073 #include <d3dx9.h>
    00074 #include <DxErr.h>
    00075
    00076
    00077 namespace Ogre
    00078 {
    00079     // Predefine classes
    00080     class D3D9DepthBuffer;
    00081     class D3D9RenderSystem;
    00082     class D3D9RenderWindow;
    00083     class D3D9Texture;
    00084     class D3D9TextureManager;
    00085     class D3D9Driver;
    00086     class D3D9DriverList;
    00087     class D3D9VideoMode;
    00088     class D3D9VideoModeList;
    00089     class D3D9GpuProgram;
    00090     class D3D9GpuProgramManager;
    00091     class D3D9HardwareBufferManager;
    00092     class D3D9HardwareIndexBuffer;
    00093     class D3D9HLSLProgramFactory;
    00094     class D3D9HLSLProgram;
    00095     class D3D9VertexDeclaration;
    00096     class D3D9Resource;
    00097
    00098 // Should we ask D3D to manage vertex/index buffers automatically?
    00099 // Doing so avoids lost devices, but also has a performance impact
    00100 // which is unacceptably bad when using very large buffers
    00101 #define OGRE_D3D_MANAGE_BUFFERS 1
    00102
    00103     //-------------------------------------------
    00104     // Windows setttings
    00105     //-------------------------------------------
    00106 #if (OGRE_PLATFORM == OGRE_PLATFORM_WIN32) && !defined(OGRE_STATIC_LIB)
    00107 #   ifdef OGRED3DENGINEDLL_EXPORTS
    00108 #       define _OgreD3D9Export __declspec(dllexport)
    00109 #   else
    00110 #       if defined( __MINGW32__ )
    00111 #           define _OgreD3D9Export
    00112 #       else
    00113 #           define _OgreD3D9Export __declspec(dllimport)
    00114 #       endif
    00115 #   endif
    00116 #else
    00117 #   define _OgreD3D9Export
    00118 #endif  // OGRE_WIN32
    00119 }
    00120 #endif

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:21