Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

OgreD3D9RenderWindow.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-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 isVisible() const;
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         void windowMovedOrResized();
00067 
00069         D3DPRESENT_PARAMETERS* getPresentationParameters(void) 
00070         { return &md3dpp; }
00071 
00073         void update(bool swap);
00074 
00077         void createD3DResources();
00078     
00081         void destroyD3DResources();
00082     
00084         LPDIRECT3DSURFACE9 getRenderSurface() { return mpRenderSurface; }
00085     protected:
00086         HINSTANCE mInstance;            // Process instance
00087         D3D9Driver *mDriver;            // D3D9 driver
00088         HWND    mHWnd;                  // Win32 Window handle
00089         bool    mIsExternal;            // window not created by Ogre
00090         bool    mSizing;
00091         bool    mClosed;
00092         bool    mIsSwapChain;           // Is this a secondary window?
00093 
00094         static LRESULT CALLBACK WndProc(
00095             HWND hWnd,
00096             UINT uMsg,
00097             WPARAM wParam,
00098             LPARAM lParam );
00099 
00100         // -------------------------------------------------------
00101         // DirectX-specific
00102         // -------------------------------------------------------
00103 
00104         // Pointer to swap chain, only valid if mIsSwapChain
00105         LPDIRECT3DSWAPCHAIN9 mpSwapChain;
00106         D3DPRESENT_PARAMETERS md3dpp;
00107         LPDIRECT3DSURFACE9 mpRenderSurface;
00108         LPDIRECT3DSURFACE9 mpRenderZBuffer;
00109         D3DMULTISAMPLE_TYPE mFSAAType;
00110         DWORD mFSAAQuality;
00111         bool mVSync;
00112         bool mUseNVPerfHUD;
00113 
00114         // just check if the multisampling requested is supported by the device
00115         bool _checkMultiSampleQuality(D3DMULTISAMPLE_TYPE type, DWORD *outQuality, D3DFORMAT format, UINT adapterNum, D3DDEVTYPE deviceType, BOOL fullScreen);
00116 
00117     };
00118 }
00119 #endif

Copyright © 2000-2005 by The OGRE Team
Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 2.5 License.
Last modified Sun Mar 12 14:37:39 2006