00001 /* 00002 ----------------------------------------------------------------------------- 00003 This source file is part of OGRE 00004 (Object-oriented Graphics Rendering Engine) 00005 For the latest info, see http://ogre.sourceforge.net/ 00006 00007 Copyright © 2000-2002 The OGRE Team 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 */ 00025 #define D3D_OVERLOADS 00026 00027 #ifndef __D3DDEVICE_H_ 00028 #define __D3DDEVICE_H_ 00029 00030 // Precompiler options 00031 #include "OgreD3D7Prerequisites.h" 00032 00033 #include <ddraw.h> 00034 #include <d3d.h> 00035 00036 namespace Ogre 00037 { 00039 class _OgreD3DExport D3DDevice 00040 { 00041 00042 00043 private: 00044 String mDeviceName; 00045 String mDeviceDescription; 00046 D3DDEVICEDESC7 mD3DDeviceDesc; 00047 bool mIsHardwareAccelerated; 00048 bool mNeedsZBuffer; 00049 std::vector<DDPIXELFORMAT> mDepthBufferFormats; 00050 ushort mStencilBufferDepth; 00051 00052 00053 00054 LPDIRECT3D7 lpD3D; 00055 D3DVIEWPORT7 mViewport; 00056 D3DRECT rcViewportRect; 00057 00058 DDDriver* mParentDriver; 00059 00060 // Private functions 00061 void createViewport(void); 00062 void setViewportSize(void); 00063 00064 00065 00066 00067 public: 00068 // Constructors 00069 D3DDevice(); // Default 00070 D3DDevice(const D3DDevice &ob); // Copy 00071 D3DDevice(LPDIRECT3D7 lpDirect3D, LPSTR lpDeviceDesc, LPSTR lpDeviceName, 00072 LPD3DDEVICEDESC7 lpD3DDeviceDesc); 00073 ~D3DDevice(); 00074 void Cleanup(void); 00075 void logCaps(void); 00076 00078 LPDIRECT3DDEVICE7 createDevice(LPDIRECTDRAWSURFACE7 renderTarget); 00079 LPDIRECT3D7 getID3D(void); 00080 00081 // Overloaded operator = 00082 D3DDevice operator=(const D3DDevice &orig); 00083 00084 // Information accessors 00085 String DeviceName(void); 00086 String DeviceDescription(void); 00087 bool HardwareAccelerated(void); 00088 bool NeedsZBuffer(void); 00089 00090 void createDepthBuffer(LPDIRECTDRAWSURFACE7 renderTarget); 00091 00092 00093 void setViewMatrix(D3DMATRIX *mat); 00094 void setProjectionMatrix(D3DMATRIX *mat); 00095 void setWorldMatrix(D3DMATRIX *mat); 00096 00097 void beginScene(void); 00098 void endScene(void); 00099 void setAmbientLight(float r, float g, float b); 00100 00101 00102 00103 friend static HRESULT CALLBACK EnumZBuffersCallback(DDPIXELFORMAT* pddpf, 00104 VOID* pFormats); 00105 00106 00107 // Capability access 00108 bool CanMipMap(void); 00109 bool CanBilinearFilter(void); 00110 bool CanTrilinearFilter(void); 00111 int RenderBitDepth(void); 00112 int ZBufferBitDepth(void); 00113 bool CanHWTransformAndLight(void); 00114 int MaxSinglePassTextureLayers(void); 00115 ushort StencilBufferBitDepth(void); 00116 00117 00118 00119 00120 00121 00122 }; 00123 } // Namespace Ogre 00124 #endif
Copyright © 2002 by The OGRE Team