OGRE  1.7
Object-Oriented Graphics Rendering Engine
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
OgreD3D10RenderWindow.h
Go to the documentation of this file.
1 /*
2 -----------------------------------------------------------------------------
3 This source file is part of OGRE
4 (Object-oriented Graphics Rendering Engine)
5 For the latest info, see http://www.ogre3d.org/
6 
7 Copyright (c) 2000-2011 Torus Knot Software Ltd
8 
9 Permission is hereby granted, free of charge, to any person obtaining a copy
10 of this software and associated documentation files (the "Software"), to deal
11 in the Software without restriction, including without limitation the rights
12 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 copies of the Software, and to permit persons to whom the Software is
14 furnished to do so, subject to the following conditions:
15 
16 The above copyright notice and this permission notice shall be included in
17 all copies or substantial portions of the Software.
18 
19 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 THE SOFTWARE.
26 -----------------------------------------------------------------------------
27 */
28 #ifndef __D3D10RENDERWINDOW_H__
29 #define __D3D10RENDERWINDOW_H__
30 
31 #include "OgreD3D10Prerequisites.h"
32 #include "OgreRenderWindow.h"
33 
34 
35 namespace Ogre
36 {
38  {
39  public:
46  D3D10RenderWindow(HINSTANCE instance, D3D10Device & device);
48  void create(const String& name, unsigned int width, unsigned int height,
49  bool fullScreen, const NameValuePairList *miscParams);
50  void setFullscreen(bool fullScreen, unsigned int width, unsigned int height);
51  void destroy(void);
52  bool isVisible() const;
53  bool isClosed() const { return mClosed; }
54  void reposition(int left, int top);
55  void resize(unsigned int width, unsigned int height);
56  void swapBuffers( bool waitForVSync = true );
57  HWND getWindowHandle() const;
58 
59  void getCustomAttribute( const String& name, void* pData );
62  virtual void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer);
63  bool requiresTextureFlipping() const;
64 
65  // Method for dealing with resize / move & 3d library
66  void windowMovedOrResized();
67 
69  DXGI_SWAP_CHAIN_DESC* getPresentationParameters(void);
70 
72  void update(bool swap);
73 
76  void createD3DResources();
77 
80  void destroyD3DResources();
81 
83  // IDXGISurface * getRenderSurface() { return mpRenderSurface; }
84 
86  bool _getSwitchingFullscreen() const;
89 
90 
91  protected:
92  HINSTANCE mInstance; // Process instance
93  D3D10Device & mDevice; // D3D10 driver
94  HWND mHWnd; // Win32 Window handle
95  bool mIsExternal; // window not created by Ogre
96  bool mSizing;
97  bool mClosed;
98  bool mIsSwapChain; // Is this a secondary window?
99  bool mSwitchingFullscreen; // Are we switching from fullscreen to windowed or vice versa
100 
101  // -------------------------------------------------------
102  // DirectX-specific
103  // -------------------------------------------------------
104 
105  // Pointer to swap chain, only valid if mIsSwapChain
106  IDXGISwapChain * mpSwapChain;
107  DXGI_SWAP_CHAIN_DESC md3dpp;
108  // IDXGISurface * mpRenderSurface;
109  // IDXGISurface * mpRenderZBuffer;
110  DXGI_SAMPLE_DESC mFSAAType;
111  //DWORD mFSAAQuality;
113  bool mVSync;
114  unsigned int mVSyncInterval;
116  ID3D10RenderTargetView* mRenderTargetView;
117  ID3D10DepthStencilView* mDepthStencilView;
118  ID3D10Texture2D* mpBackBuffer;
119 
120  // just check if the multisampling requested is supported by the device
121  bool _checkMultiSampleQuality(UINT SampleCount, UINT *outQuality, DXGI_FORMAT format);
122 
123  };
124 }
125 #endif
Manages the target rendering window.
void windowMovedOrResized()
Notify that the window has been resized.
map< String, String >::type NameValuePairList
Name / value parameter pair (first = name, second = value)
Definition: OgreCommon.h:524
void destroy(void)
Destroys the window.
void destroyD3DResources()
Destroy the D3D device or SwapChain for this window.
void create(const String &name, unsigned int width, unsigned int height, bool fullScreen, const NameValuePairList *miscParams)
Creates & displays the new window.
HWND getWindowHandle() const
bool _checkMultiSampleQuality(UINT SampleCount, UINT *outQuality, DXGI_FORMAT format)
D3D10RenderWindow(HINSTANCE instance, D3D10Device &device)
Constructor.
void update(bool swap)
Tells the target to update it's contents.
void resize(unsigned int width, unsigned int height)
Alter the size of the window.
bool isClosed() const
Indicates whether the window has been closed by the user.
void swapBuffers(bool waitForVSync=true)
Swaps the frame buffers to display the next frame.
DXGI_SWAP_CHAIN_DESC md3dpp
virtual void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer)
Overridden - see RenderTarget.
void getCustomAttribute(const String &name, void *pData)
Gets a custom (maybe platform-specific) attribute.
bool _getSwitchingFullscreen() const
Accessor for render surface.
DXGI_SWAP_CHAIN_DESC * getPresentationParameters(void)
Get the presentation parameters used with this window.
ID3D10RenderTargetView * mRenderTargetView
void reposition(int left, int top)
Reposition the window.
ID3D10DepthStencilView * mDepthStencilView
_StringBase String
bool isVisible() const
Indicates whether the window is visible (not minimized or obscured)
bool requiresTextureFlipping() const
A primitive describing a volume (3D), image (2D) or line (1D) of pixels in memory.
void createD3DResources()
Create (or recreate) the D3D device or SwapChain for this window.
void setFullscreen(bool fullScreen, unsigned int width, unsigned int height)
Alter fullscreen mode options.
void _finishSwitchingFullscreen()
Indicate that fullscreen / windowed switching has finished.