00001 00002 /* 00003 ----------------------------------------------------------------------------- 00004 This source file is part of OGRE 00005 (Object-oriented Graphics Rendering Engine) 00006 For the latest info, see http://www.ogre3d.org/ 00007 00008 Copyright (c) 2000-2012 Torus Knot Software Ltd 00009 00010 Permission is hereby granted, free of charge, to any person obtaining a copy 00011 of this software and associated documentation files (the "Software"), to deal 00012 in the Software without restriction, including without limitation the rights 00013 to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 00014 copies of the Software, and to permit persons to whom the Software is 00015 furnished to do so, subject to the following conditions: 00016 00017 The above copyright notice and this permission notice shall be included in 00018 all copies or substantial portions of the Software. 00019 00020 THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 00021 IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 00022 FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 00023 AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 00024 LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 00025 OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 00026 THE SOFTWARE. 00027 ----------------------------------------------------------------------------- 00028 */ 00029 #ifndef __D3D11RENDERWINDOW_H__ 00030 #define __D3D11RENDERWINDOW_H__ 00031 00032 #include "OgreD3D11Prerequisites.h" 00033 #include "OgreRenderWindow.h" 00034 00035 00036 namespace Ogre 00037 { 00038 class D3D11RenderWindow : public RenderWindow 00039 { 00040 public: 00047 D3D11RenderWindow(HINSTANCE instance, D3D11Device & device, IDXGIFactory1* pDXGIFactory); 00048 ~D3D11RenderWindow(); 00049 void create(const String& name, unsigned int width, unsigned int height, 00050 bool fullScreen, const NameValuePairList *miscParams); 00051 void setFullscreen(bool fullScreen, unsigned int width, unsigned int height); 00052 void destroy(void); 00053 bool isVisible() const; 00054 bool isClosed() const { return mClosed; } 00055 bool isHidden() const { return mHidden; } 00056 void setHidden(bool hidden); 00057 void reposition(int left, int top); 00058 void resize(unsigned int width, unsigned int height); 00059 void swapBuffers( bool waitForVSync = true ); 00060 HWND getWindowHandle() const; 00061 00062 void getCustomAttribute( const String& name, void* pData ); 00065 virtual void copyContentsToMemory(const PixelBox &dst, FrameBuffer buffer); 00066 bool requiresTextureFlipping() const; 00067 00068 // Method for dealing with resize / move & 3d library 00069 void windowMovedOrResized(); 00070 00072 DXGI_SWAP_CHAIN_DESC* getPresentationParameters(void); 00073 00075 void update(bool swap); 00076 00079 void createD3DResources(); 00080 00083 void destroyD3DResources(); 00084 00086 bool _getSwitchingFullscreen() const; 00088 void _finishSwitchingFullscreen(); 00089 00090 00091 protected: 00092 HINSTANCE mInstance; // Process instance 00093 D3D11Device & mDevice; // D3D11 driver 00094 IDXGIFactory1* mpDXGIFactory; 00095 HWND mHWnd; // Win32 Window handle 00096 bool mIsExternal; // window not created by Ogre 00097 bool mSizing; 00098 bool mClosed; 00099 bool mHidden; 00100 bool mIsSwapChain; // Is this a secondary window? 00101 bool mSwitchingFullscreen; // Are we switching from fullscreen to windowed or vice versa 00102 00103 // ------------------------------------------------------- 00104 // DirectX-specific 00105 // ------------------------------------------------------- 00106 00107 // Pointer to swap chain, only valid if mIsSwapChain 00108 IDXGISwapChain * mpSwapChain; 00109 DXGI_SWAP_CHAIN_DESC md3dpp; 00110 DXGI_SAMPLE_DESC mFSAAType; 00111 //DWORD mFSAAQuality; 00112 UINT mDisplayFrequency; 00113 bool mVSync; 00114 unsigned int mVSyncInterval; 00115 bool mUseNVPerfHUD; 00116 ID3D11RenderTargetView* mRenderTargetView; 00117 ID3D11DepthStencilView* mDepthStencilView; 00118 ID3D11Texture2D* mpBackBuffer; 00119 00120 // just check if the multisampling requested is supported by the device 00121 bool _checkMultiSampleQuality(UINT SampleCount, UINT *outQuality, DXGI_FORMAT format); 00122 00123 }; 00124 } 00125 #endif
Copyright © 2012 Torus Knot Software Ltd
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.
Last modified Sun Sep 2 2012 07:27:21