浏览代码

All renderers working - Preparing to port bulkPixelConversion method so it properly converts between formats

Marko Pintera 12 年之前
父节点
当前提交
ede19ab51a

+ 1 - 0
BansheeEngine/BansheeEngine.vcxproj

@@ -181,6 +181,7 @@
     <ClCompile Include="Source\BsGUIMaterialManager.cpp" />
     <ClCompile Include="Source\BsGUIMaterialManager.cpp" />
     <ClCompile Include="Source\BsGUISkin.cpp" />
     <ClCompile Include="Source\BsGUISkin.cpp" />
     <ClCompile Include="Source\BsGUIWidget.cpp" />
     <ClCompile Include="Source\BsGUIWidget.cpp" />
+    <ClCompile Include="Source\BsGUIWindowFrame.cpp" />
     <ClCompile Include="Source\BsImageSprite.cpp" />
     <ClCompile Include="Source\BsImageSprite.cpp" />
     <ClCompile Include="Source\BsSceneManager.cpp" />
     <ClCompile Include="Source\BsSceneManager.cpp" />
     <ClCompile Include="Source\BsSprite.cpp" />
     <ClCompile Include="Source\BsSprite.cpp" />

+ 3 - 0
BansheeEngine/BansheeEngine.vcxproj.filters

@@ -176,5 +176,8 @@
     <ClCompile Include="Source\BsGLBuiltinMaterialFactory.cpp">
     <ClCompile Include="Source\BsGLBuiltinMaterialFactory.cpp">
       <Filter>Source Files</Filter>
       <Filter>Source Files</Filter>
     </ClCompile>
     </ClCompile>
+    <ClCompile Include="Source\BsGUIWindowFrame.cpp">
+      <Filter>Source Files\GUI</Filter>
+    </ClCompile>
   </ItemGroup>
   </ItemGroup>
 </Project>
 </Project>

+ 43 - 0
BansheeEngine/Include/BsGUIWindowFrame.h

@@ -0,0 +1,43 @@
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsGUIElement.h"
+#include "BsTextSprite.h"
+
+namespace BansheeEngine
+{
+	class BS_EXPORT GUIWindowFrame : public GUIElement
+	{
+	public:
+		static const CM::String& getGUITypeName();
+
+		static GUIWindowFrame* create(GUIWidget* parent, const SpriteTexturePtr& texture);
+	protected:
+		~GUIWindowFrame();
+
+		/**
+		 * @copydoc GUIElement::getNumRenderElements()
+		 */
+		virtual UINT32 getNumRenderElements() const;
+
+		/**
+		 * @copydoc GUIElement::getMaterial()
+		 */
+		virtual const CM::HMaterial& getMaterial(UINT32 renderElementIdx) const;
+
+		/**
+		 * @copydoc GUIElement::getNumQuads()
+		 */
+		virtual UINT32 getNumQuads(UINT32 renderElementIdx) const;
+
+		/**
+		 * @copydoc GUIElement::fillBuffer()
+		 */
+		virtual void fillBuffer(CM::Vector2* vertices, CM::Vector2* uv, UINT32* indices, UINT32 startingQuad, UINT32 maxNumQuads, UINT32 renderElementIdx) const;
+	private:
+		ImageSprite* mImageSprite;
+		SpriteTexturePtr mTexture;
+
+		GUIWindowFrame(GUIWidget* parent, const SpriteTexturePtr& texture);
+	};
+}

+ 1 - 0
BansheeEngine/Include/BsPrerequisites.h

@@ -52,6 +52,7 @@ namespace BansheeEngine
 
 
 	// 2D
 	// 2D
 	class TextSprite;
 	class TextSprite;
+	class ImageSprite;
 	class SpriteTexture;
 	class SpriteTexture;
 	class OverlayManager;
 	class OverlayManager;
 
 

+ 64 - 0
BansheeEngine/Source/BsGUIWindowFrame.cpp

@@ -0,0 +1,64 @@
+#include "BsGUIWindowFrame.h"
+#include "BsImageSprite.h"
+#include "BsGUIWidget.h"
+#include "BsGUISkin.h"
+#include "BsSpriteTexture.h"
+#include "CmTexture.h"
+
+using namespace CamelotFramework;
+
+namespace BansheeEngine
+{
+	const String& GUIWindowFrame::getGUITypeName()
+	{
+		static String name = "WindowFrame";
+		return name;
+	}
+
+	GUIWindowFrame::GUIWindowFrame(GUIWidget* parent, const SpriteTexturePtr& texture)
+		:GUIElement(parent), mTexture(texture)
+	{
+		const GUISkin* skin = parent->getGUISkin();
+
+		mStyle = skin->getStyle(getGUITypeName());
+		mImageSprite = CM_NEW(ImageSprite, PoolAlloc) ImageSprite();
+
+		IMAGE_SPRITE_DESC desc;
+		desc.texture = texture;
+		desc.width = texture->getTexture()->getWidth();
+		desc.height = texture->getTexture()->getHeight();
+		mImageSprite->update(desc);
+
+		mBounds = mImageSprite->getBounds();
+	}
+
+	GUIWindowFrame::~GUIWindowFrame()
+	{
+		CM_DELETE(mImageSprite, ImageSprite, PoolAlloc);
+	}
+
+	GUIWindowFrame* GUIWindowFrame::create(GUIWidget* parent, const SpriteTexturePtr& texture)
+	{
+		return CM_NEW(GUIWindowFrame, PoolAlloc) GUIWindowFrame(parent, texture);
+	}
+
+	UINT32 GUIWindowFrame::getNumRenderElements() const
+	{
+		return mImageSprite->getNumRenderElements();
+	}
+
+	const HMaterial& GUIWindowFrame::getMaterial(UINT32 renderElementIdx) const
+	{
+		return mImageSprite->getMaterial(renderElementIdx);
+	}
+
+	UINT32 GUIWindowFrame::getNumQuads(UINT32 renderElementIdx) const
+	{
+		return mImageSprite->getNumQuads(renderElementIdx);
+	}
+
+	void GUIWindowFrame::fillBuffer(CM::Vector2* vertices, CM::Vector2* uv, UINT32* indices, UINT32 startingQuad, UINT32 maxNumQuads, UINT32 renderElementIdx) const
+	{
+		mImageSprite->fillBuffer(vertices, uv, indices, startingQuad, maxNumQuads, renderElementIdx);
+	}
+}

+ 13 - 7
CamelotClient/CamelotClient.cpp

@@ -28,9 +28,9 @@
 #include "CmTestTextSprite.h"
 #include "CmTestTextSprite.h"
 #include "CmEditorWindow.h"
 #include "CmEditorWindow.h"
 
 
-#define DX11
+//#define DX11
 //#define DX9
 //#define DX9
-//#define GL
+#define GL
 
 
 using namespace CamelotFramework;
 using namespace CamelotFramework;
 using namespace CamelotEditor;
 using namespace CamelotEditor;
@@ -70,8 +70,8 @@ int CALLBACK WinMain(
 	HSceneObject testModelGO = SceneObject::create("TestMesh");
 	HSceneObject testModelGO = SceneObject::create("TestMesh");
 	HRenderable testRenderable = testModelGO->addComponent<Renderable>();
 	HRenderable testRenderable = testModelGO->addComponent<Renderable>();
 
 
-	HSceneObject testTextGO = SceneObject::create("TestText");
-	GameObjectHandle<TestTextSprite> textSprite = testTextGO->addComponent<TestTextSprite>();
+//	HSceneObject testTextGO = SceneObject::create("TestText");
+//	GameObjectHandle<TestTextSprite> textSprite = testTextGO->addComponent<TestTextSprite>();
 
 
 	HFont font;
 	HFont font;
 	
 	
@@ -89,7 +89,12 @@ int CALLBACK WinMain(
 		font = Importer::instance().import("C:\\arial.ttf", fontImportOptions);
 		font = Importer::instance().import("C:\\arial.ttf", fontImportOptions);
 	}
 	}
 
 
-	textSprite->setText(camera, "Testing in a new row, does this work?", font, 12);
+//	HTexture windowFrameTex = static_resource_cast<Texture>(Importer::instance().import("C:\\WindowFrameTest.bmp"));
+//	gResources().create(windowFrameTex, "C:\\WindowFrameTest.tex", true);
+
+//	windowFrameTex.waitUntilLoaded();
+
+//	textSprite->init(camera, "Testing in a new row, does this work?", font, 12, windowFrameTex);
 
 
 #if defined DX9
 #if defined DX9
 	///////////////// HLSL 9 SHADERS //////////////////////////
 	///////////////// HLSL 9 SHADERS //////////////////////////
@@ -279,13 +284,13 @@ int CALLBACK WinMain(
 	//// Set the new state for the flag
 	//// Set the new state for the flag
 	//_CrtSetDbgFlag( tmpFlag );
 	//_CrtSetDbgFlag( tmpFlag );
 	
 	
-	EditorWindow* newWindow = new EditorWindow("Test window", font, 12);
+	//EditorWindow* newWindow = new EditorWindow("Test window", font, 12);
 
 
 	gBansheeApp().runMainLoop();
 	gBansheeApp().runMainLoop();
 
 
 	// Release everything before shutdown
 	// Release everything before shutdown
 	
 	
-	delete newWindow;
+	//delete newWindow;
 
 
 	//testMaterial->destroy();
 	//testMaterial->destroy();
 #ifdef DX11
 #ifdef DX11
@@ -297,6 +302,7 @@ int CALLBACK WinMain(
 	gResources().unload(fragProgRef);
 	gResources().unload(fragProgRef);
 	gResources().unload(vertProgRef);
 	gResources().unload(vertProgRef);
 	gResources().unload(testMaterial);
 	gResources().unload(testMaterial);
+	//windowFrameTex->destroy();
 
 
 	font.reset();
 	font.reset();
 	testMaterial.reset();
 	testMaterial.reset();

+ 8 - 3
CamelotClient/CmTestTextSprite.cpp

@@ -7,8 +7,10 @@
 #include "CmFont.h"
 #include "CmFont.h"
 #include "CmMaterial.h"
 #include "CmMaterial.h"
 #include "BsGUILabel.h"
 #include "BsGUILabel.h"
+#include "BsGUIWindowFrame.h"
 #include "BsGUISkin.h"
 #include "BsGUISkin.h"
 #include "BsOverlayManager.h"
 #include "BsOverlayManager.h"
+#include "BsSpriteTexture.h"
 
 
 using namespace BansheeEngine;
 using namespace BansheeEngine;
 
 
@@ -25,7 +27,7 @@ namespace CamelotFramework
 			CM_DELETE(mSkin, GUISkin, PoolAlloc);
 			CM_DELETE(mSkin, GUISkin, PoolAlloc);
 	}
 	}
 
 
-	void TestTextSprite::setText(const HCamera& camera, const String& text, HFont font, UINT32 fontSize)
+	void TestTextSprite::init(const HCamera& camera, const String& text, HFont font, UINT32 fontSize, const HTexture& windowFrameTex)
 	{
 	{
 		mSkin = CM_NEW(GUISkin, PoolAlloc) GUISkin();
 		mSkin = CM_NEW(GUISkin, PoolAlloc) GUISkin();
 
 
@@ -35,10 +37,13 @@ namespace CamelotFramework
 		labelStyle.font = font;
 		labelStyle.font = font;
 		labelStyle.fontSize = fontSize;
 		labelStyle.fontSize = fontSize;
 
 
-		mSkin->setStyle(BansheeEngine::GUILabel::getGUITypeName(), labelStyle);
+		mSkin->setStyle(GUILabel::getGUITypeName(), labelStyle);
 
 
 		setSkin(mSkin);
 		setSkin(mSkin);
-		BansheeEngine::GUILabel::create(this, text, 400, 400, true, THA_Right, TVA_Bottom);
+		GUILabel::create(this, text, 400, 400, true, THA_Right, TVA_Bottom);
+
+		SpriteTexturePtr frameSpriteTex(CM_NEW(SpriteTexture, PoolAlloc) SpriteTexture(windowFrameTex), &MemAllocDeleter<SpriteTexture, PoolAlloc>::deleter);
+		GUIWindowFrame::create(this, frameSpriteTex);
 	}
 	}
 
 
 	void TestTextSprite::update()
 	void TestTextSprite::update()

+ 1 - 1
CamelotClient/CmTestTextSprite.h

@@ -16,6 +16,6 @@ namespace CamelotFramework
 
 
 		virtual void update();
 		virtual void update();
 
 
-		void setText(const BS::HCamera& camera, const String& text, HFont font, UINT32 fontSize);
+		void init(const BS::HCamera& camera, const String& text, HFont font, UINT32 fontSize, const HTexture& windowFrameTex);
 	};
 	};
 }
 }

+ 3 - 2
CamelotCore/Source/CmTexture.cpp

@@ -104,7 +104,7 @@ namespace CamelotFramework {
 	void Texture::setRawPixels_internal(const PixelData& data, UINT32 face, UINT32 mip)
 	void Texture::setRawPixels_internal(const PixelData& data, UINT32 face, UINT32 mip)
 	{
 	{
 		PixelData myData = lock(GBL_WRITE_ONLY_DISCARD, mip, face);
 		PixelData myData = lock(GBL_WRITE_ONLY_DISCARD, mip, face);
-		memcpy(myData.data, data.data, data.getConsecutiveSize());
+		PixelUtil::bulkPixelConversion(data, myData);
 		unlock();
 		unlock();
 	}
 	}
 
 
@@ -152,7 +152,8 @@ namespace CamelotFramework {
 		}
 		}
 #endif
 #endif
 
 
-		memcpy(dst->data, myData.data, dst->getConsecutiveSize());
+		PixelUtil::bulkPixelConversion(myData, *dst);
+
 		unlock();
 		unlock();
 
 
 		op.completeOperation(dst);
 		op.completeOperation(dst);

+ 15 - 11
CamelotD3D11RenderSystem/Source/CmD3D11Mappings.cpp

@@ -450,7 +450,7 @@ namespace CamelotFramework
 		case DXGI_FORMAT_R32G32B32A32_SINT	:
 		case DXGI_FORMAT_R32G32B32A32_SINT	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R32G32B32_TYPELESS	:
 		case DXGI_FORMAT_R32G32B32_TYPELESS	:
-			return PF_UNKNOWN;
+			return PF_FLOAT32_RGB;
 		case DXGI_FORMAT_R32G32B32_FLOAT	:
 		case DXGI_FORMAT_R32G32B32_FLOAT	:
 			return PF_FLOAT32_RGB;
 			return PF_FLOAT32_RGB;
 		case DXGI_FORMAT_R32G32B32_UINT	:
 		case DXGI_FORMAT_R32G32B32_UINT	:
@@ -460,7 +460,7 @@ namespace CamelotFramework
 		case DXGI_FORMAT_R16G16B16A16_TYPELESS	:
 		case DXGI_FORMAT_R16G16B16A16_TYPELESS	:
 			return PF_FLOAT16_RGBA;
 			return PF_FLOAT16_RGBA;
 		case DXGI_FORMAT_R16G16B16A16_FLOAT	:
 		case DXGI_FORMAT_R16G16B16A16_FLOAT	:
-			return PF_UNKNOWN;
+			return PF_FLOAT16_RGBA;
 		case DXGI_FORMAT_R16G16B16A16_UNORM	:
 		case DXGI_FORMAT_R16G16B16A16_UNORM	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R16G16B16A16_UINT	:
 		case DXGI_FORMAT_R16G16B16A16_UINT	:
@@ -480,7 +480,7 @@ namespace CamelotFramework
 		case DXGI_FORMAT_R32G8X24_TYPELESS	:
 		case DXGI_FORMAT_R32G8X24_TYPELESS	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_D32_FLOAT_S8X24_UINT	:
 		case DXGI_FORMAT_D32_FLOAT_S8X24_UINT	:
-			return PF_UNKNOWN;
+			return PF_D32_S8X24;
 		case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS	:
 		case DXGI_FORMAT_R32_FLOAT_X8X24_TYPELESS	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT	:
 		case DXGI_FORMAT_X32_TYPELESS_G8X24_UINT	:
@@ -520,7 +520,7 @@ namespace CamelotFramework
 		case DXGI_FORMAT_R32_TYPELESS	:
 		case DXGI_FORMAT_R32_TYPELESS	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_D32_FLOAT	:
 		case DXGI_FORMAT_D32_FLOAT	:
-			return PF_UNKNOWN;
+			return PF_D32;
 		case DXGI_FORMAT_R32_FLOAT	:
 		case DXGI_FORMAT_R32_FLOAT	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R32_UINT	:
 		case DXGI_FORMAT_R32_UINT	:
@@ -530,7 +530,7 @@ namespace CamelotFramework
 		case DXGI_FORMAT_R24G8_TYPELESS	:
 		case DXGI_FORMAT_R24G8_TYPELESS	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_D24_UNORM_S8_UINT	:
 		case DXGI_FORMAT_D24_UNORM_S8_UINT	:
-			return PF_UNKNOWN;
+			return PF_D24S8;
 		case DXGI_FORMAT_R24_UNORM_X8_TYPELESS	:
 		case DXGI_FORMAT_R24_UNORM_X8_TYPELESS	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_X24_TYPELESS_G8_UINT	:
 		case DXGI_FORMAT_X24_TYPELESS_G8_UINT	:
@@ -538,7 +538,7 @@ namespace CamelotFramework
 		case DXGI_FORMAT_R8G8_TYPELESS	:
 		case DXGI_FORMAT_R8G8_TYPELESS	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R8G8_UNORM	:
 		case DXGI_FORMAT_R8G8_UNORM	:
-			return PF_UNKNOWN;
+			return PF_R8G8;
 		case DXGI_FORMAT_R8G8_UINT	:
 		case DXGI_FORMAT_R8G8_UINT	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_R8G8_SNORM	:
 		case DXGI_FORMAT_R8G8_SNORM	:
@@ -610,11 +610,11 @@ namespace CamelotFramework
 		case DXGI_FORMAT_BC5_SNORM	:
 		case DXGI_FORMAT_BC5_SNORM	:
 			return PF_DXT5;
 			return PF_DXT5;
 		case DXGI_FORMAT_B5G6R5_UNORM	:
 		case DXGI_FORMAT_B5G6R5_UNORM	:
-			return PF_DXT5;
+			return PF_UNKNOWN;
 		case DXGI_FORMAT_B5G5R5A1_UNORM	:
 		case DXGI_FORMAT_B5G5R5A1_UNORM	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		case DXGI_FORMAT_B8G8R8A8_UNORM	:
 		case DXGI_FORMAT_B8G8R8A8_UNORM	:
-			return PF_UNKNOWN;
+			return PF_B8G8R8A8;
 		case DXGI_FORMAT_B8G8R8X8_UNORM	:
 		case DXGI_FORMAT_B8G8R8X8_UNORM	:
 			return PF_UNKNOWN;
 			return PF_UNKNOWN;
 		default:
 		default:
@@ -649,13 +649,17 @@ namespace CamelotFramework
 		case PF_A8R8G8B8:
 		case PF_A8R8G8B8:
 			return DXGI_FORMAT_UNKNOWN;
 			return DXGI_FORMAT_UNKNOWN;
 		case PF_A8B8G8R8:
 		case PF_A8B8G8R8:
-			return DXGI_FORMAT_R8G8B8A8_UNORM;
+			return DXGI_FORMAT_UNKNOWN;
 		case PF_X8R8G8B8:
 		case PF_X8R8G8B8:
 			return DXGI_FORMAT_UNKNOWN;
 			return DXGI_FORMAT_UNKNOWN;
 		case PF_X8B8G8R8:
 		case PF_X8B8G8R8:
 			return DXGI_FORMAT_UNKNOWN;
 			return DXGI_FORMAT_UNKNOWN;
+		case PF_R8G8B8A8:
+			return DXGI_FORMAT_R8G8B8A8_UNORM;
+		case PF_B8G8R8A8:
+			return DXGI_FORMAT_B8G8R8A8_UNORM;
 		case PF_A2B10G10R10:
 		case PF_A2B10G10R10:
-			return DXGI_FORMAT_R10G10B10A2_TYPELESS;
+			return DXGI_FORMAT_UNKNOWN;
 		case PF_A2R10G10B10:
 		case PF_A2R10G10B10:
 			return DXGI_FORMAT_UNKNOWN;
 			return DXGI_FORMAT_UNKNOWN;
 		case PF_FLOAT16_R:
 		case PF_FLOAT16_R:
@@ -706,7 +710,7 @@ namespace CamelotFramework
 			return PF_FLOAT32_RGBA;
 			return PF_FLOAT32_RGBA;
 		case PF_UNKNOWN:
 		case PF_UNKNOWN:
 		default:
 		default:
-			return PF_A8B8G8R8;
+			return PF_R8G8B8A8;
 		}
 		}
 	}
 	}
 
 

+ 3 - 0
CamelotD3D11RenderSystem/Source/CmD3D11Texture.cpp

@@ -137,6 +137,7 @@ namespace CamelotFramework
 		// Determine which D3D11 pixel format we'll use
 		// Determine which D3D11 pixel format we'll use
 		HRESULT hr;
 		HRESULT hr;
 		DXGI_FORMAT d3dPF = D3D11Mappings::_getPF(D3D11Mappings::_getClosestSupportedPF(mFormat));
 		DXGI_FORMAT d3dPF = D3D11Mappings::_getPF(D3D11Mappings::_getClosestSupportedPF(mFormat));
+		mFormat = D3D11Mappings::_getPF(d3dPF);
 
 
 		D3D11_TEXTURE1D_DESC desc;
 		D3D11_TEXTURE1D_DESC desc;
 		desc.Width			= static_cast<UINT32>(mWidth);
 		desc.Width			= static_cast<UINT32>(mWidth);
@@ -220,6 +221,7 @@ namespace CamelotFramework
 		// Determine which D3D11 pixel format we'll use
 		// Determine which D3D11 pixel format we'll use
 		HRESULT hr;
 		HRESULT hr;
 		DXGI_FORMAT d3dPF = D3D11Mappings::_getPF(D3D11Mappings::_getClosestSupportedPF(mFormat));
 		DXGI_FORMAT d3dPF = D3D11Mappings::_getPF(D3D11Mappings::_getClosestSupportedPF(mFormat));
+		mFormat = D3D11Mappings::_getPF(d3dPF);
 
 
 		D3D11_TEXTURE2D_DESC desc;
 		D3D11_TEXTURE2D_DESC desc;
 		desc.Width			= static_cast<UINT32>(mWidth);
 		desc.Width			= static_cast<UINT32>(mWidth);
@@ -376,6 +378,7 @@ namespace CamelotFramework
 		// Determine which D3D11 pixel format we'll use
 		// Determine which D3D11 pixel format we'll use
 		HRESULT hr;
 		HRESULT hr;
 		DXGI_FORMAT d3dPF = D3D11Mappings::_getPF(D3D11Mappings::_getClosestSupportedPF(mFormat));
 		DXGI_FORMAT d3dPF = D3D11Mappings::_getPF(D3D11Mappings::_getClosestSupportedPF(mFormat));
+		mFormat = D3D11Mappings::_getPF(d3dPF);
 
 
 		D3D11_TEXTURE3D_DESC desc;
 		D3D11_TEXTURE3D_DESC desc;
 		desc.Width			= static_cast<UINT32>(mWidth);
 		desc.Width			= static_cast<UINT32>(mWidth);

+ 0 - 6
CamelotD3D9Renderer/Source/CmD3D9Texture.cpp

@@ -748,12 +748,6 @@ namespace CamelotFramework
 				"Height: " + toString(height) + "/" + toString(mHeight) +
 				"Height: " + toString(height) + "/" + toString(mHeight) +
 				"Depth: " + toString(depth) + "/" + toString(mDepth));
 				"Depth: " + toString(depth) + "/" + toString(mDepth));
 		}
 		}
-
-		if(mFormat != format)
-		{
-			CM_EXCEPT(InternalErrorException, "Wanted and created texture format doesn't match: " + 
-				toString(format) + "/" + toString(mFormat));
-		}
 		
 		
 		// Create list of subsurfaces for getBuffer()
 		// Create list of subsurfaces for getBuffer()
 		_createSurfaceList(d3d9Device, textureResources);
 		_createSurfaceList(d3d9Device, textureResources);

+ 0 - 2
CamelotGLRenderer/Source/CmGLTexture.cpp

@@ -194,8 +194,6 @@ namespace CamelotFramework {
 		}
 		}
 
 
 		createSurfaceList();
 		createSurfaceList();
-		// Get final internal format
-		mFormat = getBuffer(0,0)->getFormat();
 	}
 	}
 
 
 	void GLTexture::destroy_internal()
 	void GLTexture::destroy_internal()

+ 1 - 12
CamelotUtility/Include/CmPixelData.h

@@ -52,7 +52,6 @@ namespace CamelotFramework
         /// 32-bit pixel format, 8 bits for blue, 8 bits for green, 8 bits for red
         /// 32-bit pixel format, 8 bits for blue, 8 bits for green, 8 bits for red
         /// like PF_A8B8G8R8, but alpha will get discarded
         /// like PF_A8B8G8R8, but alpha will get discarded
         PF_X8B8G8R8 = 27,
         PF_X8B8G8R8 = 27,
-#if CM_ENDIAN == CM_ENDIAN_BIG
 		/// 3 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue
 		/// 3 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue
 		PF_BYTE_RGB = PF_R8G8B8,
 		PF_BYTE_RGB = PF_R8G8B8,
 		/// 3 byte pixel format, 1 byte for blue, 1 byte for green, 1 byte for red
 		/// 3 byte pixel format, 1 byte for blue, 1 byte for green, 1 byte for red
@@ -60,17 +59,7 @@ namespace CamelotFramework
 		/// 4 byte pixel format, 1 byte for blue, 1 byte for green, 1 byte for red and one byte for alpha
 		/// 4 byte pixel format, 1 byte for blue, 1 byte for green, 1 byte for red and one byte for alpha
 		PF_BYTE_BGRA = PF_B8G8R8A8,
 		PF_BYTE_BGRA = PF_B8G8R8A8,
 		/// 4 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue, and one byte for alpha
 		/// 4 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue, and one byte for alpha
-		PF_BYTE_RGBA = PF_R8G8B8A8,
-#else
-		/// 3 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue
-		PF_BYTE_RGB = PF_B8G8R8,
-		/// 3 byte pixel format, 1 byte for blue, 1 byte for green, 1 byte for red
-		PF_BYTE_BGR = PF_R8G8B8,
-		/// 4 byte pixel format, 1 byte for blue, 1 byte for green, 1 byte for red and one byte for alpha
-		PF_BYTE_BGRA = PF_A8R8G8B8,
-		/// 4 byte pixel format, 1 byte for red, 1 byte for green, 1 byte for blue, and one byte for alpha
-		PF_BYTE_RGBA = PF_A8B8G8R8,
-#endif        
+		PF_BYTE_RGBA = PF_R8G8B8A8,      
         /// 32-bit pixel format, 2 bits for alpha, 10 bits for red, green and blue.
         /// 32-bit pixel format, 2 bits for alpha, 10 bits for red, green and blue.
         PF_A2R10G10B10 = 15,
         PF_A2R10G10B10 = 15,
         /// 32-bit pixel format, 10 bits for blue, green and red, 2 bits for alpha.
         /// 32-bit pixel format, 10 bits for blue, green and red, 2 bits for alpha.

+ 8 - 0
TODO.txt

@@ -2,6 +2,14 @@
 
 
 ----------------------------------------------------------------------------------------------
 ----------------------------------------------------------------------------------------------
 
 
+24bit textures don't seem to load properly
+ - Seems DX11 doesn't support 24bit texture format so instead it chooses a 32bit one but 
+   when we write to texture we still assume the format is the original 24bit one. 
+ - After creating the texture I need to update the actual format
+ - And when copying texture data make sure I copy it channel by channel
+32bit textures seem to have some channels flipped
+ 
+
 Immediate TODO:
 Immediate TODO:
  - Issue with rendering same object from multiple cameras:
  - Issue with rendering same object from multiple cameras:
    - Material parameters should be copied after being submitted to the render context
    - Material parameters should be copied after being submitted to the render context