source: OGRE/trunk/ogrenew/RenderSystems/Direct3D9/include/OgreD3D9RenderWindow.h @ 692

Revision 692, 4.2 KB checked in by mattausch, 19 years ago (diff)

adding ogre 1.2 and dependencies

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-2005 The OGRE Team
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-----------------------------------------------------------------------------
24*/
25#ifndef __D3D9RENDERWINDOW_H__
26#define __D3D9RENDERWINDOW_H__
27
28#include "OgreD3D9Prerequisites.h"
29#include "OgreRenderWindow.h"
30#include "OgreD3D9Driver.h"
31
32namespace Ogre
33{
34        class D3D9RenderWindow : public RenderWindow
35        {
36        public:
37                /** Constructor.
38                @param instance The application instance
39                @param driver The root driver
40                @param deviceIfSwapChain The existing D3D device to create an additional swap chain from, if this is not
41                        the first window.
42                */
43                D3D9RenderWindow(HINSTANCE instance, D3D9Driver *driver, LPDIRECT3DDEVICE9 deviceIfSwapChain = 0);
44                ~D3D9RenderWindow();
45                void create(const String& name, unsigned int width, unsigned int height,
46                    bool fullScreen, const NameValuePairList *miscParams);
47                void destroy(void);
48                bool isVisible() const;
49                bool isClosed() const { return mClosed; }
50                void reposition(int left, int top);
51                void resize(unsigned int width, unsigned int height);
52                void swapBuffers( bool waitForVSync = true );
53                HWND getWindowHandle() const { return mHWnd; }
54
55                D3D9Driver* getDirectD3DDriver() { return mDriver; }
56                // changed to access driver member
57                LPDIRECT3DDEVICE9 getD3DDevice() { return mDriver->getD3DDevice(); }
58
59                void getCustomAttribute( const String& name, void* pData );
60                /** Overridden - see RenderTarget.
61                */
62                void writeContentsToFile(const String& filename);
63                bool requiresTextureFlipping() const { return false; }
64
65                // Method for dealing with resize / move & 3d library
66                void windowMovedOrResized();
67
68                /// Get the presentation parameters used with this window
69                D3DPRESENT_PARAMETERS* getPresentationParameters(void)
70                { return &md3dpp; }
71
72                /// @copydoc RenderTarget::update
73                void update(bool swap);
74
75                /** Create (or recreate) the D3D device or SwapChain for this window.
76                */
77                void createD3DResources();
78       
79                /** Destroy the D3D device or SwapChain for this window.
80                */
81                void destroyD3DResources();
82       
83                /// Accessor for render surface
84                LPDIRECT3DSURFACE9 getRenderSurface() { return mpRenderSurface; }
85        protected:
86                HINSTANCE mInstance;                    // Process instance
87                D3D9Driver *mDriver;                    // D3D9 driver
88                HWND    mHWnd;                                  // Win32 Window handle
89                bool    mIsExternal;                    // window not created by Ogre
90                bool    mSizing;
91                bool    mClosed;
92                bool    mIsSwapChain;                   // Is this a secondary window?
93
94                static LRESULT CALLBACK WndProc(
95                        HWND hWnd,
96                        UINT uMsg,
97                        WPARAM wParam,
98                        LPARAM lParam );
99
100                // -------------------------------------------------------
101                // DirectX-specific
102                // -------------------------------------------------------
103
104                // Pointer to swap chain, only valid if mIsSwapChain
105                LPDIRECT3DSWAPCHAIN9 mpSwapChain;
106                D3DPRESENT_PARAMETERS md3dpp;
107                LPDIRECT3DSURFACE9 mpRenderSurface;
108                LPDIRECT3DSURFACE9 mpRenderZBuffer;
109                D3DMULTISAMPLE_TYPE mFSAAType;
110                DWORD mFSAAQuality;
111                bool mVSync;
112                bool mUseNVPerfHUD;
113
114                // just check if the multisampling requested is supported by the device
115                bool _checkMultiSampleQuality(D3DMULTISAMPLE_TYPE type, DWORD *outQuality, D3DFORMAT format, UINT adapterNum, D3DDEVTYPE deviceType, BOOL fullScreen);
116
117        };
118}
119#endif
Note: See TracBrowser for help on using the repository browser.