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-2005 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 #ifndef __D3D9RENDERWINDOW_H__ 00026 #define __D3D9RENDERWINDOW_H__ 00027 00028 #include "OgreD3D9Prerequisites.h" 00029 #include "OgreRenderWindow.h" 00030 #include "OgreD3D9Driver.h" 00031 00032 namespace Ogre 00033 { 00034 class D3D9RenderWindow : public RenderWindow 00035 { 00036 public: 00043 D3D9RenderWindow(HINSTANCE instance, D3D9Driver *driver, LPDIRECT3DDEVICE9 deviceIfSwapChain = 0); 00044 ~D3D9RenderWindow(); 00045 void create(const String& name, unsigned int width, unsigned int height, 00046 bool fullScreen, const NameValuePairList *miscParams); 00047 void destroy(void); 00048 bool isActive() const { return mActive; } 00049 bool isClosed() const { return mClosed; } 00050 void reposition( int left, int top ) {} 00051 void resize( unsigned int width, unsigned int height ); 00052 void swapBuffers( bool waitForVSync = true ); 00053 HWND getWindowHandle() const { return mHWnd; } 00054 00055 D3D9Driver* getDirectD3DDriver() { return mDriver; } 00056 // changed to access driver member 00057 LPDIRECT3DDEVICE9 getD3DDevice() { return mDriver->getD3DDevice(); } 00058 00059 void getCustomAttribute( const String& name, void* pData ); 00062 void writeContentsToFile(const String& filename); 00063 bool requiresTextureFlipping() const { return false; } 00064 00065 // Method for dealing with resize / move & 3d library 00066 virtual void WindowMovedOrResized(void); 00067 00068 bool isReady() const { return mReady; } 00069 void setReady(bool set) { mReady = set; } 00070 void setActive(bool set) { mActive = set; } 00072 D3DPRESENT_PARAMETERS* getPresentationParameters(void) 00073 { return &md3dpp; } 00075 void update(void); 00076 00079 void createD3DResources(void); 00080 00081 protected: 00082 HINSTANCE mInstance; // Process instance 00083 D3D9Driver *mDriver; // D3D9 driver 00084 HWND mHWnd; // Win32 Window handle 00085 bool mActive; // Is active i.e. visible 00086 bool mReady; // Is ready i.e. available for update 00087 bool mClosed; 00088 bool mIsSwapChain; // Is this a secondary window? 00089 00090 static LRESULT CALLBACK WndProc( 00091 HWND hWnd, 00092 UINT uMsg, 00093 WPARAM wParam, 00094 LPARAM lParam ); 00095 00096 // ------------------------------------------------------- 00097 // DirectX-specific 00098 // ------------------------------------------------------- 00099 00100 // Pointer to swap chain, only valid if mIsSwapChain 00101 LPDIRECT3DSWAPCHAIN9 mpSwapChain; 00102 D3DPRESENT_PARAMETERS md3dpp; 00103 LPDIRECT3DSURFACE9 mpRenderSurface; 00104 LPDIRECT3DSURFACE9 mpRenderZBuffer; 00105 D3DMULTISAMPLE_TYPE mFSAAType; 00106 DWORD mFSAAQuality; 00107 bool mVSync; 00108 00109 // just check if the multisampling requested is supported by the device 00110 bool _checkMultiSampleQuality(D3DMULTISAMPLE_TYPE type, DWORD *outQuality, D3DFORMAT format, UINT adapterNum, D3DDEVTYPE deviceType, BOOL fullScreen); 00111 00112 }; 00113 } 00114 #endif
Copyright © 2000-2005 by The OGRE Team
Last modified Sun Apr 10 23:21:14 2005