Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/RenderSystems/Direct3D9/include/OgreD3D9RenderWindow.h @ 1

Last change on this file since 1 was 1, checked in by landauf, 17 years ago
File size: 4.7 KB
Line 
1/*
2-----------------------------------------------------------------------------
3This source file is part of OGRE
4    (Object-oriented Graphics Rendering Engine)
5For the latest info, see http://www.ogre3d.org/
6
7Copyright (c) 2000-2006 Torus Knot Software Ltd
8Also see acknowledgements in Readme.html
9
10This program is free software; you can redistribute it and/or modify it under
11the terms of the GNU Lesser General Public License as published by the Free Software
12Foundation; either version 2 of the License, or (at your option) any later
13version.
14
15This program is distributed in the hope that it will be useful, but WITHOUT
16ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
17FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
18
19You should have received a copy of the GNU Lesser General Public License along with
20this program; if not, write to the Free Software Foundation, Inc., 59 Temple
21Place - Suite 330, Boston, MA 02111-1307, USA, or go to
22http://www.gnu.org/copyleft/lesser.txt.
23
24You may alternatively use this source under the terms of a specific version of
25the OGRE Unrestricted License provided you have obtained such a license from
26Torus Knot Software Ltd.
27-----------------------------------------------------------------------------
28*/
29#ifndef __D3D9RENDERWINDOW_H__
30#define __D3D9RENDERWINDOW_H__
31
32#include "OgreD3D9Prerequisites.h"
33#include "OgreRenderWindow.h"
34#include "OgreD3D9Driver.h"
35
36namespace Ogre
37{
38        class D3D9RenderWindow : public RenderWindow
39        {
40        public:
41                /** Constructor.
42                @param instance The application instance
43                @param driver The root driver
44                @param deviceIfSwapChain The existing D3D device to create an additional swap chain from, if this is not
45                        the first window.
46                */
47                D3D9RenderWindow(HINSTANCE instance, D3D9Driver *driver, LPDIRECT3DDEVICE9 deviceIfSwapChain = 0);
48                ~D3D9RenderWindow();
49                void create(const String& name, unsigned int width, unsigned int height,
50                    bool fullScreen, const NameValuePairList *miscParams);
51                void setFullscreen(bool fullScreen, unsigned int width, unsigned int height);
52                void destroy(void);
53                bool isVisible() const;
54                bool isClosed() const { return mClosed; }
55                void reposition(int left, int top);
56                void resize(unsigned int width, unsigned int height);
57                void swapBuffers( bool waitForVSync = true );
58                HWND getWindowHandle() const { return mHWnd; }
59
60                D3D9Driver* getDirectD3DDriver() { return mDriver; }
61                // changed to access driver member
62                LPDIRECT3DDEVICE9 getD3DDevice() { return mDriver->getD3DDevice(); }
63
64                void getCustomAttribute( const String& name, void* pData );
65                /** Overridden - see RenderTarget.
66                */
67                void writeContentsToFile(const String& filename);
68                bool requiresTextureFlipping() const { return false; }
69
70                // Method for dealing with resize / move & 3d library
71                void windowMovedOrResized();
72
73                /// Get the presentation parameters used with this window
74                D3DPRESENT_PARAMETERS* getPresentationParameters(void) 
75                { return &md3dpp; }
76
77                /// @copydoc RenderTarget::update
78                void update(bool swap);
79               
80                /** Create (or recreate) the D3D device or SwapChain for this window.
81                */
82                void createD3DResources();
83       
84                /** Destroy the D3D device or SwapChain for this window.
85                */
86                void destroyD3DResources();
87       
88                /// Accessor for render surface
89                LPDIRECT3DSURFACE9 getRenderSurface() { return mpRenderSurface; }
90
91                /// Are we in the middle of switching between fullscreen and windowed
92                bool _getSwitchingFullscreen() const { return mSwitchingFullscreen; }
93                /// Indicate that fullscreen / windowed switching has finished
94                void _finishSwitchingFullscreen();
95        protected:
96                HINSTANCE mInstance;                    // Process instance
97                D3D9Driver *mDriver;                    // D3D9 driver
98                HWND    mHWnd;                                  // Win32 Window handle
99                bool    mIsExternal;                    // window not created by Ogre
100                bool    mSizing;
101                bool    mClosed;
102                bool    mIsSwapChain;                   // Is this a secondary window?
103                bool    mSwitchingFullscreen;   // Are we switching from fullscreen to windowed or vice versa
104
105                // -------------------------------------------------------
106                // DirectX-specific
107                // -------------------------------------------------------
108
109                // Pointer to swap chain, only valid if mIsSwapChain
110                LPDIRECT3DSWAPCHAIN9 mpSwapChain;
111                D3DPRESENT_PARAMETERS md3dpp;
112                LPDIRECT3DSURFACE9 mpRenderSurface;
113                LPDIRECT3DSURFACE9 mpRenderZBuffer;
114                D3DMULTISAMPLE_TYPE mFSAAType;
115                DWORD mFSAAQuality;
116                UINT mDisplayFrequency;
117                bool mVSync;
118                bool mUseNVPerfHUD;
119
120                // just check if the multisampling requested is supported by the device
121                bool _checkMultiSampleQuality(D3DMULTISAMPLE_TYPE type, DWORD *outQuality, D3DFORMAT format, UINT adapterNum, D3DDEVTYPE deviceType, BOOL fullScreen);
122
123        };
124}
125#endif
Note: See TracBrowser for help on using the repository browser.