source: OGRE/trunk/ogre_changes/RenderSystems/Direct3D9/include/OgreD3D9RenderWindow.h @ 193

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

changed to ogre 103
added readme

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#ifdef GTP_VISIBILITY_MODIFIED_OGRE
68                uchar *getBufferContents(int &dimx, int &dimy);
69#endif // GTP_VISIBILITY_MODIFIED_OGRE
70
71                /// Get the presentation parameters used with this window
72                D3DPRESENT_PARAMETERS* getPresentationParameters(void)
73                { return &md3dpp; }
74
75                /// @copydoc RenderTarget::update
76                void update();
77
78                /** Create (or recreate) the D3D device or SwapChain for this window.
79                */
80                void createD3DResources();
81       
82                /** Destroy the D3D device or SwapChain for this window.
83                */
84                void destroyD3DResources();
85       
86        protected:
87                HINSTANCE mInstance;                    // Process instance
88                D3D9Driver *mDriver;                    // D3D9 driver
89                HWND    mHWnd;                                  // Win32 Window handle
90                bool    mIsExternal;                    // window not created by Ogre
91                bool    mSizing;
92                bool    mClosed;
93                bool    mIsSwapChain;                   // Is this a secondary window?
94
95                static LRESULT CALLBACK WndProc(
96                        HWND hWnd,
97                        UINT uMsg,
98                        WPARAM wParam,
99                        LPARAM lParam );
100
101                // -------------------------------------------------------
102                // DirectX-specific
103                // -------------------------------------------------------
104
105                // Pointer to swap chain, only valid if mIsSwapChain
106                LPDIRECT3DSWAPCHAIN9 mpSwapChain;
107                D3DPRESENT_PARAMETERS md3dpp;
108                LPDIRECT3DSURFACE9 mpRenderSurface;
109                LPDIRECT3DSURFACE9 mpRenderZBuffer;
110                D3DMULTISAMPLE_TYPE mFSAAType;
111                DWORD mFSAAQuality;
112                bool mVSync;
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.