Browse Source

Modified window creation parameters so they're more intuitive

Marko Pintera 13 năm trước cách đây
mục cha
commit
afc811967c
26 tập tin đã thay đổi với 470 bổ sung787 xóa
  1. 4 4
      CamelotD3D11RenderSystem/CamelotD3D11RenderSystem.vcxproj
  2. 28 28
      CamelotD3D11RenderSystem/Include/CmD3D11Driver.h
  3. 2 2
      CamelotD3D11RenderSystem/Include/CmD3D11DriverList.h
  4. 30 4
      CamelotD3D11RenderSystem/Include/CmD3D11RenderSystem.h
  5. 1 2
      CamelotD3D11RenderSystem/Include/CmD3D11RenderWindow.h
  6. 1 0
      CamelotD3D11RenderSystem/Source/CmD3D11Device.cpp
  7. 4 4
      CamelotD3D11RenderSystem/Source/CmD3D11DriverList.cpp
  8. 182 114
      CamelotD3D11RenderSystem/Source/CmD3D11RenderSystem.cpp
  9. 26 99
      CamelotD3D11RenderSystem/Source/CmD3D11RenderWindow.cpp
  10. 1 2
      CamelotD3D9Renderer/Include/CmD3D9RenderWindow.h
  11. 1 2
      CamelotD3D9Renderer/Include/CmD3D9RenderWindowManager.h
  12. 42 121
      CamelotD3D9Renderer/Source/CmD3D9RenderWindow.cpp
  13. 2 3
      CamelotD3D9Renderer/Source/CmD3D9RenderWindowManager.cpp
  14. 7 6
      CamelotGLRenderer/Include/CmGLRenderSystem.h
  15. 1 2
      CamelotGLRenderer/Include/CmGLRenderWindowManager.h
  16. 1 2
      CamelotGLRenderer/Include/CmGLSupport.h
  17. 1 2
      CamelotGLRenderer/Include/CmWin32GLSupport.h
  18. 1 2
      CamelotGLRenderer/Include/CmWin32Window.h
  19. 2 3
      CamelotGLRenderer/Source/CmGLRenderWindowManager.cpp
  20. 25 45
      CamelotGLRenderer/Source/CmWin32GLSupport.cpp
  21. 55 113
      CamelotGLRenderer/Source/CmWin32Window.cpp
  22. 37 25
      CamelotRenderer/Include/CmRenderWindow.h
  23. 5 190
      CamelotRenderer/Include/CmRenderWindowManager.h
  24. 7 1
      CamelotRenderer/Source/CmApplication.cpp
  25. 2 2
      CamelotRenderer/Source/CmRenderWindow.cpp
  26. 2 9
      CamelotRenderer/Source/CmRenderWindowManager.cpp

+ 4 - 4
CamelotD3D11RenderSystem/CamelotD3D11RenderSystem.vcxproj

@@ -90,7 +90,7 @@
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>dxguid.lib;D3DCompiler.lib;CamelotRenderer.lib;CamelotUtility.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>d3d11.lib;dxgi.lib;dxguid.lib;D3DCompiler.lib;CamelotRenderer.lib;CamelotUtility.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;..\lib\$(Configuration);..\Dependencies\lib\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <ImportLibrary>..\lib\$(Configuration)\$(TargetName).lib</ImportLibrary>
     </Link>
@@ -104,7 +104,7 @@
     </ClCompile>
     <Link>
       <GenerateDebugInformation>true</GenerateDebugInformation>
-      <AdditionalDependencies>dxguid.lib;D3DCompiler.lib;CamelotRenderer.lib;CamelotUtility.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>d3d11.lib;dxgi.lib;dxguid.lib;D3DCompiler.lib;CamelotRenderer.lib;CamelotUtility.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;..\lib\$(Platform)\$(Configuration);..\Dependencies\lib\x64\Debug;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <ImportLibrary>..\lib\$(Platform)\$(Configuration)\$(TargetName).lib</ImportLibrary>
     </Link>
@@ -122,7 +122,7 @@
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>dxguid.lib;D3DCompiler.lib;CamelotRenderer.lib;CamelotUtility.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>d3d11.lib;dxgi.lib;dxguid.lib;D3DCompiler.lib;CamelotRenderer.lib;CamelotUtility.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x86;..\lib\$(Configuration);..\Dependencies\lib\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <ImportLibrary>..\lib\$(Configuration)\$(TargetName).lib</ImportLibrary>
     </Link>
@@ -140,7 +140,7 @@
       <GenerateDebugInformation>true</GenerateDebugInformation>
       <EnableCOMDATFolding>true</EnableCOMDATFolding>
       <OptimizeReferences>true</OptimizeReferences>
-      <AdditionalDependencies>dxguid.lib;D3DCompiler.lib;CamelotRenderer.lib;CamelotUtility.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <AdditionalDependencies>d3d11.lib;dxgi.lib;dxguid.lib;D3DCompiler.lib;CamelotRenderer.lib;CamelotUtility.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
       <AdditionalLibraryDirectories>C:\Program Files %28x86%29\Microsoft DirectX SDK %28June 2010%29\Lib\x64;..\lib\$(Platform)\$(Configuration);..\Dependencies\lib\x64\Release;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
       <ImportLibrary>..\lib\$(Platform)\$(Configuration)\$(TargetName).lib</ImportLibrary>
     </Link>

+ 28 - 28
CamelotD3D11RenderSystem/Include/CmD3D11Driver.h

@@ -4,33 +4,33 @@
 
 namespace CamelotEngine
 {
-	class D3D11Driver
-	{
-	public:
-		D3D11Driver(const D3D11Driver &ob);
-		D3D11Driver(UINT32 adapterNumber, IDXGIAdapter* dxgiAdapter);
-		~D3D11Driver();
-
-		D3D11Driver& operator=(const D3D11Driver& r);
-
-		String getDriverName() const;
-		String getDriverDescription() const;
-		UINT32 getAdapterNumber() const { return mAdapterNumber; }
-		UINT32 getNumAdapterOutputs() const;
-		const DXGI_ADAPTER_DESC& getAdapterIdentifier() const { return mAdapterIdentifier; }
-		const DXGI_MODE_DESC& getDesktopMode() const { return mDesktopDisplayMode; }
-		IDXGIAdapter* getDeviceAdapter() { return mDXGIAdapter; }
-		const D3D11VideoModeList* getVideoModeList(UINT32 adapterOutputIdx) const;
-
-	private:
-		// D3D only allows one device per adapter, so it can safely be stored here as well.
-		UINT32					mAdapterNumber;
-		UINT32					mNumOutputs;
-		DXGI_ADAPTER_DESC		mAdapterIdentifier;
-		DXGI_MODE_DESC			mDesktopDisplayMode;
-		D3D11VideoModeList**	mVideoModeList;
-		IDXGIAdapter*			mDXGIAdapter;
-
-		void init();
+	class D3D11Driver
+	{
+	public:
+		D3D11Driver(const D3D11Driver &ob);
+		D3D11Driver(UINT32 adapterNumber, IDXGIAdapter* dxgiAdapter);
+		~D3D11Driver();
+
+		D3D11Driver& operator=(const D3D11Driver& r);
+
+		String getDriverName() const;
+		String getDriverDescription() const;
+		UINT32 getAdapterNumber() const { return mAdapterNumber; }
+		UINT32 getNumAdapterOutputs() const;
+		const DXGI_ADAPTER_DESC& getAdapterIdentifier() const { return mAdapterIdentifier; }
+		const DXGI_MODE_DESC& getDesktopMode() const { return mDesktopDisplayMode; }
+		IDXGIAdapter* getDeviceAdapter() { return mDXGIAdapter; }
+		const D3D11VideoModeList* getVideoModeList(UINT32 adapterOutputIdx) const;
+
+	private:
+		// D3D only allows one device per adapter, so it can safely be stored here as well.
+		UINT32					mAdapterNumber;
+		UINT32					mNumOutputs;
+		DXGI_ADAPTER_DESC		mAdapterIdentifier;
+		DXGI_MODE_DESC			mDesktopDisplayMode;
+		D3D11VideoModeList**	mVideoModeList;
+		IDXGIAdapter*			mDXGIAdapter;
+
+		void init();
 	};
 }

+ 2 - 2
CamelotD3D11RenderSystem/Include/CmD3D11DriverList.h

@@ -12,8 +12,8 @@ namespace CamelotEngine
 
 		UINT32 count() const;
 
-		const D3D11Driver& item(UINT32 idx) const;
-		const D3D11Driver& item(const String &name) const;
+		D3D11Driver* item(UINT32 idx) const;
+		D3D11Driver* item(const String &name) const;
 
 	private:
 		vector<D3D11Driver*>::type mDriverList;

+ 30 - 4
CamelotD3D11RenderSystem/Include/CmD3D11RenderSystem.h

@@ -8,10 +8,7 @@ namespace CamelotEngine
 	class CM_D3D11_EXPORT D3D11RenderSystem : public RenderSystem
 	{
 	public:
-		static D3D11Device& getPrimaryDevice();
-
-		void determineFSAASettings(UINT32 fsaa, const String& fsaaHint, DXGI_FORMAT format, DXGI_SAMPLE_DESC* outFSAASettings);
-		bool checkTextureFilteringSupported(TextureType ttype, PixelFormat format, int usage);
+		~D3D11RenderSystem();
 
 		const String& getName() const;
 
@@ -53,8 +50,37 @@ namespace CamelotEngine
 		float getVerticalTexelOffset();
 		float getMinimumDepthInputValue();
 		float getMaximumDepthInputValue();
+
+		/************************************************************************/
+		/* 				Internal use by DX11 RenderSystem only                  */
+		/************************************************************************/
+
+		void determineFSAASettings(UINT32 fsaa, const String& fsaaHint, DXGI_FORMAT format, DXGI_SAMPLE_DESC* outFSAASettings);
+		bool checkTextureFilteringSupported(TextureType ttype, PixelFormat format, int usage);
+
+		static D3D11Device& getPrimaryDevice();
+
 	protected:
+		friend class D3D11RenderSystemFactory;
+		D3D11RenderSystem();
+
+		/**
+		 * @copydoc	RenderSystem::initialize_internal().
+		 */
+		void initialize_internal();
+
+		/**
+		 * @copydoc	RenderSystem::destroy_internal().
+		 */
+        void destroy_internal();
 
 	private:
+		IDXGIFactory*		mDXGIFactory;
+		D3D11Device*		mDevice;
+
+		D3D11DriverList*	mDriverList;
+		D3D11Driver*		mActiveD3DDriver;
+
+		D3D_FEATURE_LEVEL	mFeatureLevel;
 	};
 }

+ 1 - 2
CamelotD3D11RenderSystem/Include/CmD3D11RenderWindow.h

@@ -11,8 +11,7 @@ namespace CamelotEngine
 		D3D11RenderWindow(D3D11Device& device, IDXGIFactory* DXGIFactory);
 		~D3D11RenderWindow();
 
-		void initialize(const String& name, unsigned width, unsigned height, bool fullScreen, 
-			const NameValuePairList* miscParams);
+		void initialize(const RENDER_WINDOW_DESC& desc);
 		void destroy(void);
 
 		void reposition(int left, int top);

+ 1 - 0
CamelotD3D11RenderSystem/Source/CmD3D11Device.cpp

@@ -39,6 +39,7 @@ namespace CamelotEngine
 
 	D3D11Device::~D3D11Device()
 	{
+		shutdown();
 	}
 
 	void D3D11Device::shutdown()

+ 4 - 4
CamelotD3D11RenderSystem/Source/CmD3D11DriverList.cpp

@@ -45,17 +45,17 @@ namespace CamelotEngine
 		return (UINT32)mDriverList.size();
 	}
 
-	const D3D11Driver& D3D11DriverList::item(UINT32 idx) const
+	D3D11Driver* D3D11DriverList::item(UINT32 idx) const
 	{
-		return *mDriverList.at(idx);
+		return mDriverList.at(idx);
 	}
 
-	const D3D11Driver& D3D11DriverList::item(const String &name) const
+	D3D11Driver* D3D11DriverList::item(const String &name) const
 	{
 		for (auto it = mDriverList.begin(); it != mDriverList.end(); ++it)
 		{
 			if ((*it)->getDriverDescription() == name)
-				return *(*it);
+				return (*it);
 		}
 
 		CM_EXCEPT(InvalidParametersException, "Cannot find video mode with the specified name.");

+ 182 - 114
CamelotD3D11RenderSystem/Source/CmD3D11RenderSystem.cpp

@@ -1,127 +1,23 @@
 #include "CmD3D11RenderSystem.h"
+#include "CmD3D11DriverList.h"
+#include "CmD3D11Driver.h"
+#include "CmD3D11Device.h"
 #include "CmRenderSystem.h"
 #include "CmDebug.h"
 #include "CmException.h"
 
 namespace CamelotEngine
 {
-	D3D11Device& D3D11RenderSystem::getPrimaryDevice() 
-	{ 
-		CM_EXCEPT(NotImplementedException, "Not implemented"); 
-	}
-
-	void D3D11RenderSystem::determineFSAASettings(UINT32 fsaa, const String& fsaaHint, DXGI_FORMAT format, DXGI_SAMPLE_DESC* outFSAASettings)
+	D3D11RenderSystem::D3D11RenderSystem()
+		: mDXGIFactory(nullptr), mDevice(nullptr), mDriverList(nullptr)
+		, mActiveD3DDriver(nullptr), mFeatureLevel(D3D_FEATURE_LEVEL_9_1)
 	{
-		CM_EXCEPT(NotImplementedException, "Not implemented");
 
-		/*
-		bool ok = false;
-		bool qualityHint = fsaaHint.find("Quality") != String::npos;
-		size_t origFSAA = fsaa;
-		bool tryCSAA = false;
-		// NVIDIA, prefer CSAA if available for 8+
-		// it would be tempting to use getCapabilities()->getVendor() == GPU_NVIDIA but
-		// if this is the first window, caps will not be initialised yet
-		
-		if (mActiveD3DDriver->getAdapterIdentifier().VendorId == 0x10DE && 
-			fsaa >= 8)
-		{
-			tryCSAA	 = true;
-		}
-
-		while (!ok)
-		{
-			// Deal with special cases
-			if (tryCSAA)
-			{
-				// see http://developer.nvidia.com/object/coverage-sampled-aa.html
-				switch(fsaa)
-				{
-				case 8:
-					if (qualityHint)
-					{
-						outFSAASettings->Count = 8;
-						outFSAASettings->Quality = 8;
-					}
-					else
-					{
-						outFSAASettings->Count = 4;
-						outFSAASettings->Quality = 8;
-					}
-					break;
-				case 16:
-					if (qualityHint)
-					{
-						outFSAASettings->Count = 8;
-						outFSAASettings->Quality = 16;
-					}
-					else
-					{
-						outFSAASettings->Count = 4;
-						outFSAASettings->Quality = 16;
-					}
-					break;
-				}
-			}
-			else // !CSAA
-			{
-				outFSAASettings->Count = fsaa == 0 ? 1 : fsaa;
-				outFSAASettings->Quality = 0;
-			}
-
-
-			HRESULT hr;
-			UINT outQuality;
-			hr = mDevice->CheckMultisampleQualityLevels( 
-				format, 
-				outFSAASettings->Count, 
-				&outQuality);
-
-			if (SUCCEEDED(hr) && (!tryCSAA || outQuality > outFSAASettings->Quality))
-			{
-				ok = true;
-			}
-			else
-			{
-				// downgrade
-				if (tryCSAA && fsaa == 8)
-				{
-					// for CSAA, we'll try downgrading with quality mode at all samples.
-					// then try without quality, then drop CSAA
-					if (qualityHint)
-					{
-						// drop quality first
-						qualityHint = false;
-					}
-					else
-					{
-						// drop CSAA entirely 
-						tryCSAA = false;
-					}
-					// return to original requested samples
-					fsaa = static_cast<UINT32>(origFSAA);
-				}
-				else
-				{
-					// drop samples
-					--fsaa;
-
-					if (fsaa == 1)
-					{
-						// ran out of options, no FSAA
-						fsaa = 0;
-						ok = true;
-					}
-				}
-			}
-
-		} // while !ok
-		*/
 	}
-
-	bool D3D11RenderSystem::checkTextureFilteringSupported(TextureType ttype, PixelFormat format, int usage)
-	{
-		return true;
+
+	D3D11RenderSystem::~D3D11RenderSystem()
+	{
+		destroy_internal();
 	}
 
 	const String& D3D11RenderSystem::getName() const
@@ -130,6 +26,59 @@ namespace CamelotEngine
 		return strName;
 	}
 
+	void D3D11RenderSystem::initialize_internal()
+	{
+		HRESULT hr = CreateDXGIFactory(__uuidof(IDXGIFactory), (void**)&mDXGIFactory);
+		if(FAILED(hr))
+			CM_EXCEPT(RenderingAPIException, "Failed to create Direct3D11 DXGIFactory");
+
+		mDriverList = new D3D11DriverList(mDXGIFactory);
+		mActiveD3DDriver = mDriverList->item(0); // TODO: Always get first driver, for now
+
+		IDXGIAdapter* selectedAdapter = mActiveD3DDriver->getDeviceAdapter();
+
+		D3D_FEATURE_LEVEL requestedLevels[] = {
+			D3D_FEATURE_LEVEL_11_0,
+			D3D_FEATURE_LEVEL_10_1,
+			D3D_FEATURE_LEVEL_10_0,
+			D3D_FEATURE_LEVEL_9_3,
+			D3D_FEATURE_LEVEL_9_2,
+			D3D_FEATURE_LEVEL_9_1
+		};
+
+		UINT32 numRequestedLevel = sizeof(requestedLevels) / sizeof(requestedLevels[0]);
+
+		ID3D11Device* device;
+		hr = D3D11CreateDevice(selectedAdapter, D3D_DRIVER_TYPE_HARDWARE, nullptr, 0, 
+			requestedLevels, numRequestedLevel, D3D11_SDK_VERSION, &device, &mFeatureLevel, 0);
+
+		if(FAILED(hr))         
+			CM_EXCEPT(RenderingAPIException, "Failed to create Direct3D11 object. D3D11CreateDeviceN returned this error code: " + toString(hr));
+
+		mDevice = new D3D11Device(device);
+
+		LARGE_INTEGER driverVersion;
+		if(SUCCEEDED(selectedAdapter->CheckInterfaceSupport(IID_ID3D10Device /* intentionally D3D10, not D3D11 */, &driverVersion)))
+		{
+			mDriverVersion.major = HIWORD(driverVersion.HighPart);
+			mDriverVersion.minor = LOWORD(driverVersion.HighPart);
+			mDriverVersion.release = HIWORD(driverVersion.LowPart);
+			mDriverVersion.build = LOWORD(driverVersion.LowPart);
+		}
+
+		RenderSystem::initialize_internal();
+	}
+
+    void D3D11RenderSystem::destroy_internal()
+	{
+		SAFE_RELEASE(mDXGIFactory);
+		SAFE_DELETE(mDevice);
+		SAFE_DELETE(mDriverList);
+		mActiveD3DDriver = nullptr;
+
+		RenderSystem::destroy_internal();
+	}
+
 	void D3D11RenderSystem::setSamplerState(UINT16 texUnit, const SamplerState& samplerState)
 	{
 		throw std::exception("The method or operation is not implemented.");
@@ -235,11 +184,130 @@ namespace CamelotEngine
 		throw std::exception("The method or operation is not implemented.");
 	}
 
+	D3D11Device& D3D11RenderSystem::getPrimaryDevice() 
+	{ 
+		CM_EXCEPT(NotImplementedException, "Not implemented"); 
+	}
+
 	CamelotEngine::String D3D11RenderSystem::getErrorDescription(long errorNumber) const
 	{
 		throw std::exception("The method or operation is not implemented.");
 	}
 
+		void D3D11RenderSystem::determineFSAASettings(UINT32 fsaa, const String& fsaaHint, DXGI_FORMAT format, DXGI_SAMPLE_DESC* outFSAASettings)
+	{
+		CM_EXCEPT(NotImplementedException, "Not implemented");
+
+		/*
+		bool ok = false;
+		bool qualityHint = fsaaHint.find("Quality") != String::npos;
+		size_t origFSAA = fsaa;
+		bool tryCSAA = false;
+		// NVIDIA, prefer CSAA if available for 8+
+		// it would be tempting to use getCapabilities()->getVendor() == GPU_NVIDIA but
+		// if this is the first window, caps will not be initialised yet
+		
+		if (mActiveD3DDriver->getAdapterIdentifier().VendorId == 0x10DE && 
+			fsaa >= 8)
+		{
+			tryCSAA	 = true;
+		}
+
+		while (!ok)
+		{
+			// Deal with special cases
+			if (tryCSAA)
+			{
+				// see http://developer.nvidia.com/object/coverage-sampled-aa.html
+				switch(fsaa)
+				{
+				case 8:
+					if (qualityHint)
+					{
+						outFSAASettings->Count = 8;
+						outFSAASettings->Quality = 8;
+					}
+					else
+					{
+						outFSAASettings->Count = 4;
+						outFSAASettings->Quality = 8;
+					}
+					break;
+				case 16:
+					if (qualityHint)
+					{
+						outFSAASettings->Count = 8;
+						outFSAASettings->Quality = 16;
+					}
+					else
+					{
+						outFSAASettings->Count = 4;
+						outFSAASettings->Quality = 16;
+					}
+					break;
+				}
+			}
+			else // !CSAA
+			{
+				outFSAASettings->Count = fsaa == 0 ? 1 : fsaa;
+				outFSAASettings->Quality = 0;
+			}
+
+
+			HRESULT hr;
+			UINT outQuality;
+			hr = mDevice->CheckMultisampleQualityLevels( 
+				format, 
+				outFSAASettings->Count, 
+				&outQuality);
+
+			if (SUCCEEDED(hr) && (!tryCSAA || outQuality > outFSAASettings->Quality))
+			{
+				ok = true;
+			}
+			else
+			{
+				// downgrade
+				if (tryCSAA && fsaa == 8)
+				{
+					// for CSAA, we'll try downgrading with quality mode at all samples.
+					// then try without quality, then drop CSAA
+					if (qualityHint)
+					{
+						// drop quality first
+						qualityHint = false;
+					}
+					else
+					{
+						// drop CSAA entirely 
+						tryCSAA = false;
+					}
+					// return to original requested samples
+					fsaa = static_cast<UINT32>(origFSAA);
+				}
+				else
+				{
+					// drop samples
+					--fsaa;
+
+					if (fsaa == 1)
+					{
+						// ran out of options, no FSAA
+						fsaa = 0;
+						ok = true;
+					}
+				}
+			}
+
+		} // while !ok
+		*/
+	}
+
+	bool D3D11RenderSystem::checkTextureFilteringSupported(TextureType ttype, PixelFormat format, int usage)
+	{
+		return true;
+	}
+
 	CamelotEngine::VertexElementType D3D11RenderSystem::getColorVertexElementType() const
 	{
 		return VET_COLOR_ABGR;

+ 26 - 99
CamelotD3D11RenderSystem/Source/CmD3D11RenderWindow.cpp

@@ -31,8 +31,7 @@ namespace CamelotEngine
 		destroy();
 	}
 
-	void D3D11RenderWindow::initialize(const String& name, unsigned int width, unsigned int height,
-		bool fullScreen, const NameValuePairList *miscParams)
+	void D3D11RenderWindow::initialize(const RENDER_WINDOW_DESC& desc)
 	{
 		mFSAAType.Count = 1;
 		mFSAAType.Quality = 0;
@@ -42,93 +41,22 @@ namespace CamelotEngine
 		mVSyncInterval = 1;
 		HWND parentHWnd = 0;
 		HWND externalHandle = 0;
-		String title = name;
-		int left = -1; // Defaults to screen center
-		int top = -1; // Defaults to screen center
-		String border = "";
-		bool outerSize = false;
-		bool enableDoubleClick = false;
 
-		unsigned int colourDepth = 32;
-		bool depthBuffer = true;
-
-		if(miscParams)
-		{
-			// Get variable-length params
-			NameValuePairList::const_iterator opt;
-			// vsync	[parseBool]
-			opt = miscParams->find("vsync");
-			if(opt != miscParams->end())
-				mVSync = parseBool(opt->second);
-			// vsyncInterval	[parseUnsignedInt]
-			opt = miscParams->find("vsyncInterval");
-			if(opt != miscParams->end())
-				mVSyncInterval = parseUnsignedInt(opt->second);
-			// hidden	[parseBool]
-			opt = miscParams->find("hidden");
-			if(opt != miscParams->end())
-				mHidden = parseBool(opt->second);
-			// displayFrequency
-			opt = miscParams->find("displayFrequency");
-			if(opt != miscParams->end())
-				mDisplayFrequency = parseUnsignedInt(opt->second);
-			// colourDepth
-			opt = miscParams->find("colourDepth");
-			if(opt != miscParams->end())
-				colourDepth = parseUnsignedInt(opt->second);
-			// depthBuffer [parseBool]
-			opt = miscParams->find("depthBuffer");
-			if(opt != miscParams->end())
-				depthBuffer = parseBool(opt->second);
-			// FSAA type
-			opt = miscParams->find("FSAA");
-			if(opt != miscParams->end())
-				mFSAA = parseUnsignedInt(opt->second);
-			// FSAA quality
-			opt = miscParams->find("FSAAHint");
-			if(opt != miscParams->end())
-				mFSAAHint = opt->second;
-			// sRGB?
-			opt = miscParams->find("gamma");
-			if(opt != miscParams->end())
-				mHwGamma = parseBool(opt->second);
-			// left (x)
-			opt = miscParams->find("left");
-			if(opt != miscParams->end())
-				left = parseInt(opt->second);
-			// top (y)
-			opt = miscParams->find("top");
-			if(opt != miscParams->end())
-				top = parseInt(opt->second);
-			// Window title
-			opt = miscParams->find("title");
-			if(opt != miscParams->end())
-				title = opt->second;
-			// parentWindowHandle		-> parentHWnd
-			opt = miscParams->find("parentWindowHandle");
-			if(opt != miscParams->end())
-				parentHWnd = (HWND)parseUnsignedInt(opt->second);
-			// externalWindowHandle		-> externalHandle
-			opt = miscParams->find("externalWindowHandle");
-			if(opt != miscParams->end())
-				externalHandle = (HWND)parseUnsignedInt(opt->second);
-			// window border style
-			opt = miscParams->find("border");
-			if(opt != miscParams->end())
-				border = opt->second;
-			// set outer dimensions?
-			opt = miscParams->find("outerDimensions");
-			if(opt != miscParams->end())
-				outerSize = parseBool(opt->second);
-			// enable double click messages
-			opt = miscParams->find("enableDoubleClick");
-			if(opt != miscParams->end())
-				enableDoubleClick = parseBool(opt->second);
-		}
-
-		mName = name;
-		mIsFullScreen = fullScreen;
-		mColorDepth = colourDepth;
+		// Get variable-length params
+		NameValuePairList::const_iterator opt;
+
+		// parentWindowHandle		-> parentHWnd
+		opt = desc.platformSpecific.find("parentWindowHandle");
+		if(opt != desc.platformSpecific.end())
+			parentHWnd = (HWND)parseUnsignedInt(opt->second);
+		// externalWindowHandle		-> externalHandle
+		opt = desc.platformSpecific.find("externalWindowHandle");
+		if(opt != desc.platformSpecific.end())
+			externalHandle = (HWND)parseUnsignedInt(opt->second);
+
+		mName = desc.title;
+		mIsFullScreen = desc.fullscreen;
+		mColorDepth = desc.colorDepth;
 		mWidth = mHeight = mLeft = mTop = 0;
 
 		mActive = true;
@@ -143,12 +71,12 @@ namespace CamelotEngine
 			DWORD dwStyle = (mHidden ? 0 : WS_VISIBLE) | WS_CLIPCHILDREN;
 			RECT rc;
 
-			mWidth = width;
-			mHeight = height;
-			mTop = top;
-			mLeft = left;
+			mWidth = desc.width;
+			mHeight = desc.height;
+			mTop = desc.top;
+			mLeft = desc.left;
 
-			if (!fullScreen)
+			if (!desc.fullscreen)
 			{
 				if (parentHWnd)
 				{
@@ -156,16 +84,16 @@ namespace CamelotEngine
 				}
 				else
 				{
-					if (border == "none")
+					if (desc.border == "none")
 						dwStyle |= WS_POPUP;
-					else if (border == "fixed")
+					else if (desc.border == "fixed")
 						dwStyle |= WS_OVERLAPPED | WS_BORDER | WS_CAPTION |
 						WS_SYSMENU | WS_MINIMIZEBOX;
 					else
 						dwStyle |= WS_OVERLAPPEDWINDOW;
 				}
 
-				if (!outerSize)
+				if (!desc.outerDimensions)
 				{
 					// Calculate window dimensions required
 					// to get the requested client area
@@ -194,7 +122,7 @@ namespace CamelotEngine
 			}
 
 			UINT classStyle = 0;
-			if (enableDoubleClick)
+			if (desc.enableDoubleClick)
 				classStyle |= CS_DBLCLKS;
 
 			HINSTANCE hInst = NULL;
@@ -205,13 +133,12 @@ namespace CamelotEngine
 				LoadIcon(0, IDI_APPLICATION), LoadCursor(NULL, IDC_ARROW),
 				(HBRUSH)GetStockObject(BLACK_BRUSH), 0, "D3D11Wnd" };	
 
-
 			RegisterClass(&wc);
 
 			// Create our main window
 			// Pass pointer to self
 			mIsExternal = false;
-			mHWnd = CreateWindow("D3D11Wnd", title.c_str(), dwStyle,
+			mHWnd = CreateWindow("D3D11Wnd", desc.title.c_str(), dwStyle,
 				mLeft, mTop, mWidth, mHeight, parentHWnd, 0, hInst, this);
 
 			WindowEventUtilities::_addRenderWindow(this);

+ 1 - 2
CamelotD3D9Renderer/Include/CmD3D9RenderWindow.h

@@ -47,8 +47,7 @@ namespace CamelotEngine
 		~D3D9RenderWindow					();
 		
 		
-		void				initialize				(const String& name, unsigned int width, unsigned int height,
-												 bool fullScreen, const NameValuePairList *miscParams);
+		void				initialize			(const RENDER_WINDOW_DESC& desc);
 		void				setFullscreen		(bool fullScreen, unsigned int width, unsigned int height);
 		void				destroy				(void);
 		bool				isActive			() const;

+ 1 - 2
CamelotD3D9Renderer/Include/CmD3D9RenderWindowManager.h

@@ -14,8 +14,7 @@ namespace CamelotEngine
 		/**
 		 * @copydoc RenderWindowManager::create()
 		 */
-		void createImpl(const String& name, UINT32 width, UINT32 height, 
-			bool fullScreen, const map<String, String>::type& miscParams, AsyncOp& asyncOp);
+		void createImpl(const RENDER_WINDOW_DESC& desc, AsyncOp& asyncOp);
 
 	private:
 		D3D9RenderSystem* mRenderSystem;

+ 42 - 121
CamelotD3D9Renderer/Source/CmD3D9RenderWindow.cpp

@@ -56,111 +56,32 @@ namespace CamelotEngine
 		destroy();
 	}
 
-	void D3D9RenderWindow::initialize(const String& name, unsigned int width, unsigned int height,
-		bool fullScreen, const NameValuePairList *miscParams)
+	void D3D9RenderWindow::initialize(const RENDER_WINDOW_DESC& desc)
 	{
 		HINSTANCE hInst = mInstance;
 	
-		HWND parentHWnd = 0;
-		HWND externalHandle = 0;
 		mFSAAType = D3DMULTISAMPLE_NONE;
 		mFSAAQuality = 0;
-		mFSAA = 0;
-		mVSync = false;
-		mVSyncInterval = 1;
-		String title = name;
-		unsigned int colourDepth = 32;
-		int left = INT_MAX; // Defaults to screen center
-		int top = INT_MAX;  // Defaults to screen center
-		bool depthBuffer = true;
-		String border = "";
-		bool outerSize = false;
+		mFSAA = desc.FSAA;
+		mVSync = desc.vsync;
+		mVSyncInterval = desc.vsyncInterval;
 		mUseNVPerfHUD = false;
-		size_t fsaaSamples = 0;
-		String fsaaHint;
-		int monitorIndex = -1;	//Default by detecting the adapter from left / top position
-
-		if(miscParams)
-		{
-			// Get variable-length params
-			NameValuePairList::const_iterator opt;
-			// left (x)
-			opt = miscParams->find("left");
-			if(opt != miscParams->end())
-				left = parseInt(opt->second);
-			// top (y)
-			opt = miscParams->find("top");
-			if(opt != miscParams->end())
-				top = parseInt(opt->second);
-			// Window title
-			opt = miscParams->find("title");
-			if(opt != miscParams->end())
-				title = opt->second;
-			// parentWindowHandle		-> parentHWnd
-			opt = miscParams->find("parentWindowHandle");
-			if(opt != miscParams->end())
-				parentHWnd = (HWND)parseUnsignedInt(opt->second);
-			// externalWindowHandle		-> externalHandle
-			opt = miscParams->find("externalWindowHandle");
-			if(opt != miscParams->end())
-				externalHandle = (HWND)parseUnsignedInt(opt->second);
-			// vsync	[parseBool]
-			opt = miscParams->find("vsync");
-			if(opt != miscParams->end())
-				mVSync = parseBool(opt->second);
-			// vsyncInterval	[parseUnsignedInt]
-			opt = miscParams->find("vsyncInterval");
-			if(opt != miscParams->end())
-				mVSyncInterval = parseUnsignedInt(opt->second);
-			// displayFrequency
-			opt = miscParams->find("displayFrequency");
-			if(opt != miscParams->end())
-				mDisplayFrequency = parseUnsignedInt(opt->second);
-			// colourDepth
-			opt = miscParams->find("colourDepth");
-			if(opt != miscParams->end())
-				colourDepth = parseUnsignedInt(opt->second);
-			// depthBuffer [parseBool]
-			opt = miscParams->find("depthBuffer");
-			if(opt != miscParams->end())
-				depthBuffer = parseBool(opt->second);
-			// FSAA settings
-			opt = miscParams->find("FSAA");
-			if(opt != miscParams->end())
-			{
-				mFSAA = parseUnsignedInt(opt->second);
-			}
-			opt = miscParams->find("FSAAHint");
-			if(opt != miscParams->end())
-			{
-				mFSAAHint = opt->second;
-			}
 
-			// window border style
-			opt = miscParams->find("border");
-			if(opt != miscParams->end())
-				border = opt->second;
-			// set outer dimensions?
-			opt = miscParams->find("outerDimensions");
-			if(opt != miscParams->end())
-				outerSize = parseBool(opt->second);
-			// NV perf HUD?
-			opt = miscParams->find("useNVPerfHUD");
-			if(opt != miscParams->end())
-				mUseNVPerfHUD = parseBool(opt->second);
-			// sRGB?
-			opt = miscParams->find("gamma");
-			if(opt != miscParams->end())
-				mHwGamma = parseBool(opt->second);
-			// monitor index
-			opt = miscParams->find("monitorIndex");
-			if(opt != miscParams->end())
-				monitorIndex = parseInt(opt->second);
+		HWND parentHWnd = 0;
+		HWND externalHandle = 0;
 
-		}
+		NameValuePairList::const_iterator opt;
+		// parentWindowHandle		-> parentHWnd
+		opt = desc.platformSpecific.find("parentWindowHandle");
+		if(opt != desc.platformSpecific.end())
+			parentHWnd = (HWND)parseUnsignedInt(opt->second);
+		// externalWindowHandle		-> externalHandle
+		opt = desc.platformSpecific.find("externalWindowHandle");
+		if(opt != desc.platformSpecific.end())
+			externalHandle = (HWND)parseUnsignedInt(opt->second);
 
 		// Destroy current window if any
-		if( mHWnd )
+		if(mHWnd)
 			destroy();
 
 		if (!externalHandle)
@@ -171,15 +92,14 @@ namespace CamelotEngine
 			MONITORINFO monitorInfo;
 			RECT		rc;
 
-
 			// If we specified which adapter we want to use - find it's monitor.
-			if (monitorIndex != -1)
+			if (desc.monitorIndex != -1)
 			{
 				IDirect3D9* direct3D9 = D3D9RenderSystem::getDirect3D9();
 
 				for (UINT32 i=0; i < direct3D9->GetAdapterCount(); ++i)
 				{
-					if (i == monitorIndex)
+					if (i == desc.monitorIndex)
 					{
 						hMonitor = direct3D9->GetAdapterMonitor(i);
 						break;
@@ -193,9 +113,8 @@ namespace CamelotEngine
 				POINT windowAnchorPoint;
 
 				// Fill in anchor point.
-				windowAnchorPoint.x = left;
-				windowAnchorPoint.y = top;
-
+				windowAnchorPoint.x = desc.left;
+				windowAnchorPoint.y = desc.top;
 
 				// Get the nearest monitor to this window.
 				hMonitor = MonitorFromPoint(windowAnchorPoint, MONITOR_DEFAULTTOPRIMARY);
@@ -208,12 +127,14 @@ namespace CamelotEngine
 
 
 			unsigned int winWidth, winHeight;
-			winWidth = width;
-			winHeight = height;
+			winWidth = desc.width;
+			winHeight = desc.height;
 
+			UINT32 left = desc.left;
+			UINT32 top = desc.top;
 
 			// No specified top left -> Center the window in the middle of the monitor
-			if (left == INT_MAX || top == INT_MAX)
+			if (left == -1 || top == -1)
 			{				
 				int screenw = monitorInfo.rcWork.right  - monitorInfo.rcWork.left;
 				int screenh = monitorInfo.rcWork.bottom - monitorInfo.rcWork.top;
@@ -222,28 +143,28 @@ namespace CamelotEngine
 				int outerw = (int(winWidth) < screenw)? int(winWidth) : screenw;
 				int outerh = (int(winHeight) < screenh)? int(winHeight) : screenh;
 
-				if (left == INT_MAX)
+				if (left == -1)
 					left = monitorInfo.rcWork.left + (screenw - outerw) / 2;
-				else if (monitorIndex != -1)
+				else if (desc.monitorIndex != -1)
 					left += monitorInfo.rcWork.left;
 
-				if (top == INT_MAX)
+				if (top == -1)
 					top = monitorInfo.rcWork.top + (screenh - outerh) / 2;
-				else if (monitorIndex != -1)
+				else if (desc.monitorIndex != -1)
 					top += monitorInfo.rcWork.top;
 			}
-			else if (monitorIndex != -1)
+			else if (desc.monitorIndex != -1)
 			{
 				left += monitorInfo.rcWork.left;
 				top += monitorInfo.rcWork.top;
 			}
 
-			mWidth = mDesiredWidth = width;
-			mHeight = mDesiredHeight = height;
+			mWidth = mDesiredWidth = desc.width;
+			mHeight = mDesiredHeight = desc.height;
 			mTop = top;
 			mLeft = left;
 
-			if (fullScreen)
+			if (desc.fullscreen)
 			{
 				dwStyleEx |= WS_EX_TOPMOST;
 				dwStyle |= WS_POPUP;
@@ -258,18 +179,18 @@ namespace CamelotEngine
 				}
 				else
 				{
-					if (border == "none")
+					if (desc.border == "none")
 						dwStyle |= WS_POPUP;
-					else if (border == "fixed")
+					else if (desc.border == "fixed")
 						dwStyle |= WS_OVERLAPPED | WS_BORDER | WS_CAPTION |
 						WS_SYSMENU | WS_MINIMIZEBOX;
 					else
 						dwStyle |= WS_OVERLAPPEDWINDOW;
 				}
 
-				adjustWindow(width, height, dwStyle, &winWidth, &winHeight);
+				adjustWindow(desc.width, desc.height, dwStyle, &winWidth, &winHeight);
 
-				if (!outerSize)
+				if (!desc.outerDimensions)
 				{
 					// Calculate window dimensions required
 					// to get the requested client area
@@ -304,7 +225,7 @@ namespace CamelotEngine
 			// Create our main window
 			// Pass pointer to self
 			mIsExternal = false;
-			mHWnd = CreateWindowEx(dwStyleEx, "D3D9Wnd", title.c_str(), dwStyle,
+			mHWnd = CreateWindowEx(dwStyleEx, "D3D9Wnd", desc.title.c_str(), dwStyle,
 				mLeft, mTop, winWidth, winHeight, parentHWnd, 0, hInst, this);
 			mStyle = dwStyle;
 
@@ -326,10 +247,10 @@ namespace CamelotEngine
 		mWidth = rc.right;
 		mHeight = rc.bottom;
 
-		mName = name;
-		mIsDepthBuffered = depthBuffer;
-		mIsFullScreen = fullScreen;
-		mColorDepth = colourDepth;
+		mName = desc.title;
+		mIsDepthBuffered = desc.depthBuffer;
+		mIsFullScreen = desc.fullscreen;
+		mColorDepth = desc.colorDepth;
 									
 		mActive = true;
 		mClosed = false;

+ 2 - 3
CamelotD3D9Renderer/Source/CmD3D9RenderWindowManager.cpp

@@ -11,13 +11,12 @@ namespace CamelotEngine
 		assert(mRenderSystem != nullptr);
 	}
 
-	void D3D9RenderWindowManager::createImpl(const String& name, UINT32 width, UINT32 height, 
-		bool fullScreen, const map<String, String>::type& miscParams, AsyncOp& asyncOp)
+	void D3D9RenderWindowManager::createImpl(const RENDER_WINDOW_DESC& desc, AsyncOp& asyncOp)
 	{
 		// Create the window
 		D3D9RenderWindow* renderWindow = new D3D9RenderWindow(mRenderSystem->getInstanceHandle());
 
-		renderWindow->initialize(name, width, height, fullScreen, &miscParams);
+		renderWindow->initialize(desc);
 
 		D3D9RenderWindowPtr winPtr(renderWindow);
 		mRenderSystem->registerRenderWindow(winPtr);

+ 7 - 6
CamelotGLRenderer/Include/CmGLRenderSystem.h

@@ -267,13 +267,14 @@ namespace CamelotEngine {
 		UINT16 mActiveTextureUnit;
 
 	protected:
-		/** See
-          RenderSystem
-         */
+		/**
+		 * @copydoc	RenderSystem::initialize_internal().
+		 */
 		void initialize_internal();
-		/** See
-          RenderSystem
-         */
+
+		/**
+		 * @copydoc	RenderSystem::destroy_internal().
+		 */
         void destroy_internal(void);
 
 		void setClipPlanesImpl(const PlaneList& clipPlanes);

+ 1 - 2
CamelotGLRenderer/Include/CmGLRenderWindowManager.h

@@ -14,8 +14,7 @@ namespace CamelotEngine
 		/**
 		 * @copydoc RenderWindowManager::create()
 		 */
-		void createImpl(const String& name, UINT32 width, UINT32 height, 
-			bool fullScreen, const map<String, String>::type& miscParams, AsyncOp& asyncOp);
+		void createImpl(const RENDER_WINDOW_DESC& desc, AsyncOp& asyncOp);
 
 	private:
 		GLRenderSystem* mRenderSystem;

+ 1 - 2
CamelotGLRenderer/Include/CmGLSupport.h

@@ -43,8 +43,7 @@ public:
     GLSupport() { }
     virtual ~GLSupport() { }
 
-	virtual RenderWindow* newWindow(const String &name, unsigned int width, unsigned int height, 
-		bool fullScreen, const NameValuePairList *miscParams = 0) = 0;
+	virtual RenderWindow* newWindow(const RENDER_WINDOW_DESC& desc) = 0;
 
     virtual bool supportsPBuffers();
 

+ 1 - 2
CamelotGLRenderer/Include/CmWin32GLSupport.h

@@ -14,8 +14,7 @@ namespace CamelotEngine
         Win32GLSupport();
 
 		/// @copydoc RenderSystem::_createRenderWindow
-		virtual RenderWindow* newWindow(const String &name, unsigned int width, unsigned int height, 
-			bool fullScreen, const NameValuePairList *miscParams = 0);
+		virtual RenderWindow* newWindow(const RENDER_WINDOW_DESC& desc);
 
 		/**
 		* Start anything special

+ 1 - 2
CamelotGLRenderer/Include/CmWin32Window.h

@@ -39,8 +39,7 @@ namespace CamelotEngine {
         Win32Window(Win32GLSupport &glsupport);
         ~Win32Window();
 
-       void initialize(const String& name, unsigned int width, unsigned int height,
-	            bool fullScreen, const NameValuePairList *miscParams);
+       void initialize(const RENDER_WINDOW_DESC& desc);
 	   void setFullscreen(bool fullScreen, unsigned int width, unsigned int height);
         void destroy(void);
 		bool isActive(void) const;

+ 2 - 3
CamelotGLRenderer/Source/CmGLRenderWindowManager.cpp

@@ -11,13 +11,12 @@ namespace CamelotEngine
 		assert(mRenderSystem != nullptr);
 	}
 
-	void GLRenderWindowManager::createImpl(const String& name, UINT32 width, UINT32 height, 
-		bool fullScreen, const map<String, String>::type& miscParams, AsyncOp& asyncOp)
+	void GLRenderWindowManager::createImpl(const RENDER_WINDOW_DESC& desc, AsyncOp& asyncOp)
 	{
 		GLSupport* glSupport = mRenderSystem->getGLSupport();
 
 		// Create the window
-		RenderWindow* win = glSupport->newWindow(name, width, height, fullScreen, &miscParams);
+		RenderWindow* win = glSupport->newWindow(desc);
 
 		mRenderSystem->attachRenderTarget(*win);
 		GLContext* context;

+ 25 - 45
CamelotGLRenderer/Source/CmWin32GLSupport.cpp

@@ -56,61 +56,41 @@ namespace CamelotEngine
 		return TRUE;
 	}
 
-	RenderWindow* Win32GLSupport::newWindow(const String &name, unsigned int width, 
-		unsigned int height, bool fullScreen, const NameValuePairList *miscParams)
+	RenderWindow* Win32GLSupport::newWindow(const RENDER_WINDOW_DESC& desc)
 	{		
 		Win32Window* window = new Win32Window(*this);
-		NameValuePairList newParams;
-	
-		if (miscParams != NULL)
-		{	
-			newParams = *miscParams;
-			miscParams = &newParams;
-
-			NameValuePairList::const_iterator monitorIndexIt = miscParams->find("monitorIndex");			
-			HMONITOR hMonitor = NULL;
-			int monitorIndex = -1;
 		
-			// If monitor index found, try to assign the monitor handle based on it.
-			if (monitorIndexIt != miscParams->end())
-			{				
-				if (mMonitorInfoList.empty())		
-					EnumDisplayMonitors(NULL, NULL, sCreateMonitorsInfoEnumProc, (LPARAM)&mMonitorInfoList);			
-
-				monitorIndex = parseInt(monitorIndexIt->second);
-				if (monitorIndex < (int)mMonitorInfoList.size())
-				{						
-					hMonitor = mMonitorInfoList[monitorIndex].hMonitor;					
-				}
-			}
-			// If we didn't specified the monitor index, or if it didn't find it
-			if (hMonitor == NULL)
-			{
-				POINT windowAnchorPoint;
+		HMONITOR hMonitor = NULL;
+		int monitorIndex = desc.monitorIndex;
 		
-				NameValuePairList::const_iterator opt;
-				int left = -1;
-				int top  = -1;
-
-				if ((opt = newParams.find("left")) != newParams.end())
-					left = parseInt(opt->second);
-
-				if ((opt = newParams.find("top")) != newParams.end())
-					top = parseInt(opt->second);
+		// If monitor index found, try to assign the monitor handle based on it.
+		if(monitorIndex >= 0)
+		{
+			if (mMonitorInfoList.empty())		
+				EnumDisplayMonitors(NULL, NULL, sCreateMonitorsInfoEnumProc, (LPARAM)&mMonitorInfoList);			
 
-				// Fill in anchor point.
-				windowAnchorPoint.x = left;
-				windowAnchorPoint.y = top;
+			if (monitorIndex < (int)mMonitorInfoList.size())					
+				hMonitor = mMonitorInfoList[monitorIndex].hMonitor;	
+		}
 
+		// If we didn't specified the monitor index, or if it didn't find it
+		if (hMonitor == NULL)
+		{
+			POINT windowAnchorPoint;
+		
+			// Fill in anchor point.
+			windowAnchorPoint.x = desc.left;
+			windowAnchorPoint.y = desc.top;
 
-				// Get the nearest monitor to this window.
-				hMonitor = MonitorFromPoint(windowAnchorPoint, MONITOR_DEFAULTTONEAREST);				
-			}
 
-			newParams["monitorHandle"] = toString((size_t)hMonitor);																
+			// Get the nearest monitor to this window.
+			hMonitor = MonitorFromPoint(windowAnchorPoint, MONITOR_DEFAULTTONEAREST);				
 		}
 
-		window->initialize(name, width, height, fullScreen, miscParams);
+		RENDER_WINDOW_DESC newDesc = desc;
+		newDesc.platformSpecific["monitorHandle"] = toString((size_t)hMonitor);
+
+		window->initialize(newDesc);
 
 		if(!mInitialWindow)
 			mInitialWindow = window;

+ 55 - 113
CamelotGLRenderer/Source/CmWin32Window.cpp

@@ -63,8 +63,7 @@ namespace CamelotEngine {
 		destroy();
 	}
 
-	void Win32Window::initialize(const String& name, unsigned int width, unsigned int height,
-							bool fullScreen, const NameValuePairList *miscParams)
+	void Win32Window::initialize(const RENDER_WINDOW_DESC& desc)
 	{
 		// destroy current window, if any
 		if (mHWnd)
@@ -77,108 +76,52 @@ namespace CamelotEngine {
 #endif
 
 		mHWnd = 0;
-		mName = name;
-		mIsFullScreen = fullScreen;
+		mName = desc.title;
+		mIsFullScreen = desc.fullscreen;
 		mClosed = false;		
-		mDisplayFrequency = 0;
-		mColorDepth = mIsFullScreen? 32 : GetDeviceCaps(GetDC(0), BITSPIXEL);
-		int left = -1; // Defaults to screen center
-		int top = -1; // Defaults to screen center
+		mDisplayFrequency = desc.displayFrequency;
+		mColorDepth = desc.colorDepth;
 		HWND parent = 0;
-		String title = name;
-		bool vsync = false;
-		unsigned int vsyncInterval = 1;
-		String border;
-		bool outerSize = false;
-		bool hwGamma = false;
-		int monitorIndex = -1;
 		HMONITOR hMonitor = NULL;
 
-		if(miscParams)
-		{
-			// Get variable-length params
-			NameValuePairList::const_iterator opt;
-			NameValuePairList::const_iterator end = miscParams->end();
-
-			if ((opt = miscParams->find("title")) != end)
-				title = opt->second;
-
-			if ((opt = miscParams->find("left")) != end)
-				left = parseInt(opt->second);
-
-			if ((opt = miscParams->find("top")) != end)
-				top = parseInt(opt->second);
-
-			if ((opt = miscParams->find("vsync")) != end)
-				vsync = parseBool(opt->second);
-
-			if ((opt = miscParams->find("vsyncInterval")) != end)
-				vsyncInterval = parseUnsignedInt(opt->second);
-
-			if ((opt = miscParams->find("FSAA")) != end)
-				mFSAA = parseUnsignedInt(opt->second);
-
-			if ((opt = miscParams->find("FSAAHint")) != end)
-				mFSAAHint = opt->second;
+		// Get variable-length params
+		NameValuePairList::const_iterator opt;
+		NameValuePairList::const_iterator end = desc.platformSpecific.end();
 
-			if ((opt = miscParams->find("gamma")) != end)
-				hwGamma = parseBool(opt->second);
-
-			if ((opt = miscParams->find("externalWindowHandle")) != end)
-			{
-				mHWnd = (HWND)parseUnsignedInt(opt->second);
-				if (mHWnd)
-				{
-					mIsExternal = true;
-					mIsFullScreen = false;
-				}
-
-				if ((opt = miscParams->find("externalGLControl")) != end) {
-				  mIsExternalGLControl = parseBool(opt->second);
-				}
-			}
-			if ((opt = miscParams->find("externalGLContext")) != end)
+		if ((opt = desc.platformSpecific.find("externalWindowHandle")) != end)
+		{
+			mHWnd = (HWND)parseUnsignedInt(opt->second);
+			if (mHWnd)
 			{
-				mGlrc = (HGLRC)parseUnsignedLong(opt->second);
-				if( mGlrc )
-					mIsExternalGLContext = true;
+				mIsExternal = true;
+				mIsFullScreen = false;
 			}
 
-			// window border style
-			opt = miscParams->find("border");
-			if(opt != miscParams->end())
-				border = opt->second;
-			// set outer dimensions?
-			opt = miscParams->find("outerDimensions");
-			if(opt != miscParams->end())
-				outerSize = parseBool(opt->second);
-
-			// only available with fullscreen
-			if ((opt = miscParams->find("displayFrequency")) != end)
-				mDisplayFrequency = parseUnsignedInt(opt->second);
-			if ((opt = miscParams->find("colourDepth")) != end)
-			{
-				mColorDepth = parseUnsignedInt(opt->second);
-				if (!mIsFullScreen)
-				{
-					// make sure we don't exceed desktop colour depth
-					if ((int)mColorDepth > GetDeviceCaps(GetDC(0), BITSPIXEL))
-						mColorDepth = GetDeviceCaps(GetDC(0), BITSPIXEL);
-				}
+			if ((opt = desc.platformSpecific.find("externalGLControl")) != end) {
+				mIsExternalGLControl = parseBool(opt->second);
 			}
+		}
 
-			// incompatible with fullscreen
-			if ((opt = miscParams->find("parentWindowHandle")) != end)
-				parent = (HWND)parseUnsignedInt(opt->second);
+		if ((opt = desc.platformSpecific.find("externalGLContext")) != end)
+		{
+			mGlrc = (HGLRC)parseUnsignedLong(opt->second);
+			if( mGlrc )
+				mIsExternalGLContext = true;
+		}
 
+		// incompatible with fullscreen
+		if ((opt = desc.platformSpecific.find("parentWindowHandle")) != end)
+			parent = (HWND)parseUnsignedInt(opt->second);
 
-			// monitor index
-			if ((opt = miscParams->find("monitorIndex")) != end)
-				monitorIndex = parseInt(opt->second);
-			
-			// monitor handle
-			if ((opt = miscParams->find("monitorHandle")) != end)
-				hMonitor = (HMONITOR)parseInt(opt->second);			
+		// monitor handle
+		if ((opt = desc.platformSpecific.find("monitorHandle")) != end)
+			hMonitor = (HMONITOR)parseInt(opt->second);			
+
+		if (!mIsFullScreen)
+		{
+			// make sure we don't exceed desktop colour depth
+			if ((int)mColorDepth > GetDeviceCaps(GetDC(0), BITSPIXEL))
+				mColorDepth = GetDeviceCaps(GetDC(0), BITSPIXEL);
 		}
 
 		if (!mIsExternal)
@@ -194,8 +137,8 @@ namespace CamelotEngine {
 				POINT windowAnchorPoint;
 
 				// Fill in anchor point.
-				windowAnchorPoint.x = left;
-				windowAnchorPoint.y = top;
+				windowAnchorPoint.x = desc.left;
+				windowAnchorPoint.y = desc.top;
 
 
 				// Get the nearest monitor to this window.
@@ -212,6 +155,9 @@ namespace CamelotEngine {
 	
 			strcpy_s(mDeviceName, devNameLen + 1, monitorInfoEx.szDevice);
 
+			UINT32 left = desc.left;
+			UINT32 top = desc.top;
+
 			// No specified top left -> Center the window in the middle of the monitor
 			if (left == -1 || top == -1)
 			{				
@@ -219,7 +165,7 @@ namespace CamelotEngine {
 				int screenh = monitorInfoEx.rcWork.bottom - monitorInfoEx.rcWork.top;
 
 				unsigned int winWidth, winHeight;
-				adjustWindow(width, height, &winWidth, &winHeight);
+				adjustWindow(desc.width, desc.height, &winWidth, &winHeight);
 
 				// clamp window dimensions to screen size
 				int outerw = (int(winWidth) < screenw)? int(winWidth) : screenw;
@@ -227,22 +173,22 @@ namespace CamelotEngine {
 
 				if (left == -1)
 					left = monitorInfoEx.rcWork.left + (screenw - outerw) / 2;
-				else if (monitorIndex != -1)
+				else if (desc.monitorIndex != -1)
 					left += monitorInfoEx.rcWork.left;
 
 				if (top == -1)
 					top = monitorInfoEx.rcWork.top + (screenh - outerh) / 2;
-				else if (monitorIndex != -1)
+				else if (desc.monitorIndex != -1)
 					top += monitorInfoEx.rcWork.top;
 			}
-			else if (monitorIndex != -1)
+			else if (desc.monitorIndex != -1)
 			{
 				left += monitorInfoEx.rcWork.left;
 				top += monitorInfoEx.rcWork.top;
 			}
 
-			mWidth = width;
-			mHeight = height;
+			mWidth = desc.width;
+			mHeight = desc.height;
 			mTop = top;
 			mLeft = left;
 
@@ -261,9 +207,9 @@ namespace CamelotEngine {
 				}
 				else
 				{
-					if (border == "none")
+					if (desc.border == "none")
 						dwStyle |= WS_POPUP;
-					else if (border == "fixed")
+					else if (desc.border == "fixed")
 						dwStyle |= WS_OVERLAPPED | WS_BORDER | WS_CAPTION |
 						WS_SYSMENU | WS_MINIMIZEBOX;
 					else
@@ -273,7 +219,7 @@ namespace CamelotEngine {
 				int screenw = GetSystemMetrics(SM_CXSCREEN);
 				int screenh = GetSystemMetrics(SM_CYSCREEN);
 
-				if (!outerSize)
+				if (!desc.outerDimensions)
 				{
 					// Calculate window dimensions required
 					// to get the requested client area
@@ -333,9 +279,9 @@ namespace CamelotEngine {
 			}
 
 			// Pass pointer to self as WM_CREATE parameter
-			mHWnd = CreateWindowEx(dwStyleEx, "GLWindow", title.c_str(),
+			mHWnd = CreateWindowEx(dwStyleEx, "GLWindow", desc.title.c_str(),
 				dwStyle, mLeft, mTop, mWidth, mHeight, parent, 0, hInst, this);
-
+		
 			WindowEventUtilities::_addRenderWindow(this);			
 		}
 
@@ -357,7 +303,7 @@ namespace CamelotEngine {
 		if (!mIsExternalGLControl)
 		{
 			int testFsaa = mFSAA;
-			bool testHwGamma = hwGamma;
+			bool testHwGamma = desc.gamma;
 			bool formatOk = mGLSupport.selectPixelFormat(mHDC, mColorDepth, testFsaa, testHwGamma);
 			if (!formatOk)
 			{
@@ -368,7 +314,7 @@ namespace CamelotEngine {
 					formatOk = mGLSupport.selectPixelFormat(mHDC, mColorDepth, testFsaa, testHwGamma);
 				}
 
-				if (!formatOk && hwGamma)
+				if (!formatOk && desc.gamma)
 				{
 					// try without sRGB
 					testHwGamma = false;
@@ -376,7 +322,7 @@ namespace CamelotEngine {
 					formatOk = mGLSupport.selectPixelFormat(mHDC, mColorDepth, testFsaa, testHwGamma);
 				}
 
-				if (!formatOk && hwGamma && (mFSAA > 0))
+				if (!formatOk && desc.gamma && (mFSAA > 0))
 				{
 					// try without both
 					testHwGamma = false;
@@ -414,7 +360,7 @@ namespace CamelotEngine {
 			PFNWGLSWAPINTERVALEXTPROC _wglSwapIntervalEXT = 
 				(PFNWGLSWAPINTERVALEXTPROC)wglGetProcAddress("wglSwapIntervalEXT");
 			if (_wglSwapIntervalEXT)
-				_wglSwapIntervalEXT(vsync? vsyncInterval : 0);
+				_wglSwapIntervalEXT(desc.vsync ? desc.vsyncInterval : 0);
 		}
 
         if (old_context && old_context != mGlrc)
@@ -540,8 +486,6 @@ namespace CamelotEngine {
 					SWP_NOACTIVATE);
 				mWidth = width;
 				mHeight = height;
-
-
 			}
 			else
 			{
@@ -576,9 +520,7 @@ namespace CamelotEngine {
 				mHeight = height;
 
 				windowMovedOrResized();
-
 			}
-
 		}
 	}
 

+ 37 - 25
CamelotRenderer/Include/CmRenderWindow.h

@@ -32,6 +32,40 @@ THE SOFTWARE
 
 namespace CamelotEngine
 {
+	struct CM_EXPORT RENDER_WINDOW_DESC
+	{
+		RENDER_WINDOW_DESC()
+			:width(0), height(0), fullscreen(false)
+			, vsync(false), vsyncInterval(1), hidden(false)
+			, displayFrequency(60), colorDepth(32), depthBuffer(true)
+			, FSAA(0), FSAAHint(""), gamma(false), left(-1), top(-1)
+			, title(""), border(""), outerDimensions(false), enableDoubleClick(false)
+			, monitorIndex(-1)
+		{ }
+
+		UINT32 width;
+		UINT32 height;
+		bool fullscreen;
+		bool vsync;
+		UINT32 vsyncInterval;
+		bool hidden;
+		UINT32 displayFrequency;
+		UINT32 colorDepth;
+		bool depthBuffer;
+		UINT32 FSAA;
+		String FSAAHint;
+		bool gamma;
+		INT32 left; // -1 == screen center
+		INT32 top; // -1 == screen center
+		String title;
+		String border;
+		bool outerDimensions;
+		bool enableDoubleClick;
+		UINT32 monitorIndex; // -1 == select based on coordinates
+
+		NameValuePairList platformSpecific;
+	};
+
 	/** \addtogroup Core
 	*  @{
 	*/
@@ -67,31 +101,9 @@ namespace CamelotEngine
         */
         RenderWindow();
 
-        /** Creates & displays the new window.
-            @param
-                width The width of the window in pixels.
-            @param
-                height The height of the window in pixels.
-            @param
-                colourDepth The colour depth in bits. Ignored if
-                fullScreen is false since the desktop depth is used.
-            @param
-                fullScreen If true, the window fills the screen,
-                with no title bar or border.
-            @param
-                left The x-position of the window. Ignored if
-                fullScreen = true.
-            @param
-                top The y-position of the window. Ignored if
-                fullScreen = true.
-            @param
-                depthBuffer Specify true to include a depth-buffer.
-            @param
-                miscParam A variable number of pointers to platform-specific arguments. The
-                actual requirements must be defined by the implementing subclasses.
+        /** Creates & displays a new window.
         */
-		virtual void initialize(const String& name, unsigned int width, unsigned int height,
-	            bool fullScreen, const NameValuePairList *miscParams) = 0;
+		virtual void initialize(const RENDER_WINDOW_DESC& desc) = 0;
 
 		/** Alter fullscreen mode options. 
 		@note Nothing will happen unless the settings here are different from the
@@ -169,7 +181,7 @@ namespace CamelotEngine
           */
         void setDeactivateOnFocusChange(bool deactivate);
 
-		static RenderWindowPtr create(const String& name, unsigned int width, unsigned int height, bool fullScreen, const NameValuePairList *miscParams = nullptr);
+		static RenderWindowPtr create(const RENDER_WINDOW_DESC& desc);
 
     protected:
         bool mIsFullScreen;

+ 5 - 190
CamelotRenderer/Include/CmRenderWindowManager.h

@@ -2,6 +2,7 @@
 
 #include "CmPrerequisites.h"
 #include "CmModule.h"
+#include "CmRenderWindow.h"
 
 namespace CamelotEngine
 {
@@ -11,203 +12,17 @@ namespace CamelotEngine
 		/** Creates a new rendering window.
 		@remarks
 		This method creates a new rendering window as specified
-		by the paramteters. The rendering system could be
-		responible for only a single window (e.g. in the case
+		by the parameters. The rendering system could be
+		responsible for only a single window (e.g. in the case
 		of a game), or could be in charge of multiple ones (in the
 		case of a level editor). The option to create the window
 		as a child of another is therefore given.
 		This method will create an appropriate subclass of
 		RenderWindow depending on the API and platform implementation.
-		@par
-		After creation, this window can be retrieved using getRenderTarget().
-		@param
-		name The name of the window. Used in other methods
-		later like setRenderTarget and getRenderTarget.
-		@param
-		width The width of the new window.
-		@param
-		height The height of the new window.
-		@param
-		fullScreen Specify true to make the window full screen
-		without borders, title bar or menu bar.
-		@param
-		miscParams A NameValuePairList describing the other parameters for the new rendering window. 
-		Options are case sensitive. Unrecognised parameters will be ignored silently.
-		These values might be platform dependent, but these are present for all platforms unless
-		indicated otherwise:
-		<table>
-		<tr>
-			<td><b>Key</b></td>
-			<td><b>Type/Values</b></td>
-			<td><b>Default</b></td>
-			<td><b>Description</b></td>
-			<td><b>Notes</b></td>
-		</tr>
-		<tr>
-			<td>title</td>
-			<td>Any string</td>
-			<td>RenderTarget name</td>
-			<td>The title of the window that will appear in the title bar</td>
-			<td>&nbsp;</td>
-		</tr>
-		<tr>
-			<td>colourDepth</td>
-			<td>16, 32</td>
-			<td>Desktop depth</td>
-			<td>Colour depth of the resulting rendering window; only applies if fullScreen</td>
-			<td>Win32 Specific</td>
-		</tr>
-		<tr>
-			<td>left</td>
-			<td>Positive integers</td>
-			<td>Centred</td>
-			<td>Screen x coordinate from left</td>
-			<td>&nbsp;</td>
-		</tr>
-		<tr>
-			<td>top</td>
-			<td>Positive integers</td>
-			<td>Centred</td>
-			<td>Screen y coordinate from left</td>
-			<td>&nbsp;</td>
-		</tr>
-		<tr>
-			<td>depthBuffer</td>
-			<td>true, false</td>
-			<td>true</td>
-			<td>Use depth buffer</td>
-			<td>DirectX9 specific</td>
-		</tr>
-		<tr>
-			<td>externalWindowHandle</td>
-			<td>Win32: HWND as integer<br/>
-			    GLX: poslong:posint:poslong (display*:screen:windowHandle) or poslong:posint:poslong:poslong (display*:screen:windowHandle:XVisualInfo*)</td>
-			<td>0 (none)</td>
-			<td>External window handle, for embedding the OGRE render in an existing window</td>
-			<td>&nbsp;</td>
-		</tr>
-		<tr>
-			<td>externalGLControl</td>
-			<td>true, false</td>
-			<td>false</td>
-			<td>Let the external window control OpenGL i.e. don't select a pixel format for the window,
-			do not change v-sync and do not swap buffer. When set to true, the calling application
-			is responsible of OpenGL initialization and buffer swapping. It should also create an
-			OpenGL context for its own rendering, Ogre will create one for its use. Then the calling
-			application must also enable Ogre OpenGL context before calling any Ogre function and
-			restore its OpenGL context after these calls.</td>
-			<td>OpenGL specific</td>
-		</tr>
-		<tr>
-			<td>externalGLContext</td>
-			<td>Context as Unsigned Long</td>
-			<td>0 (create own context)</td>
-			<td>Use an externally created GL context</td>
-			<td>OpenGL Specific</td>
-		</tr>
-		<tr>
-			<td>parentWindowHandle</td>
-			<td>Win32: HWND as integer<br/>
-			    GLX: poslong:posint:poslong (display*:screen:windowHandle) or poslong:posint:poslong:poslong (display*:screen:windowHandle:XVisualInfo*)</td>
-			<td>0 (none)</td>
-			<td>Parent window handle, for embedding the engine in a child of an external window</td>
-			<td>&nbsp;</td>
-		</tr>
-		<tr>
-			<td>macAPI</td>
-			<td>String: "cocoa" or "carbon"</td>
-			<td>"carbon"</td>
-			<td>Specifies the type of rendering window on the Mac Platform.</td>
-			<td>&nbsp;</td>
-		 </tr>
-		 <tr>
-			<td>macAPICocoaUseNSView</td>
-			<td>bool "true" or "false"</td>
-			<td>"false"</td>
-			<td>On the Mac platform the most diffused method to embed engine in a custom application is to use Interface Builder
-				and add to the interface an instance of OgreView.
-				The pointer to this instance is then used as "externalWindowHandle".
-				However, there are cases where you are NOT using Interface Builder and you get the Cocoa NSView* of an existing interface.
-				For example, this is happens when you want to render into a Java/AWT interface.
-				In short, by setting this flag to "true" the Ogre::Root::createRenderWindow interprets the "externalWindowHandle" as a NSView*
-				instead of an OgreView*. See OgreOSXCocoaView.h/mm.
-			</td>
-			<td>&nbsp;</td>
-		 </tr>
-         <tr>
-			<td>FSAA</td>
-			<td>Positive integer (usually 0, 2, 4, 8, 16)</td>
-			<td>0</td>
-			<td>Full screen antialiasing factor</td>
-			<td>&nbsp;</td>
-		</tr>
-		<tr>
-			<td>FSAAHint</td>
-			<td>Depends on RenderSystem and hardware. Currently supports:<br/>
-			"Quality": on systems that have an option to prefer higher AA quality over speed, use it</td>
-			<td>Blank</td>
-			<td>Full screen antialiasing hint</td>
-			<td>&nbsp;</td>
-		</tr>
-		<tr>
-			<td>displayFrequency</td>
-			<td>Refresh rate in Hertz (e.g. 60, 75, 100)</td>
-			<td>Desktop vsync rate</td>
-			<td>Display frequency rate, for fullscreen mode</td>
-			<td>&nbsp;</td>
-		</tr>
-		<tr>
-			<td>vsync</td>
-			<td>true, false</td>
-			<td>false</td>
-			<td>Synchronize buffer swaps to monitor vsync, eliminating tearing at the expense of a fixed frame rate</td>
-			<td>&nbsp;</td>
-		</tr>
-		<tr>
-			<td>vsyncInterval</td>
-			<td>1, 2, 3, 4</td>
-			<td>1</td>
-			<td>If vsync is enabled, the minimum number of vertical blanks that should occur between renders. 
-			For example if vsync is enabled, the refresh rate is 60 and this is set to 2, then the
-			frame rate will be locked at 30.</td>
-			<td>&nbsp;</td>
-		</tr>
-		<tr>
-			<td>border</td>
-			<td>none, fixed, resize</td>
-			<td>resize</td>
-			<td>The type of window border (in windowed mode)</td>
-			<td>&nbsp;</td>
-		</tr>
-		<tr>
-			<td>outerDimensions</td>
-			<td>true, false</td>
-			<td>false</td>
-			<td>Whether the width/height is expressed as the size of the 
-			outer window, rather than the content area</td>
-			<td>&nbsp;</td>
-		</tr>
-		<tr>
-			<td>useNVPerfHUD</td>
-			<td>true, false</td>
-			<td>false</td>
-			<td>Enable the use of nVidia NVPerfHUD</td>
-			<td>&nbsp;</td>
-		</tr>
-		<tr>
-			<td>gamma</td>
-			<td>true, false</td>
-			<td>false</td>
-			<td>Enable hardware conversion from linear colour space to gamma
-			colour space on rendering to the window.</td>
-			<td>&nbsp;</td>
-		</tr>
 		*/
-		RenderWindowPtr create(const String& name, UINT32 width, UINT32 height, 
-			bool fullScreen, const map<String, String>::type* miscParams = nullptr);
+		RenderWindowPtr create(const RENDER_WINDOW_DESC& desc);
 
 	protected:
-		virtual void createImpl(const String& name, UINT32 width, UINT32 height, 
-			bool fullScreen, const map<String, String>::type& miscParams, AsyncOp& asyncOp) = 0;
+		virtual void createImpl(const RENDER_WINDOW_DESC& desc, AsyncOp& asyncOp) = 0;
 	};
 }

+ 7 - 1
CamelotRenderer/Source/CmApplication.cpp

@@ -51,7 +51,13 @@ namespace CamelotEngine
 
 		RenderSystem* renderSystem = RenderSystem::instancePtr();
 
-		mPrimaryRenderWindow = RenderWindow::create("Camelot Renderer", 1280, 720, false);
+		RENDER_WINDOW_DESC renderWindowDesc;
+		renderWindowDesc.width = 1280;
+		renderWindowDesc.height = 720;
+		renderWindowDesc.title = "Camelot Renderer";
+		renderWindowDesc.fullscreen = false;
+
+		mPrimaryRenderWindow = RenderWindow::create(renderWindowDesc);
 		mPrimaryRenderContext = renderSystem->createDeferredContext();
 
 		SceneManager::startUp(new SceneManager());

+ 2 - 2
CamelotRenderer/Source/CmRenderWindow.cpp

@@ -70,8 +70,8 @@ namespace CamelotEngine {
         mAutoDeactivatedOnFocusChange = deactivate;
     }
 
-	RenderWindowPtr RenderWindow::create(const String& name, unsigned int width, unsigned int height, bool fullScreen, const NameValuePairList *miscParams)
+	RenderWindowPtr RenderWindow::create(const RENDER_WINDOW_DESC& desc)
 	{
-		return RenderWindowManager::instance().create(name, width, height, fullScreen, miscParams);
+		return RenderWindowManager::instance().create(desc);
 	}
 }

+ 2 - 9
CamelotRenderer/Source/CmRenderWindowManager.cpp

@@ -4,17 +4,10 @@
 
 namespace CamelotEngine
 {
-	RenderWindowPtr RenderWindowManager::create(const String& name, UINT32 width, UINT32 height, 
-		bool fullScreen, const map<String, String>::type* miscParams)
+	RenderWindowPtr RenderWindowManager::create(const RENDER_WINDOW_DESC& desc)
 	{
 		RenderSystem* renderSystem = RenderSystem::instancePtr();
-
-		AsyncOp op;
-
-		if(miscParams != nullptr)
-			op = renderSystem->queueReturnCommand(boost::bind(&RenderWindowManager::createImpl, this, name, width, height, fullScreen, *miscParams, _1), true);
-		else
-			op = renderSystem->queueReturnCommand(boost::bind(&RenderWindowManager::createImpl, this, name, width, height, fullScreen, NameValuePairList(), _1), true);
+		AsyncOp op = renderSystem->queueReturnCommand(boost::bind(&RenderWindowManager::createImpl, this, desc, _1), true);
 
 		return op.getReturnValue<RenderWindowPtr>();
 	}