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 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         LPDIRECT3DDEVICE9 getD3DDevice() { return mpD3DDevice; }
00057 
00058         void getCustomAttribute( const String& name, void* pData );
00061         void writeContentsToFile(const String& filename);
00062         bool requiresTextureFlipping() const { return false; }
00063 
00064         // Method for dealing with resize / move & 3d library
00065         virtual void WindowMovedOrResized(void);
00066 
00067         bool isReady() const { return mReady; }
00068         void setReady(bool set) { mReady = set; }
00069         void setActive(bool set) { mActive = set; }
00071         D3DPRESENT_PARAMETERS* getPresentationParameters(void) 
00072         { return &md3dpp; }
00074         void update(void);
00075 
00078         void createD3DResources(void);
00079     
00080     protected:
00081         HINSTANCE mInstance;            // Process instance
00082         D3D9Driver *mDriver;            // D3D9 driver
00083         HWND    mHWnd;                  // Win32 Window handle
00084         bool    mActive;                // Is active i.e. visible
00085         bool    mReady;                 // Is ready i.e. available for update
00086         bool    mClosed;
00087         bool    mIsSwapChain;           // Is this a secondary window?
00088 
00089         static LRESULT CALLBACK WndProc(
00090             HWND hWnd,
00091             UINT uMsg,
00092             WPARAM wParam,
00093             LPARAM lParam );
00094 
00095         // -------------------------------------------------------
00096         // DirectX-specific
00097         // -------------------------------------------------------
00098 
00099         // Pointer to the 3D device - window 'owns' this if !mIsSwapChain
00100         LPDIRECT3DDEVICE9   mpD3DDevice;
00101         // Pointer to swap chain, only valid if mIsSwapChain
00102         LPDIRECT3DSWAPCHAIN9 mpSwapChain;
00103         D3DPRESENT_PARAMETERS md3dpp;
00104         LPDIRECT3DSURFACE9 mpRenderSurface;
00105         LPDIRECT3DSURFACE9 mpRenderZBuffer;
00106         D3DMULTISAMPLE_TYPE mFSAAType;
00107         DWORD mFSAAQuality;
00108         bool mVSync;
00109 
00110         // just check if the multisampling requested is supported by the device
00111         bool _checkMultiSampleQuality(D3DMULTISAMPLE_TYPE type, DWORD *outQuality, D3DFORMAT format, UINT adapterNum, D3DDEVTYPE deviceType, BOOL fullScreen);
00112 
00113     };
00114 }
00115 #endif

Copyright © 2000-2005 by The OGRE Team
Last modified Wed Feb 23 00:19:05 2005