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 © 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 namespace Ogre 00034 { 00036 class _OgreD3DExport D3DDevice 00037 { 00038 00039 00040 private: 00041 String mDeviceName; 00042 String mDeviceDescription; 00043 D3DDEVICEDESC7 mD3DDeviceDesc; 00044 bool mIsHardwareAccelerated; 00045 bool mNeedsZBuffer; 00046 std::vector<DDPIXELFORMAT> mDepthBufferFormats; 00047 ushort mStencilBufferDepth; 00048 00049 00050 00051 LPDIRECT3D7 lpD3D; 00052 D3DVIEWPORT7 mViewport; 00053 D3DRECT rcViewportRect; 00054 00055 DDDriver* mParentDriver; 00056 00057 // Private functions 00058 void createViewport(void); 00059 void setViewportSize(void); 00060 00061 00062 00063 00064 public: 00065 // Constructors 00066 D3DDevice(); // Default 00067 D3DDevice(const D3DDevice &ob); // Copy 00068 D3DDevice(LPDIRECT3D7 lpDirect3D, LPSTR lpDeviceDesc, LPSTR lpDeviceName, 00069 LPD3DDEVICEDESC7 lpD3DDeviceDesc); 00070 ~D3DDevice(); 00071 void Cleanup(void); 00072 void logCaps(void) const; 00073 00075 LPDIRECT3DDEVICE7 createDevice(LPDIRECTDRAWSURFACE7 renderTarget); 00076 LPDIRECT3D7 getID3D(void); 00077 00078 // Overloaded operator = 00079 D3DDevice operator=(const D3DDevice &orig); 00080 00081 // Information accessors 00082 String DeviceName(void) const; 00083 String DeviceDescription(void) const; 00084 bool HardwareAccelerated(void) const; 00085 bool NeedsZBuffer(void) const; 00086 00087 void createDepthBuffer(LPDIRECTDRAWSURFACE7 renderTarget); 00088 00089 00090 void setViewMatrix(D3DMATRIX *mat); 00091 void setProjectionMatrix(D3DMATRIX *mat); 00092 void setWorldMatrix(D3DMATRIX *mat); 00093 00094 void beginScene(void); 00095 void endScene(void); 00096 void setAmbientLight(float r, float g, float b); 00097 00098 00099 00100 friend static HRESULT CALLBACK EnumZBuffersCallback(DDPIXELFORMAT* pddpf, 00101 VOID* pFormats); 00102 00103 00104 // Capability access 00105 bool CanMipMap(void) const; 00106 bool CanBilinearFilter(void) const; 00107 bool CanTrilinearFilter(void) const; 00108 unsigned int RenderBitDepth(void) const; 00109 unsigned int ZBufferBitDepth(void) const; 00110 bool CanHWTransformAndLight(void) const; 00111 unsigned int MaxSinglePassTextureLayers(void) const; 00112 ushort StencilBufferBitDepth(void) const; 00113 00114 00115 00116 00117 00118 00119 }; 00120 } // Namespace Ogre 00121 #endif
Copyright © 2002-2003 by The OGRE Team
Last modified Fri May 14 23:21:58 2004