Browse Source

Major refactor of builtin resources - All resources are imported and saved as a preprocessing step and then just loaded in engine ready format.
Added WIP SceneGrid
Added 3D versions of AA line and polygon drawing
Fixed an issue with Font serialization
Fixed issue with invalid resource import options RTTI base types
Added a temporary fix for Resources::unloadAllUnused which was unloading used resources
Fixed resource tree view so it uses either directory or filename for element names and not just filename
Fixed GUITexture so it properly checks if a sprite texture is loaded before using it
Fixed GLSL program parsing so it properly handles newline separated source text
Fixed FileSystem so when retrieving child directories they are properly marked as directories and not as files

Marko Pintera 11 years ago
parent
commit
8644a9f53d
51 changed files with 2683 additions and 3403 deletions
  1. 15 14
      BansheeCore/Include/BsFontDesc.h
  2. 1 1
      BansheeCore/Include/BsFontImportOptionsRTTI.h
  3. 1 1
      BansheeCore/Include/BsGpuProgramImportOptionsRTTI.h
  4. 1 1
      BansheeCore/Include/BsTextureImportOptionsRTTI.h
  5. 1 1
      BansheeCore/Source/BsResources.cpp
  6. 4 2
      BansheeEditor/BansheeEditor.vcxproj
  7. 12 6
      BansheeEditor/BansheeEditor.vcxproj.filters
  8. 214 150
      BansheeEditor/Include/BsBuiltinEditorResources.h
  9. 41 0
      BansheeEditor/Include/BsSceneGrid.h
  10. 1244 977
      BansheeEditor/Source/BsBuiltinEditorResources.cpp
  11. 2 2
      BansheeEditor/Source/BsDockManager.cpp
  12. 3 3
      BansheeEditor/Source/BsEditorApplication.cpp
  13. 3 3
      BansheeEditor/Source/BsEditorWindowBase.cpp
  14. 1 1
      BansheeEditor/Source/BsGUIResourceTreeView.cpp
  15. 135 0
      BansheeEditor/Source/BsSceneGrid.cpp
  16. 2 2
      BansheeEditor/Source/BsTestTextSprite.cpp
  17. 1 1
      BansheeEditorExec/BsEditorExec.cpp
  18. 0 8
      BansheeEngine/BansheeEngine.vcxproj
  19. 0 24
      BansheeEngine/BansheeEngine.vcxproj.filters
  20. 1 0
      BansheeEngine/Include/BsApplication.h
  21. 0 133
      BansheeEngine/Include/BsBuiltinMaterialManager.h
  22. 128 4
      BansheeEngine/Include/BsBuiltinResources.h
  23. 0 90
      BansheeEngine/Include/BsD3D11BuiltinMaterialFactory.h
  24. 0 90
      BansheeEngine/Include/BsD3D9BuiltinMaterialFactory.h
  25. 4 4
      BansheeEngine/Include/BsDrawHelper2D.h
  26. 12 8
      BansheeEngine/Include/BsDrawHelper3D.h
  27. 17 10
      BansheeEngine/Include/BsDrawHelperTemplate.h
  28. 0 90
      BansheeEngine/Include/BsGLBuiltinMaterialFactory.h
  29. 1 0
      BansheeEngine/Include/BsGUIMaterialInfo.h
  30. 4 0
      BansheeEngine/Include/BsGUIMaterialManager.h
  31. 1 0
      BansheeEngine/Include/BsPrerequisites.h
  32. 2 14
      BansheeEngine/Source/BsApplication.cpp
  33. 0 117
      BansheeEngine/Source/BsBuiltinMaterialManager.cpp
  34. 528 28
      BansheeEngine/Source/BsBuiltinResources.cpp
  35. 0 493
      BansheeEngine/Source/BsD3D11BuiltinMaterialFactory.cpp
  36. 0 491
      BansheeEngine/Source/BsD3D9BuiltinMaterialFactory.cpp
  37. 12 12
      BansheeEngine/Source/BsDrawHelper2D.cpp
  38. 122 18
      BansheeEngine/Source/BsDrawHelper3D.cpp
  39. 4 1
      BansheeEngine/Source/BsDrawHelperTemplate.cpp
  40. 0 520
      BansheeEngine/Source/BsGLBuiltinMaterialFactory.cpp
  41. 15 3
      BansheeEngine/Source/BsGUIMaterialManager.cpp
  42. 3 3
      BansheeEngine/Source/BsGUITexture.cpp
  43. 2 2
      BansheeEngine/Source/BsRenderable.cpp
  44. 53 2
      BansheeGLRenderSystem/Source/GLSL/src/BsGLSLGpuProgram.cpp
  45. 1 1
      BansheeUtility/Include/BsFileSystem.h
  46. 32 0
      BansheeUtility/Include/BsRTTIType.h
  47. 1 19
      BansheeUtility/Source/BsIReflectable.cpp
  48. 1 1
      BansheeUtility/Source/Win32/BsFileSystem.cpp
  49. 17 17
      SBansheeEditor/Source/BsGUIGameObjectField.cpp
  50. 17 17
      SBansheeEditor/Source/BsGUIResourceField.cpp
  51. 24 18
      SceneView.txt

+ 15 - 14
BansheeCore/Include/BsFontDesc.h

@@ -121,16 +121,17 @@ namespace BansheeEngine
 
 		static void toMemory(const FONT_DESC& data, char* memory)
 		{ 
-			UINT32 size = getDynamicSize(data);
-
-			memcpy(memory, &size, sizeof(UINT32));
+			UINT32 size = sizeof(UINT32);
+			char* memoryStart = memory;
 			memory += sizeof(UINT32);
 			
-			RTTIPlainType<Map<UINT32, CHAR_DESC>>::toMemory(data.characters, memory);
-			rttiWriteElem(data.baselineOffset, memory);
-			rttiWriteElem(data.lineHeight, memory);
-			rttiWriteElem(data.missingGlyph, memory);
-			rttiWriteElem(data.spaceWidth, memory);
+			memory = rttiWriteElem(data.characters, memory, size);
+			memory = rttiWriteElem(data.baselineOffset, memory, size);
+			memory = rttiWriteElem(data.lineHeight, memory, size);
+			memory = rttiWriteElem(data.missingGlyph, memory, size);
+			memory = rttiWriteElem(data.spaceWidth, memory, size);
+
+			memcpy(memoryStart, &size, sizeof(UINT32));
 		}
 
 		static UINT32 fromMemory(FONT_DESC& data, char* memory)
@@ -139,11 +140,11 @@ namespace BansheeEngine
 			memcpy(&size, memory, sizeof(UINT32)); 
 			memory += sizeof(UINT32);
 
-			RTTIPlainType<Map<UINT32, CHAR_DESC>>::fromMemory(data.characters, memory);
-			rttiReadElem(data.baselineOffset, memory);
-			rttiReadElem(data.lineHeight, memory);
-			rttiReadElem(data.missingGlyph, memory);
-			rttiReadElem(data.spaceWidth, memory);
+			memory = rttiReadElem(data.characters, memory);
+			memory = rttiReadElem(data.baselineOffset, memory);
+			memory = rttiReadElem(data.lineHeight, memory);
+			memory = rttiReadElem(data.missingGlyph, memory);
+			memory = rttiReadElem(data.spaceWidth, memory);
 
 			return size;
 		}
@@ -151,7 +152,7 @@ namespace BansheeEngine
 		static UINT32 getDynamicSize(const FONT_DESC& data)	
 		{ 
 			UINT64 dataSize = sizeof(UINT32);
-			dataSize += RTTIPlainType<Map<UINT32, CHAR_DESC>>::getDynamicSize(data.characters);
+			dataSize += rttiGetElemSize(data.characters);
 			dataSize += rttiGetElemSize(data.baselineOffset);
 			dataSize += rttiGetElemSize(data.lineHeight);
 			dataSize += rttiGetElemSize(data.missingGlyph);

+ 1 - 1
BansheeCore/Include/BsFontImportOptionsRTTI.h

@@ -6,7 +6,7 @@
 
 namespace BansheeEngine
 {
-	class BS_CORE_EXPORT FontImportOptionsRTTI : public RTTIType<FontImportOptions, IReflectable, FontImportOptionsRTTI>
+	class BS_CORE_EXPORT FontImportOptionsRTTI : public RTTIType<FontImportOptions, ImportOptions, FontImportOptionsRTTI>
 	{
 	private:
 		Vector<UINT32>& getFontSizes(FontImportOptions* obj) { return obj->mFontSizes; }

+ 1 - 1
BansheeCore/Include/BsGpuProgramImportOptionsRTTI.h

@@ -6,7 +6,7 @@
 
 namespace BansheeEngine
 {
-	class BS_CORE_EXPORT GpuProgramImportOptionsRTTI : public RTTIType<GpuProgramImportOptions, IReflectable, GpuProgramImportOptionsRTTI>
+	class BS_CORE_EXPORT GpuProgramImportOptionsRTTI : public RTTIType<GpuProgramImportOptions, ImportOptions, GpuProgramImportOptionsRTTI>
 	{
 	private:
 		String& getEntryPoint(GpuProgramImportOptions* obj) { return obj->mEntryPoint; }

+ 1 - 1
BansheeCore/Include/BsTextureImportOptionsRTTI.h

@@ -6,7 +6,7 @@
 
 namespace BansheeEngine
 {
-	class BS_CORE_EXPORT TextureImportOptionsRTTI : public RTTIType<TextureImportOptions, IReflectable, TextureImportOptionsRTTI>
+	class BS_CORE_EXPORT TextureImportOptionsRTTI : public RTTIType<TextureImportOptions, ImportOptions, TextureImportOptionsRTTI>
 	{
 	private:
 		PixelFormat& getPixelFormat(TextureImportOptions* obj) { return obj->mFormat; }

+ 1 - 1
BansheeCore/Source/BsResources.cpp

@@ -207,7 +207,7 @@ namespace BansheeEngine
 			BS_LOCK_MUTEX(mLoadedResourceMutex);
 			for(auto iter = mLoadedResources.begin(); iter != mLoadedResources.end(); ++iter)
 			{
-				if(iter->second.mData.unique()) // We just have this one reference, meaning nothing is using this resource
+				if (iter->second.mData.unique() && iter->second.mData->mPtr.unique()) // We just have this one reference, meaning nothing is using this resource
 					resourcesToUnload.push_back(iter->second);
 			}
 		}

+ 4 - 2
BansheeEditor/BansheeEditor.vcxproj

@@ -273,7 +273,7 @@
     <ClInclude Include="Include\BsDockManagerLayoutRTTI.h" />
     <ClInclude Include="Include\BsEditorApplication.h" />
     <ClInclude Include="Include\BsEditorCommand.h" />
-    <ClInclude Include="Include\BsEditorGUI.h" />
+    <ClInclude Include="Include\BsBuiltinEditorResources.h" />
     <ClInclude Include="Include\BsEditorTestSuite.h" />
     <ClInclude Include="Include\BsEditorWidgetLayout.h" />
     <ClInclude Include="Include\BsEditorWidgetLayoutRTTI.h" />
@@ -317,6 +317,7 @@
     <ClInclude Include="Include\BsResourceImporter.h" />
     <ClInclude Include="Include\BsSceneCameraController.h" />
     <ClInclude Include="Include\BsSceneEditorWidget.h" />
+    <ClInclude Include="Include\BsSceneGrid.h" />
     <ClInclude Include="Include\BsTestTextSprite.h" />
     <ClInclude Include="Include\DbgEditorWidget1.h" />
     <ClInclude Include="Include\DbgEditorWidget2.h" />
@@ -329,7 +330,7 @@
     <ClCompile Include="Source\BsDockManager.cpp" />
     <ClCompile Include="Source\BsDockManagerLayout.cpp" />
     <ClCompile Include="Source\BsEditorCommand.cpp" />
-    <ClCompile Include="Source\BsEditorGUI.cpp" />
+    <ClCompile Include="Source\BsBuiltinEditorResources.cpp" />
     <ClCompile Include="Source\BsEditorTestSuite.cpp" />
     <ClCompile Include="Source\BsEditorWidget.cpp" />
     <ClCompile Include="Source\BsEditorWidgetContainer.cpp" />
@@ -369,6 +370,7 @@
     <ClCompile Include="Source\BsResourceImporter.cpp" />
     <ClCompile Include="Source\BsSceneCameraController.cpp" />
     <ClCompile Include="Source\BsSceneEditorWidget.cpp" />
+    <ClCompile Include="Source\BsSceneGrid.cpp" />
     <ClCompile Include="Source\BsUndoRedo.cpp" />
     <ClCompile Include="Source\BsEditorApplication.cpp" />
     <ClCompile Include="Source\BsTestTextSprite.cpp" />

+ 12 - 6
BansheeEditor/BansheeEditor.vcxproj.filters

@@ -84,9 +84,6 @@
     <ClInclude Include="Include\BsGUIDockSlider.h">
       <Filter>Header Files\Editor</Filter>
     </ClInclude>
-    <ClInclude Include="Include\BsEditorGUI.h">
-      <Filter>Header Files\Editor</Filter>
-    </ClInclude>
     <ClInclude Include="Include\BsGUISceneTreeView.h">
       <Filter>Header Files\Editor</Filter>
     </ClInclude>
@@ -207,6 +204,12 @@
     <ClInclude Include="Include\BsSceneCameraController.h">
       <Filter>Header Files\Editor</Filter>
     </ClInclude>
+    <ClInclude Include="Include\BsSceneGrid.h">
+      <Filter>Header Files\Editor</Filter>
+    </ClInclude>
+    <ClInclude Include="Include\BsBuiltinEditorResources.h">
+      <Filter>Header Files\Editor</Filter>
+    </ClInclude>
   </ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\BsEditorWidgetContainer.cpp">
@@ -260,9 +263,6 @@
     <ClCompile Include="Source\BsGUIDockSlider.cpp">
       <Filter>Source Files\Editor</Filter>
     </ClCompile>
-    <ClCompile Include="Source\BsEditorGUI.cpp">
-      <Filter>Source Files\Editor</Filter>
-    </ClCompile>
     <ClCompile Include="Source\BsGUISceneTreeView.cpp">
       <Filter>Source Files\Editor</Filter>
     </ClCompile>
@@ -362,5 +362,11 @@
     <ClCompile Include="Source\BsSceneCameraController.cpp">
       <Filter>Source Files\Editor</Filter>
     </ClCompile>
+    <ClCompile Include="Source\BsSceneGrid.cpp">
+      <Filter>Source Files\Editor</Filter>
+    </ClCompile>
+    <ClCompile Include="Source\BsBuiltinEditorResources.cpp">
+      <Filter>Source Files\Editor</Filter>
+    </ClCompile>
   </ItemGroup>
 </Project>

+ 214 - 150
BansheeEditor/Include/BsEditorGUI.h → BansheeEditor/Include/BsBuiltinEditorResources.h

@@ -1,151 +1,215 @@
-#pragma once
-
-#include "BsEditorPrerequisites.h"
-#include "BsGUISkin.h"
-#include "BsModule.h"
-#include "BsPath.h"
-
-namespace BansheeEngine
-{
-	class BS_ED_EXPORT EditorGUI : public BansheeEngine::Module<EditorGUI>
-	{
-	public:
-		EditorGUI();
-
-		const GUISkin& getSkin() const { return mSkin; }
-
-		static const String ObjectFieldStyleName;
-		static const String ObjectFieldLabelStyleName;
-		static const String ObjectFieldDropBtnStyleName;
-		static const String ObjectFieldClearBtnStyleName;
-
-	private:
-		GUISkin mSkin;
-
-		static const Path DefaultFolder;
-
-		static const WString DefaultFontPath;
-		static const UINT32 DefaultFontSize;
-
-		static const WString WindowBackgroundTexture;
-
-		static const WString WindowFrameNormal;
-		static const WString WindowFrameFocused;
-
-		static const WString WindowTitleBarBg;
-
-		static const WString WindowCloseButtonNormal;
-		static const WString WindowCloseButtonHover;
-
-		static const WString WindowMinButtonNormal;
-		static const WString WindowMinButtonHover;
-
-		static const WString WindowMaxButtonNormal;
-		static const WString WindowMaxButtonHover;
-
-		static const WString TabbedBarBtnNormal;
-		static const WString TabbedBarBtnActive;
-
-		static const WString ButtonNormalTex;
-		static const WString ButtonHoverTex;
-		static const WString ButtonActiveTex;
-
-		static const WString ToggleNormalTex;
-		static const WString ToggleHoverTex;
-		static const WString ToggleActiveTex;
-		static const WString ToggleNormalOnTex;
-		static const WString ToggleHoverOnTex;
-		static const WString ToggleActiveOnTex;
-
-		static const WString ObjectDropBtnNormalTex;
-		static const WString ObjectDropBtnNormalOnTex;
-		static const WString ObjectClearBtnNormalTex;
-		static const WString ObjectClearBtnHoverTex;
-		static const WString ObjectClearBtnActiveTex;
-
-		static const WString FoldoutOpenNormalTex;
-		static const WString FoldoutOpenHoverTex;
-		static const WString FoldoutClosedNormalTex;
-		static const WString FoldoutClosedHoverTex;
-
-		static const WString CmpFoldoutOpenNormalTex;
-		static const WString CmpFoldoutOpenHoverTex;
-		static const WString CmpFoldoutOpenActiveTex;
-		static const WString CmpFoldoutClosedNormalTex;
-		static const WString CmpFoldoutClosedHoverTex;
-		static const WString CmpFoldoutClosedActiveTex;
-
-		static const WString InputBoxNormalTex;
-		static const WString InputBoxHoverTex;
-		static const WString InputBoxFocusedTex;
-
-		static const WString ScrollBarUpNormalTex;
-		static const WString ScrollBarUpHoverTex;
-		static const WString ScrollBarUpActiveTex;
-
-		static const WString ScrollBarDownNormalTex;
-		static const WString ScrollBarDownHoverTex;
-		static const WString ScrollBarDownActiveTex;
-
-		static const WString ScrollBarLeftNormalTex;
-		static const WString ScrollBarLeftHoverTex;
-		static const WString ScrollBarLeftActiveTex;
-
-		static const WString ScrollBarRightNormalTex;
-		static const WString ScrollBarRightHoverTex;
-		static const WString ScrollBarRightActiveTex;
-
-		static const WString ScrollBarHandleHorzNormalTex;
-		static const WString ScrollBarHandleHorzHoverTex;
-		static const WString ScrollBarHandleHorzActiveTex;
-
-		static const WString ScrollBarHandleVertNormalTex;
-		static const WString ScrollBarHandleVertHoverTex;
-		static const WString ScrollBarHandleVertActiveTex;
-
-		static const WString ScrollBarBgTex;
-
-		static const WString DropDownBtnNormalTex;
-		static const WString DropDownBtnHoverTex;
-
-		static const WString DropDownBoxBgTex;
-		static const WString DropDownBoxEntryNormalTex;
-		static const WString DropDownBoxEntryHoverTex;
-
-		static const WString DropDownBoxBtnUpNormalTex;
-		static const WString DropDownBoxBtnUpHoverTex;
-
-		static const WString DropDownBoxBtnDownNormalTex;
-		static const WString DropDownBoxBtnDownHoverTex;
-
-		static const WString DropDownBoxEntryExpNormalTex;
-		static const WString DropDownBoxEntryExpHoverTex;
-
-		static const WString DropDownSeparatorTex;
-
-		static const WString DropDownBoxBtnUpArrowTex;
-		static const WString DropDownBoxBtnDownArrowTex;
-
-		static const WString MenuBarBgTex;
-
-		static const WString MenuBarBtnNormalTex;
-		static const WString MenuBarBtnHoverTex;
-
-		static const WString MenuBarBansheeLogoTex;
-
-		static const WString DockSliderNormalTex;
-
-		static const WString TreeViewExpandButtonOffNormal;
-		static const WString TreeViewExpandButtonOffHover;
-		static const WString TreeViewExpandButtonOnNormal;
-		static const WString TreeViewExpandButtonOnHover;
-
-		static const WString TreeViewSelectionBackground;
-		static const WString TreeViewEditBox;
-
-		static const WString TreeViewElementHighlight;
-		static const WString TreeViewElementSepHighlight;
-
-		static HSpriteTexture getTexture(const WString& name);
-	};
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsGUISkin.h"
+#include "BsModule.h"
+#include "BsPath.h"
+#include "BsApplication.h"
+
+namespace BansheeEngine
+{
+	class BS_ED_EXPORT BuiltinEditorResources : public BansheeEngine::Module<BuiltinEditorResources>
+	{
+	public:
+		BuiltinEditorResources(RenderSystemPlugin activeRSPlugin);
+
+		const GUISkin& getSkin() const { return mSkin; }
+
+		/**
+		 * @brief	Creates a material used for docking drop overlay used by the editor.
+		 */
+		HMaterial createDockDropOverlayMaterial() const;
+
+		/**
+		 * @brief	Creates a material used for rendering the scene grid.
+		 */
+		HMaterial createSceneGridMaterial() const;
+
+		static const String ObjectFieldStyleName;
+		static const String ObjectFieldLabelStyleName;
+		static const String ObjectFieldDropBtnStyleName;
+		static const String ObjectFieldClearBtnStyleName;
+
+	private:
+		/**
+		 * @brief	Imports all necessary resources and converts them to engine-ready format.
+		 *
+		 * @note	Normally you only want to use this during development phase and then ship
+		 *			with engine-ready format only.
+		 */
+		void preprocess();
+
+		/**
+		 * @brief	Loads a GUI skin texture with the specified filename.
+		 */
+		static HSpriteTexture getGUITexture(const WString& name);
+
+		/**
+		 * @brief	Loads a GPU program with the specified filename.
+		 */
+		HGpuProgram getGpuProgram(const WString& name);
+
+		/**
+		 * @brief	Imports a GUI skin texture with the specified filename.
+		 *			Saves the imported texture in engine-ready format in the corresponding
+		 *			output folder.
+		 */
+		static void importGUITexture(const WString& name);
+
+		/**
+		 * @brief	Loads an compiles a shader for dock overlay rendering.
+		 */
+		void initDockDropOverlayShader();
+
+		/**
+		 * @brief	Loads an compiles a shader for scene grid rendering.
+		 */
+		void initSceneGridShader();
+
+		RenderSystemPlugin mRenderSystemPlugin;
+		WString mActiveShaderSubFolder;
+		String mActiveRenderSystem;
+
+		ShaderPtr mShaderDockOverlay;
+		ShaderPtr mShaderSceneGrid;
+
+		GUISkin mSkin;
+
+		static const Path DefaultSkinFolder;
+		static const Path DefaultSkinFolderRaw;
+
+		static const Path DefaultShaderFolder;
+		static const Path DefaultShaderFolderRaw;
+
+		static const WString HLSL11ShaderSubFolder;
+		static const WString HLSL9ShaderSubFolder;
+		static const WString GLSLShaderSubFolder;
+
+		static const WString DefaultFontFilename;
+		static const UINT32 DefaultFontSize;
+
+		static const WString WindowBackgroundTexture;
+
+		static const WString WindowFrameNormal;
+		static const WString WindowFrameFocused;
+
+		static const WString WindowTitleBarBg;
+
+		static const WString WindowCloseButtonNormal;
+		static const WString WindowCloseButtonHover;
+
+		static const WString WindowMinButtonNormal;
+		static const WString WindowMinButtonHover;
+
+		static const WString WindowMaxButtonNormal;
+		static const WString WindowMaxButtonHover;
+
+		static const WString TabbedBarBtnNormal;
+		static const WString TabbedBarBtnActive;
+
+		static const WString ButtonNormalTex;
+		static const WString ButtonHoverTex;
+		static const WString ButtonActiveTex;
+
+		static const WString ToggleNormalTex;
+		static const WString ToggleHoverTex;
+		static const WString ToggleActiveTex;
+		static const WString ToggleNormalOnTex;
+		static const WString ToggleHoverOnTex;
+		static const WString ToggleActiveOnTex;
+
+		static const WString ObjectDropBtnNormalTex;
+		static const WString ObjectDropBtnNormalOnTex;
+		static const WString ObjectClearBtnNormalTex;
+		static const WString ObjectClearBtnHoverTex;
+		static const WString ObjectClearBtnActiveTex;
+
+		static const WString FoldoutOpenNormalTex;
+		static const WString FoldoutOpenHoverTex;
+		static const WString FoldoutClosedNormalTex;
+		static const WString FoldoutClosedHoverTex;
+
+		static const WString CmpFoldoutOpenNormalTex;
+		static const WString CmpFoldoutOpenHoverTex;
+		static const WString CmpFoldoutOpenActiveTex;
+		static const WString CmpFoldoutClosedNormalTex;
+		static const WString CmpFoldoutClosedHoverTex;
+		static const WString CmpFoldoutClosedActiveTex;
+
+		static const WString InputBoxNormalTex;
+		static const WString InputBoxHoverTex;
+		static const WString InputBoxFocusedTex;
+
+		static const WString ScrollBarUpNormalTex;
+		static const WString ScrollBarUpHoverTex;
+		static const WString ScrollBarUpActiveTex;
+
+		static const WString ScrollBarDownNormalTex;
+		static const WString ScrollBarDownHoverTex;
+		static const WString ScrollBarDownActiveTex;
+
+		static const WString ScrollBarLeftNormalTex;
+		static const WString ScrollBarLeftHoverTex;
+		static const WString ScrollBarLeftActiveTex;
+
+		static const WString ScrollBarRightNormalTex;
+		static const WString ScrollBarRightHoverTex;
+		static const WString ScrollBarRightActiveTex;
+
+		static const WString ScrollBarHandleHorzNormalTex;
+		static const WString ScrollBarHandleHorzHoverTex;
+		static const WString ScrollBarHandleHorzActiveTex;
+
+		static const WString ScrollBarHandleVertNormalTex;
+		static const WString ScrollBarHandleVertHoverTex;
+		static const WString ScrollBarHandleVertActiveTex;
+
+		static const WString ScrollBarBgTex;
+
+		static const WString DropDownBtnNormalTex;
+		static const WString DropDownBtnHoverTex;
+
+		static const WString DropDownBoxBgTex;
+		static const WString DropDownBoxEntryNormalTex;
+		static const WString DropDownBoxEntryHoverTex;
+
+		static const WString DropDownBoxBtnUpNormalTex;
+		static const WString DropDownBoxBtnUpHoverTex;
+
+		static const WString DropDownBoxBtnDownNormalTex;
+		static const WString DropDownBoxBtnDownHoverTex;
+
+		static const WString DropDownBoxEntryExpNormalTex;
+		static const WString DropDownBoxEntryExpHoverTex;
+
+		static const WString DropDownSeparatorTex;
+
+		static const WString DropDownBoxBtnUpArrowTex;
+		static const WString DropDownBoxBtnDownArrowTex;
+
+		static const WString MenuBarBgTex;
+
+		static const WString MenuBarBtnNormalTex;
+		static const WString MenuBarBtnHoverTex;
+
+		static const WString MenuBarBansheeLogoTex;
+
+		static const WString DockSliderNormalTex;
+
+		static const WString TreeViewExpandButtonOffNormal;
+		static const WString TreeViewExpandButtonOffHover;
+		static const WString TreeViewExpandButtonOnNormal;
+		static const WString TreeViewExpandButtonOnHover;
+
+		static const WString TreeViewSelectionBackground;
+		static const WString TreeViewEditBox;
+
+		static const WString TreeViewElementHighlight;
+		static const WString TreeViewElementSepHighlight;
+
+		static const WString ShaderDockOverlayVSFile;
+		static const WString ShaderDockOverlayPSFile;
+		static const WString SceneGridVSFile;
+		static const WString SceneGridPSFile;
+	};
 }

+ 41 - 0
BansheeEditor/Include/BsSceneGrid.h

@@ -0,0 +1,41 @@
+#pragma once
+
+#include "BsEditorPrerequisites.h"
+#include "BsVector3.h"
+#include "BsColor.h"
+
+namespace BansheeEngine
+{
+	class SceneGrid
+	{
+	public:
+		SceneGrid();
+
+		void setOrigin(const Vector3& origin);
+		void setSize(float size);
+		void setSpacing(float spacing);
+		void setMajorAxisSpacing(UINT32 spacing);
+		void setAxisMarkerSpacing(UINT32 spacing);
+
+	private:
+		void updateGridMesh();
+
+		HMesh mGridMesh;
+		VertexDataDescPtr mVertexDesc;
+
+		Vector3 mOrigin;
+		float mSpacing = 1.0f;
+		float mSize = 256.0f;
+		UINT32 mMajorAxisSpacing = 10;
+		UINT32 mAxisMarkerSpacing = 25;
+
+		static const float LINE_WIDTH;
+		static const float LINE_BORDER_WIDTH;
+		static const float MAJOR_AXIS_WIDTH;
+		static const float MAJOR_AXIS_BORDER_WIDTH;
+		static const float AXIS_MARKER_WIDTH;
+		static const float AXIS_MARKER_BORDER_WIDTH;
+		static const Color AXIS_X_MARKER_COLOR;
+		static const Color AXIS_Z_MARKER_COLOR;
+	};
+}

+ 1244 - 977
BansheeEditor/Source/BsEditorGUI.cpp → BansheeEditor/Source/BsBuiltinEditorResources.cpp

@@ -1,978 +1,1245 @@
-#include "BsEditorGUI.h"
-#include "BsGUIElementStyle.h"
-
-#include "BsGUILabel.h"
-#include "BsGUIButton.h"
-#include "BsGUIInputBox.h"
-#include "BsGUIToggle.h"
-#include "BsGUIColor.h"
-#include "BsTextSprite.h"
-#include "BsSpriteTexture.h"
-#include "BsGUITreeViewEditBox.h"
-
-#include "BsGUIIntField.h"
-#include "BsGUIFloatField.h"
-#include "BsGUIColorField.h"
-#include "BsGUITextField.h"
-#include "BsGUIToggleField.h"
-#include "BsGUIVector2Field.h"
-#include "BsGUIVector3Field.h"
-#include "BsGUIVector4Field.h"
-#include "BsGUIComponentFoldout.h"
-#include "BsGUIFoldout.h"
-
-#include "BsFont.h"
-#include "BsFontImportOptions.h"
-#include "BsImporter.h"
-#include "BsRTTIType.h"
-#include "BsFileSystem.h"
-
-namespace BansheeEngine
-{
-	const String EditorGUI::ObjectFieldStyleName = "GUIObjectField";
-	const String EditorGUI::ObjectFieldLabelStyleName = "EditorFieldLabel";
-	const String EditorGUI::ObjectFieldDropBtnStyleName = "DropButton";
-	const String EditorGUI::ObjectFieldClearBtnStyleName = "ObjectClearButton";
-
-	const WString EditorGUI::DefaultFontPath = L"arial.ttf";
-	const UINT32 EditorGUI::DefaultFontSize = 10;
-
-	const Path EditorGUI::DefaultFolder = L"..\\..\\..\\..\\Data\\Editor\\Skin\\";
-
-	const WString EditorGUI::WindowBackgroundTexture = L"WindowBgTile.psd";
-
-	const WString EditorGUI::ButtonNormalTex = L"ButtonNormal.psd";
-	const WString EditorGUI::ButtonHoverTex = L"ButtonHover.psd";
-	const WString EditorGUI::ButtonActiveTex = L"ButtonActive.psd";
-
-	const WString EditorGUI::ToggleNormalTex = L"ToggleNormal.psd";
-	const WString EditorGUI::ToggleHoverTex = L"ToggleHover.psd";
-	const WString EditorGUI::ToggleActiveTex = L"ToggleActive.psd";
-	const WString EditorGUI::ToggleNormalOnTex = L"ToggleOnNormal.psd";
-	const WString EditorGUI::ToggleHoverOnTex = L"ToggleOnHover.psd";
-	const WString EditorGUI::ToggleActiveOnTex = L"ToggleOnActive.psd";
-
-	const WString EditorGUI::ObjectDropBtnNormalTex = L"ObjectFieldDropNormal.psd";
-	const WString EditorGUI::ObjectDropBtnNormalOnTex = L"ObjectFieldDropNormalOn.psd";
-	const WString EditorGUI::ObjectClearBtnNormalTex = L"ObjectFieldBtnNormal.psd";
-	const WString EditorGUI::ObjectClearBtnHoverTex = L"ObjectFieldBtnHover.psd";
-	const WString EditorGUI::ObjectClearBtnActiveTex = L"ObjectFieldBtnActive.psd";
-
-	const WString EditorGUI::FoldoutOpenNormalTex = L"FoldoutOpenNormal.psd";
-	const WString EditorGUI::FoldoutOpenHoverTex = L"FoldoutOpenHover.psd";
-	const WString EditorGUI::FoldoutClosedNormalTex = L"FoldoutClosedNormal.psd";
-	const WString EditorGUI::FoldoutClosedHoverTex = L"FoldoutClosedHover.psd";
-
-	const WString EditorGUI::CmpFoldoutOpenNormalTex = L"CmpFoldoutOpenNormal.psd";
-	const WString EditorGUI::CmpFoldoutOpenHoverTex = L"CmpFoldoutOpenHover.psd";
-	const WString EditorGUI::CmpFoldoutOpenActiveTex = L"CmpFoldoutOpenActive.psd";
-	const WString EditorGUI::CmpFoldoutClosedNormalTex = L"CmpFoldoutClosedNormal.psd";
-	const WString EditorGUI::CmpFoldoutClosedHoverTex = L"CmpFoldoutClosedHover.psd";
-	const WString EditorGUI::CmpFoldoutClosedActiveTex = L"CmpFoldoutClosedActive.psd";
-
-	const WString EditorGUI::WindowFrameNormal = L"WindowFrameNormal.psd";
-	const WString EditorGUI::WindowFrameFocused = L"WindowFrameFocused.psd";
-
-	const WString EditorGUI::WindowTitleBarBg = L"WindowTitleBarBg.psd";
-
-	const WString EditorGUI::WindowCloseButtonNormal = L"WindowCloseBtnNormal.psd";
-	const WString EditorGUI::WindowCloseButtonHover = L"WindowCloseBtnHover.psd";
-
-	const WString EditorGUI::WindowMinButtonNormal = L"WindowMaxBtnNormal.psd";
-	const WString EditorGUI::WindowMinButtonHover = L"WindowMaxBtnHover.psd";
-
-	const WString EditorGUI::WindowMaxButtonNormal = L"WindowMinBtnNormal.psd";
-	const WString EditorGUI::WindowMaxButtonHover = L"WindowMinBtnHover.psd";
-
-	const WString EditorGUI::TabbedBarBtnNormal = L"TabbedButtonNormal.psd";
-	const WString EditorGUI::TabbedBarBtnActive = L"TabbedButtonActive.psd";
-
-	const WString EditorGUI::InputBoxNormalTex = L"InputBoxNormal.psd";
-	const WString EditorGUI::InputBoxHoverTex = L"InputBoxHover.psd";
-	const WString EditorGUI::InputBoxFocusedTex = L"InputBoxFocused.psd";
-
-	const WString EditorGUI::ScrollBarUpNormalTex = L"ScrollBarUpNormal.psd";
-	const WString EditorGUI::ScrollBarUpHoverTex = L"ScrollBarUpHover.psd";
-	const WString EditorGUI::ScrollBarUpActiveTex = L"ScrollBarUpActive.psd";
-
-	const WString EditorGUI::ScrollBarDownNormalTex = L"ScrollBarDownNormal.psd";
-	const WString EditorGUI::ScrollBarDownHoverTex = L"ScrollBarDownHover.psd";
-	const WString EditorGUI::ScrollBarDownActiveTex = L"ScrollBarDownActive.psd";
-
-	const WString EditorGUI::ScrollBarLeftNormalTex = L"ScrollBarLeftNormal.psd";
-	const WString EditorGUI::ScrollBarLeftHoverTex = L"ScrollBarLeftHover.psd";
-	const WString EditorGUI::ScrollBarLeftActiveTex = L"ScrollBarLeftActive.psd";
-
-	const WString EditorGUI::ScrollBarRightNormalTex = L"ScrollBarRightNormal.psd";
-	const WString EditorGUI::ScrollBarRightHoverTex = L"ScrollBarRightHover.psd";
-	const WString EditorGUI::ScrollBarRightActiveTex = L"ScrollBarRightActive.psd";
-
-	const WString EditorGUI::ScrollBarHandleHorzNormalTex = L"ScrollBarHorzHandleNormal.psd";
-	const WString EditorGUI::ScrollBarHandleHorzHoverTex = L"ScrollBarHorzHandleHover.psd";
-	const WString EditorGUI::ScrollBarHandleHorzActiveTex = L"ScrollBarHorzHandleActive.psd";
-
-	const WString EditorGUI::ScrollBarHandleVertNormalTex = L"ScrollBarVertHandleNormal.psd";
-	const WString EditorGUI::ScrollBarHandleVertHoverTex = L"ScrollBarVertHandleHover.psd";
-	const WString EditorGUI::ScrollBarHandleVertActiveTex = L"ScrollBarVertHandleActive.psd";
-
-	const WString EditorGUI::DropDownBtnNormalTex = L"DropDownNormal.psd";
-	const WString EditorGUI::DropDownBtnHoverTex = L"DropDownHover.psd";
-
-	const WString EditorGUI::DropDownBoxBgTex = L"DropDownBoxBg.psd";
-	const WString EditorGUI::DropDownBoxEntryNormalTex = L"DropDownButtonNormal.psd";
-	const WString EditorGUI::DropDownBoxEntryHoverTex = L"DropDownButtonHover.psd";
-
-	const WString EditorGUI::DropDownBoxBtnUpNormalTex = L"DropDownBoxBtnUpNormal.psd";
-	const WString EditorGUI::DropDownBoxBtnUpHoverTex = L"DropDownBoxBtnUpHover.psd";
-
-	const WString EditorGUI::DropDownBoxBtnDownNormalTex = L"DropDownBoxBtnDownNormal.psd";
-	const WString EditorGUI::DropDownBoxBtnDownHoverTex = L"DropDownBoxBtnDownHover.psd";
-
-	const WString EditorGUI::DropDownBoxEntryExpNormalTex = L"DropDownExpNormal.psd";
-	const WString EditorGUI::DropDownBoxEntryExpHoverTex = L"DropDownExpHover.psd";
-
-	const WString EditorGUI::DropDownSeparatorTex = L"DropDownSeparator.psd";
-
-	const WString EditorGUI::DropDownBoxBtnUpArrowTex = L"DropDownBoxBtnUpArrow.psd";
-	const WString EditorGUI::DropDownBoxBtnDownArrowTex = L"DropDownBoxBtnDownArrow.psd";
-
-	const WString EditorGUI::ScrollBarBgTex = L"ScrollBarBg.psd";
-
-	const WString EditorGUI::MenuBarBgTex = L"MenuBarBg.psd";
-
-	const WString EditorGUI::MenuBarBtnNormalTex = L"MenuBarButtonNormal.psd";
-	const WString EditorGUI::MenuBarBtnHoverTex = L"MenuBarButtonHover.psd";
-
-	const WString EditorGUI::MenuBarBansheeLogoTex = L"MenuBarBansheeLogo.psd";
-
-	const WString EditorGUI::DockSliderNormalTex = L"DockSliderBtn.psd";
-
-	const WString EditorGUI::TreeViewExpandButtonOffNormal = L"TreeViewExpandButtonOffNormal.psd";
-	const WString EditorGUI::TreeViewExpandButtonOffHover = L"TreeViewExpandButtonOffHover.psd";
-	const WString EditorGUI::TreeViewExpandButtonOnNormal = L"TreeViewExpandButtonOnNormal.psd";
-	const WString EditorGUI::TreeViewExpandButtonOnHover = L"TreeViewExpandButtonOnHover.psd";
-
-	const WString EditorGUI::TreeViewSelectionBackground = L"TreeViewSelectionBackground.psd";
-	const WString EditorGUI::TreeViewEditBox = L"TreeViewEditBox.psd";
-	const WString EditorGUI::TreeViewElementHighlight = L"TreeViewElementHighlight.psd";
-	const WString EditorGUI::TreeViewElementSepHighlight = L"TreeViewElementSepHighlight.psd";
-
-	EditorGUI::EditorGUI()
-	{
-		// TODO - Normally I want to load this from some file
-
-		// Label
-		// TODO - Instead of importing font every time, try to save a resource and then just load it?
-		HFont font;
-
-		{
-			Path fontPath = DefaultFolder;
-			fontPath.append(DefaultFontPath);
-
-			ImportOptionsPtr fontImportOptions = Importer::instance().createImportOptions(fontPath);
-			if(rtti_is_of_type<FontImportOptions>(fontImportOptions))
-			{
-				FontImportOptions* importOptions = static_cast<FontImportOptions*>(fontImportOptions.get());
-
-				Vector<BansheeEngine::UINT32> fontSizes;
-				fontSizes.push_back(DefaultFontSize);
-				importOptions->setFontSizes(fontSizes);
-				importOptions->setAntialiasing(false);
-			}
-
-			font = Importer::instance().import(fontPath, fontImportOptions);
-		}
-
-		GUIElementStyle labelStyle;
-		labelStyle.font = font;
-		labelStyle.fontSize = DefaultFontSize;
-		labelStyle.fixedWidth = false;
-		labelStyle.fixedHeight = true;
-		labelStyle.height = 11;
-		labelStyle.minWidth = 10;
-
-		mSkin.setStyle(GUILabel::getGUITypeName(), labelStyle);
-
-		// Window frame
-		GUIElementStyle windowFrameStyle;
-		windowFrameStyle.normal.texture = getTexture(WindowFrameNormal);
-		windowFrameStyle.focused.texture = getTexture(WindowFrameFocused);
-		windowFrameStyle.border.left = 1;
-		windowFrameStyle.border.right = 1;
-		windowFrameStyle.border.top = 1;
-		windowFrameStyle.border.bottom = 1;
-
-		mSkin.setStyle("WindowFrame", windowFrameStyle);
-
-		// Button
-		GUIElementStyle buttonStyle;
-		buttonStyle.normal.texture = getTexture(ButtonNormalTex);
-		buttonStyle.hover.texture = getTexture(ButtonHoverTex);
-		buttonStyle.active.texture = getTexture(ButtonActiveTex);
-		buttonStyle.border.left = 6;
-		buttonStyle.border.right = 6;
-		buttonStyle.border.top = 6;
-		buttonStyle.border.bottom = 6;
-		buttonStyle.contentOffset.left = 3;
-		buttonStyle.contentOffset.right = 3;
-		buttonStyle.fixedHeight = true;
-		buttonStyle.height = 15;
-		buttonStyle.minWidth = 50;
-		buttonStyle.font = font;
-		buttonStyle.fontSize = DefaultFontSize;
-		buttonStyle.textHorzAlign = THA_Center;
-		buttonStyle.textVertAlign = TVA_Center;
-
-		mSkin.setStyle(GUIButton::getGUITypeName(), buttonStyle);
-
-		// Toggle
-		GUIElementStyle toggleStyle;
-		toggleStyle.normal.texture = getTexture(ToggleNormalTex);
-		toggleStyle.hover.texture = getTexture(ToggleHoverTex);
-		toggleStyle.active.texture = getTexture(ToggleActiveTex);
-		toggleStyle.normalOn.texture = getTexture(ToggleNormalOnTex);
-		toggleStyle.hoverOn.texture = getTexture(ToggleHoverOnTex);
-		toggleStyle.activeOn.texture = getTexture(ToggleActiveOnTex);
-		toggleStyle.fixedHeight = true;
-		toggleStyle.fixedWidth = true;
-		toggleStyle.height = 15;
-		toggleStyle.width = 15;
-
-		mSkin.setStyle(GUIToggle::getGUITypeName(), toggleStyle);
-
-		// Color
-		GUIElementStyle colorStyle;
-		colorStyle.margins.left = 2;
-		colorStyle.margins.right = 2;
-		colorStyle.margins.top = 2;
-		colorStyle.margins.bottom = 2;
-		colorStyle.fixedHeight = true;
-		colorStyle.height = 10;
-		colorStyle.minWidth = 10;
-
-		mSkin.setStyle(GUIColor::getGUITypeName(), colorStyle);
-
-		// Window background texture
-		GUIElementStyle windowBgStyle;
-		windowBgStyle.normal.texture = getTexture(WindowBackgroundTexture);
-
-		mSkin.setStyle("WindowBackground", windowBgStyle);
-
-		// Window title bar background
-		GUIElementStyle titleBarBgStyle;
-		titleBarBgStyle.normal.texture = getTexture(WindowTitleBarBg);
-		titleBarBgStyle.fixedHeight = true;
-		titleBarBgStyle.height = 13;
-
-		mSkin.setStyle("TitleBarBackground", titleBarBgStyle);
-
-		// Tabbed title bar tab button
-		GUIElementStyle tabbedBarButton;
-		tabbedBarButton.normal.texture = getTexture(TabbedBarBtnNormal);
-		tabbedBarButton.hover.texture = getTexture(TabbedBarBtnActive);
-		tabbedBarButton.active.texture = tabbedBarButton.hover.texture;
-		tabbedBarButton.normalOn.texture = tabbedBarButton.hover.texture;
-		tabbedBarButton.hoverOn.texture = tabbedBarButton.hover.texture;
-		tabbedBarButton.activeOn.texture = tabbedBarButton.hover.texture;
-		tabbedBarButton.fixedHeight = true;
-		tabbedBarButton.height = 13;
-		tabbedBarButton.minWidth = 10;
-		tabbedBarButton.maxWidth = 110;
-		tabbedBarButton.font = font;
-		tabbedBarButton.fontSize = DefaultFontSize;
-		tabbedBarButton.textHorzAlign = THA_Center;
-		tabbedBarButton.textVertAlign = TVA_Center;
-
-		mSkin.setStyle("TabbedBarBtn", tabbedBarButton);
-
-		// Tabbed title bar drag/drop button
-		GUIElementStyle tabbedBarDropButton;
-		tabbedBarDropButton.fixedHeight = true;
-		tabbedBarDropButton.fixedWidth = true;
-		tabbedBarDropButton.height = 13;
-		tabbedBarDropButton.width = 6;
-
-		mSkin.setStyle("TabbedBarDropArea", tabbedBarDropButton);
-
-		// Window minimize button
-		GUIElementStyle winMinButtonStyle;
-		winMinButtonStyle.normal.texture = getTexture(WindowMinButtonNormal);
-		winMinButtonStyle.hover.texture = getTexture(WindowMinButtonHover);
-		winMinButtonStyle.active.texture = winMinButtonStyle.hover.texture;
-		winMinButtonStyle.fixedHeight = true;
-		winMinButtonStyle.fixedWidth = true;
-		winMinButtonStyle.height = 7;
-		winMinButtonStyle.width = 8;
-
-		mSkin.setStyle("WinMinimizeBtn", winMinButtonStyle);
-
-		// Window maximize button
-		GUIElementStyle winMaxButtonStyle;
-		winMaxButtonStyle.normal.texture = getTexture(WindowMaxButtonNormal);
-		winMaxButtonStyle.hover.texture = getTexture(WindowMaxButtonHover);
-		winMaxButtonStyle.active.texture = winMaxButtonStyle.hover.texture;
-		winMaxButtonStyle.fixedHeight = true;
-		winMaxButtonStyle.fixedWidth = true;
-		winMaxButtonStyle.height = 8;
-		winMaxButtonStyle.width = 8;
-
-		mSkin.setStyle("WinMaximizeBtn", winMaxButtonStyle);
-
-		// Window close button
-		GUIElementStyle winCloseButtonStyle;
-		winCloseButtonStyle.normal.texture = getTexture(WindowCloseButtonNormal);
-		winCloseButtonStyle.hover.texture = getTexture(WindowCloseButtonHover);
-		winCloseButtonStyle.active.texture = winCloseButtonStyle.hover.texture;
-		winCloseButtonStyle.fixedHeight = true;
-		winCloseButtonStyle.fixedWidth = true;
-		winCloseButtonStyle.height = 7;
-		winCloseButtonStyle.width = 8;
-
-		mSkin.setStyle("WinCloseBtn", winCloseButtonStyle);
-
-		// Input box
-		GUIElementStyle inputBoxStyle;
-		inputBoxStyle.normal.texture = getTexture(InputBoxNormalTex);
-		inputBoxStyle.hover.texture = getTexture(InputBoxHoverTex);
-		inputBoxStyle.focused.texture = getTexture(InputBoxFocusedTex);
-		inputBoxStyle.active.texture = inputBoxStyle.normal.texture;
-		inputBoxStyle.border.left = 1;
-		inputBoxStyle.border.right = 1;
-		inputBoxStyle.border.top = 1;
-		inputBoxStyle.border.bottom = 1;
-		inputBoxStyle.contentOffset.left = 3;
-		inputBoxStyle.contentOffset.right = 3;
-		inputBoxStyle.contentOffset.top = 2;
-		inputBoxStyle.contentOffset.bottom = 2;
-		inputBoxStyle.fixedHeight = true;
-		inputBoxStyle.height = 15;
-		inputBoxStyle.minWidth = 10;
-		inputBoxStyle.font = font;
-		inputBoxStyle.fontSize = DefaultFontSize;
-		inputBoxStyle.textHorzAlign = THA_Left;
-		inputBoxStyle.textVertAlign = TVA_Top;
-
-		mSkin.setStyle(GUIInputBox::getGUITypeName(), inputBoxStyle);
-
-		/************************************************************************/
-		/* 								SCROLL BAR                      		*/
-		/************************************************************************/
-
-		// Up button
-		GUIElementStyle scrollUpBtnStyle;
-		scrollUpBtnStyle.normal.texture = getTexture(ScrollBarUpNormalTex);
-		scrollUpBtnStyle.hover.texture = getTexture(ScrollBarUpHoverTex);
-		scrollUpBtnStyle.active.texture = getTexture(ScrollBarUpActiveTex);
-		scrollUpBtnStyle.fixedHeight = true;
-		scrollUpBtnStyle.fixedWidth = true;
-		scrollUpBtnStyle.height = 4;
-		scrollUpBtnStyle.width = 8;
-
-		mSkin.setStyle("ScrollUpBtn", scrollUpBtnStyle);
-
-		// Down button
-		GUIElementStyle scrollDownBtnStyle;
-		scrollDownBtnStyle.normal.texture = getTexture(ScrollBarDownNormalTex);
-		scrollDownBtnStyle.hover.texture = getTexture(ScrollBarDownHoverTex);
-		scrollDownBtnStyle.active.texture = getTexture(ScrollBarDownActiveTex);
-		scrollDownBtnStyle.fixedHeight = true;
-		scrollDownBtnStyle.fixedWidth = true;
-		scrollDownBtnStyle.height = 4;
-		scrollDownBtnStyle.width = 8;
-
-		mSkin.setStyle("ScrollDownBtn", scrollDownBtnStyle);
-
-		// Left button
-		GUIElementStyle scrollLeftBtnStyle;
-		scrollLeftBtnStyle.normal.texture = getTexture(ScrollBarLeftNormalTex);
-		scrollLeftBtnStyle.hover.texture = getTexture(ScrollBarLeftHoverTex);
-		scrollLeftBtnStyle.active.texture = getTexture(ScrollBarLeftActiveTex);
-		scrollLeftBtnStyle.fixedHeight = true;
-		scrollLeftBtnStyle.fixedWidth = true;
-		scrollLeftBtnStyle.height = 8;
-		scrollLeftBtnStyle.width = 4;
-
-		mSkin.setStyle("ScrollLeftBtn", scrollLeftBtnStyle);
-
-		// Right button
-		GUIElementStyle scrollRightBtnStyle;
-		scrollRightBtnStyle.normal.texture = getTexture(ScrollBarRightNormalTex);
-		scrollRightBtnStyle.hover.texture = getTexture(ScrollBarRightHoverTex);
-		scrollRightBtnStyle.active.texture = getTexture(ScrollBarRightActiveTex);
-		scrollRightBtnStyle.fixedHeight = true;
-		scrollRightBtnStyle.fixedWidth = true;
-		scrollRightBtnStyle.height = 8;
-		scrollRightBtnStyle.width = 4;
-
-		mSkin.setStyle("ScrollRightBtn", scrollRightBtnStyle);
-
-		// Horizontal handle
-		GUIElementStyle scrollBarHorzBtnStyle;
-		scrollBarHorzBtnStyle.normal.texture = getTexture(ScrollBarHandleHorzNormalTex);
-		scrollBarHorzBtnStyle.hover.texture = getTexture(ScrollBarHandleHorzHoverTex);
-		scrollBarHorzBtnStyle.active.texture = getTexture(ScrollBarHandleHorzActiveTex);
-		scrollBarHorzBtnStyle.fixedHeight = true;
-		scrollBarHorzBtnStyle.fixedWidth = true;
-		scrollBarHorzBtnStyle.height = 6;
-		scrollBarHorzBtnStyle.width = 4;
-
-		mSkin.setStyle("ScrollBarHorzBtn", scrollBarHorzBtnStyle);
-
-		// Vertical handle
-		GUIElementStyle scrollBarVertBtnStyle;
-		scrollBarVertBtnStyle.normal.texture = getTexture(ScrollBarHandleVertNormalTex);
-		scrollBarVertBtnStyle.hover.texture = getTexture(ScrollBarHandleVertHoverTex);
-		scrollBarVertBtnStyle.active.texture = getTexture(ScrollBarHandleVertActiveTex);
-		scrollBarVertBtnStyle.fixedHeight = true;
-		scrollBarVertBtnStyle.fixedWidth = true;
-		scrollBarVertBtnStyle.height = 4;
-		scrollBarVertBtnStyle.width = 6;
-
-		mSkin.setStyle("ScrollBarVertBtn", scrollBarVertBtnStyle);
-
-		HSpriteTexture scrollBarBgPtr = getTexture(ScrollBarBgTex);
-
-		// Vertical scroll bar
-		GUIElementStyle vertScrollBarStyle;
-		vertScrollBarStyle.normal.texture = scrollBarBgPtr;
-		vertScrollBarStyle.hover.texture = scrollBarBgPtr;
-		vertScrollBarStyle.active.texture = scrollBarBgPtr;
-		vertScrollBarStyle.fixedHeight = false;
-		vertScrollBarStyle.fixedWidth = true;
-		vertScrollBarStyle.minHeight = 16;
-		vertScrollBarStyle.width = 8;
-
-		mSkin.setStyle("ScrollBarVert", vertScrollBarStyle);
-
-		// Horizontal scroll bar
-		GUIElementStyle horzScrollBarStyle;
-		horzScrollBarStyle.normal.texture = scrollBarBgPtr;
-		horzScrollBarStyle.hover.texture = scrollBarBgPtr;
-		horzScrollBarStyle.active.texture = scrollBarBgPtr;
-		horzScrollBarStyle.fixedHeight = true;
-		horzScrollBarStyle.fixedWidth = false;
-		horzScrollBarStyle.minWidth = 16;
-		horzScrollBarStyle.height = 8;
-
-		mSkin.setStyle("ScrollBarHorz", horzScrollBarStyle);
-
-		/************************************************************************/
-		/* 								DROP DOWN BOX                      		*/
-		/************************************************************************/
-
-		// ListBox button
-		GUIElementStyle dropDownListStyle;
-		dropDownListStyle.normal.texture = getTexture(DropDownBtnNormalTex);
-		dropDownListStyle.hover.texture = getTexture(DropDownBtnHoverTex);
-		dropDownListStyle.active.texture = dropDownListStyle.hover.texture;
-		dropDownListStyle.normalOn.texture = dropDownListStyle.hover.texture;
-		dropDownListStyle.hoverOn.texture = dropDownListStyle.hover.texture;
-		dropDownListStyle.activeOn.texture = dropDownListStyle.hover.texture;
-		dropDownListStyle.fixedHeight = true;
-		dropDownListStyle.fixedWidth = false;
-		dropDownListStyle.height = 13;
-		dropDownListStyle.width = 30;
-		dropDownListStyle.contentOffset.left = 3;
-		dropDownListStyle.contentOffset.right = 11;
-		dropDownListStyle.contentOffset.top = 1;
-		dropDownListStyle.contentOffset.bottom = 1;
-		dropDownListStyle.border.left = 1;
-		dropDownListStyle.border.right = 10;
-		dropDownListStyle.border.top = 1;
-		dropDownListStyle.border.bottom = 1;
-		dropDownListStyle.font = font;
-		dropDownListStyle.fontSize = DefaultFontSize;
-		dropDownListStyle.textHorzAlign = THA_Left;
-		dropDownListStyle.textVertAlign = TVA_Top;
-
-		mSkin.setStyle("ListBox", dropDownListStyle);
-
-		// DropDown scroll up button arrow
-		HTexture dropDownBtnScrollUpArrow = getTexture(DropDownBoxBtnUpArrowTex);
-
-		GUIElementStyle dropDownScrollUpBtnArrowStyle;
-		dropDownScrollUpBtnArrowStyle.normal.texture = getTexture(DropDownBoxBtnUpArrowTex);
-		dropDownScrollUpBtnArrowStyle.hover.texture = dropDownScrollUpBtnArrowStyle.normal.texture;
-		dropDownScrollUpBtnArrowStyle.active.texture = dropDownScrollUpBtnArrowStyle.hover.texture;
-		dropDownScrollUpBtnArrowStyle.fixedHeight = true;
-		dropDownScrollUpBtnArrowStyle.fixedWidth = false;
-		dropDownScrollUpBtnArrowStyle.height = 7;
-		dropDownScrollUpBtnArrowStyle.width = 30;
-		dropDownScrollUpBtnArrowStyle.border.left = 1;
-		dropDownScrollUpBtnArrowStyle.border.right = 1;
-		dropDownScrollUpBtnArrowStyle.border.top = 1;
-		dropDownScrollUpBtnArrowStyle.border.bottom = 1;
-
-		mSkin.setStyle("ListBoxScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
-		mSkin.setStyle("MenuBarScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
-		mSkin.setStyle("ContextMenuScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
-
-		// DropDown scroll up button
-		GUIElementStyle dropDownScrollUpBtnStyle;
-		dropDownScrollUpBtnStyle.normal.texture = getTexture(DropDownBoxBtnUpNormalTex);
-		dropDownScrollUpBtnStyle.hover.texture = getTexture(DropDownBoxBtnUpHoverTex);
-		dropDownScrollUpBtnStyle.active.texture = dropDownScrollUpBtnStyle.hover.texture;
-		dropDownScrollUpBtnStyle.fixedHeight = true;
-		dropDownScrollUpBtnStyle.fixedWidth = false;
-		dropDownScrollUpBtnStyle.height = 7;
-		dropDownScrollUpBtnStyle.width = 30;
-		dropDownScrollUpBtnStyle.border.left = 1;
-		dropDownScrollUpBtnStyle.border.right = 1;
-		dropDownScrollUpBtnStyle.border.top = 1;
-		dropDownScrollUpBtnStyle.border.bottom = 1;
-
-		mSkin.setStyle("ListBoxScrollUpBtn", dropDownScrollUpBtnStyle);
-		mSkin.setStyle("MenuBarScrollUpBtn", dropDownScrollUpBtnStyle);
-		mSkin.setStyle("ContextMenuScrollUpBtn", dropDownScrollUpBtnStyle);
-
-		// DropDown scroll down button arrow
-		GUIElementStyle dropDownScrollDownBtnArrowStyle;
-		dropDownScrollDownBtnArrowStyle.normal.texture = getTexture(DropDownBoxBtnDownArrowTex);
-		dropDownScrollDownBtnArrowStyle.hover.texture = dropDownScrollDownBtnArrowStyle.normal.texture;
-		dropDownScrollDownBtnArrowStyle.active.texture = dropDownScrollDownBtnArrowStyle.hover.texture;
-		dropDownScrollDownBtnArrowStyle.fixedHeight = true;
-		dropDownScrollDownBtnArrowStyle.fixedWidth = false;
-		dropDownScrollDownBtnArrowStyle.height = 7;
-		dropDownScrollDownBtnArrowStyle.width = 30;
-		dropDownScrollDownBtnArrowStyle.border.left = 1;
-		dropDownScrollDownBtnArrowStyle.border.right = 1;
-		dropDownScrollDownBtnArrowStyle.border.top = 1;
-		dropDownScrollDownBtnArrowStyle.border.bottom = 1;
-
-		mSkin.setStyle("ListBoxScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
-		mSkin.setStyle("MenuBarScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
-		mSkin.setStyle("ContextMenuScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
-
-		// DropDown scroll down button
-		GUIElementStyle dropDownScrollDownBtnStyle;
-		dropDownScrollDownBtnStyle.normal.texture = getTexture(DropDownBoxBtnDownNormalTex);
-		dropDownScrollDownBtnStyle.hover.texture = getTexture(DropDownBoxBtnDownHoverTex);
-		dropDownScrollDownBtnStyle.active.texture = dropDownScrollDownBtnStyle.hover.texture;
-		dropDownScrollDownBtnStyle.fixedHeight = true;
-		dropDownScrollDownBtnStyle.fixedWidth = false;
-		dropDownScrollDownBtnStyle.height = 7;
-		dropDownScrollDownBtnStyle.width = 30;
-		dropDownScrollDownBtnStyle.border.left = 1;
-		dropDownScrollDownBtnStyle.border.right = 1;
-		dropDownScrollDownBtnStyle.border.top = 1;
-		dropDownScrollDownBtnStyle.border.bottom = 1;
-
-		mSkin.setStyle("ListBoxScrollDownBtn", dropDownScrollDownBtnStyle);
-		mSkin.setStyle("MenuBarScrollDownBtn", dropDownScrollDownBtnStyle);
-		mSkin.setStyle("ContextMenuScrollDownBtn", dropDownScrollDownBtnStyle);
-
-		// DropDown entry button
-		GUIElementStyle dropDownEntryBtnStyle;
-		dropDownEntryBtnStyle.normal.texture = getTexture(DropDownBoxEntryNormalTex);
-		dropDownEntryBtnStyle.hover.texture = getTexture(DropDownBoxEntryHoverTex);
-		dropDownEntryBtnStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
-		dropDownEntryBtnStyle.fixedHeight = true;
-		dropDownEntryBtnStyle.fixedWidth = false;
-		dropDownEntryBtnStyle.height = 14;
-		dropDownEntryBtnStyle.width = 30;
-		dropDownEntryBtnStyle.border.left = 1;
-		dropDownEntryBtnStyle.border.right = 1;
-		dropDownEntryBtnStyle.border.top = 1;
-		dropDownEntryBtnStyle.border.bottom = 1;
-		dropDownEntryBtnStyle.font = font;
-		dropDownEntryBtnStyle.fontSize = DefaultFontSize;
-		dropDownEntryBtnStyle.textHorzAlign = THA_Left;
-		dropDownEntryBtnStyle.textVertAlign = TVA_Top;
-
-		mSkin.setStyle("ListBoxEntryBtn", dropDownEntryBtnStyle);
-		mSkin.setStyle("MenuBarEntryBtn", dropDownEntryBtnStyle);
-		mSkin.setStyle("ContextMenuEntryBtn", dropDownEntryBtnStyle);
-
-		// DropDown entry button with expand
-		GUIElementStyle dropDownEntryExpBtnStyle;
-		dropDownEntryExpBtnStyle.normal.texture = getTexture(DropDownBoxEntryExpNormalTex);
-		dropDownEntryExpBtnStyle.hover.texture = getTexture(DropDownBoxEntryExpHoverTex);
-		dropDownEntryExpBtnStyle.active.texture = dropDownEntryExpBtnStyle.hover.texture;
-		dropDownEntryExpBtnStyle.fixedHeight = true;
-		dropDownEntryExpBtnStyle.fixedWidth = false;
-		dropDownEntryExpBtnStyle.height = 14;
-		dropDownEntryExpBtnStyle.width = 30;
-		dropDownEntryExpBtnStyle.border.left = 1;
-		dropDownEntryExpBtnStyle.border.right = 6;
-		dropDownEntryExpBtnStyle.border.top = 1;
-		dropDownEntryExpBtnStyle.border.bottom = 1;
-		dropDownEntryExpBtnStyle.font = font;
-		dropDownEntryExpBtnStyle.fontSize = DefaultFontSize;
-		dropDownEntryExpBtnStyle.textHorzAlign = THA_Left;
-		dropDownEntryExpBtnStyle.textVertAlign = TVA_Top;
-
-		mSkin.setStyle("ListBoxEntryExpBtn", dropDownEntryExpBtnStyle);
-		mSkin.setStyle("MenuBarEntryExpBtn", dropDownEntryExpBtnStyle);
-		mSkin.setStyle("ContextMenuEntryExpBtn", dropDownEntryExpBtnStyle);
-
-		// DropDown box frame
-		GUIElementStyle dropDownBoxStyle;
-		dropDownBoxStyle.normal.texture = getTexture(DropDownBoxBgTex);
-		dropDownBoxStyle.hover.texture = dropDownEntryBtnStyle.normal.texture;
-		dropDownBoxStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
-		dropDownBoxStyle.fixedHeight = false;
-		dropDownBoxStyle.fixedWidth = false;
-		dropDownBoxStyle.border.left = 1;
-		dropDownBoxStyle.border.right = 1;
-		dropDownBoxStyle.border.top = 1;
-		dropDownBoxStyle.border.bottom = 1;
-		dropDownBoxStyle.margins.left = 1;
-		dropDownBoxStyle.margins.right = 1;
-		dropDownBoxStyle.margins.top = 1;
-		dropDownBoxStyle.margins.bottom = 1;
-
-		mSkin.setStyle("ListBoxFrame", dropDownBoxStyle);
-		mSkin.setStyle("MenuBarFrame", dropDownBoxStyle);
-		mSkin.setStyle("ContextMenuFrame", dropDownBoxStyle);
-
-		// Drop down separator
-		GUIElementStyle dropDownSeparatorStyle;
-		dropDownSeparatorStyle.normal.texture = getTexture(DropDownSeparatorTex);
-		dropDownSeparatorStyle.fixedHeight = true;
-		dropDownSeparatorStyle.fixedWidth = false;
-		dropDownSeparatorStyle.height = 3;
-		dropDownSeparatorStyle.width = 30;
-		dropDownSeparatorStyle.border.left = 1;
-		dropDownSeparatorStyle.border.right = 1;
-		dropDownSeparatorStyle.border.top = 1;
-		dropDownSeparatorStyle.border.bottom = 1;
-
-		mSkin.setStyle("ListBoxSeparator", dropDownSeparatorStyle);
-		mSkin.setStyle("MenuBarSeparator", dropDownSeparatorStyle);
-		mSkin.setStyle("ContextMenuSeparator", dropDownSeparatorStyle);
-
-		/************************************************************************/
-		/* 								MENU BAR	                     		*/
-		/************************************************************************/
-
-		// MenuBar background
-		GUIElementStyle menuBarBgStyle;
-		menuBarBgStyle.normal.texture = getTexture(MenuBarBgTex);
-		menuBarBgStyle.fixedHeight = false;
-		menuBarBgStyle.fixedWidth = false;
-		menuBarBgStyle.height = 4;
-		menuBarBgStyle.width = 4;
-
-		mSkin.setStyle("MenuBarBg", menuBarBgStyle);
-
-		// MenuBar Banshee logo
-		GUIElementStyle menuBarBansheeLogoStyle;
-		menuBarBansheeLogoStyle.normal.texture = getTexture(MenuBarBansheeLogoTex);
-		menuBarBansheeLogoStyle.fixedHeight = true;
-		menuBarBansheeLogoStyle.fixedWidth = true;
-		menuBarBansheeLogoStyle.height = 7;
-		menuBarBansheeLogoStyle.width = 51;
-
-		mSkin.setStyle("MenuBarBansheeLogo", menuBarBansheeLogoStyle);
-
-		// MenuBar button
-		GUIElementStyle menuBarBtnStyle;
-		menuBarBtnStyle.normal.texture = getTexture(MenuBarBtnNormalTex);
-		menuBarBtnStyle.hover.texture = getTexture(MenuBarBtnHoverTex);
-		menuBarBtnStyle.active.texture = menuBarBtnStyle.hover.texture;
-		menuBarBtnStyle.normalOn.texture = menuBarBtnStyle.hover.texture;
-		menuBarBtnStyle.hoverOn.texture = menuBarBtnStyle.hover.texture;
-		menuBarBtnStyle.activeOn.texture = menuBarBtnStyle.hover.texture;
-		menuBarBtnStyle.fixedHeight = true;
-		menuBarBtnStyle.fixedWidth = false;
-		menuBarBtnStyle.height = 15;
-		menuBarBtnStyle.width = 4;
-		menuBarBtnStyle.margins.left = 2;
-		menuBarBtnStyle.margins.right = 2;
-		menuBarBtnStyle.margins.top = 2;
-		menuBarBtnStyle.margins.bottom = 2;
-		menuBarBtnStyle.font = font;
-		menuBarBtnStyle.fontSize = DefaultFontSize;
-		menuBarBtnStyle.textHorzAlign = THA_Left;
-		menuBarBtnStyle.textVertAlign = TVA_Top;
-
-		mSkin.setStyle("MenuBarBtn", menuBarBtnStyle);
-
-		/************************************************************************/
-		/* 								DOCK SLIDER	                     		*/
-		/************************************************************************/
-
-		GUIElementStyle dockSliderBtnStyle;
-		dockSliderBtnStyle.normal.texture = getTexture(DockSliderNormalTex);
-		dockSliderBtnStyle.fixedHeight = false;
-		dockSliderBtnStyle.fixedWidth = false;
-		dockSliderBtnStyle.height = 2;
-		dockSliderBtnStyle.width = 2;
-
-		mSkin.setStyle("DockSliderBtn", dockSliderBtnStyle);
-
-		/************************************************************************/
-		/* 								TREE VIEW	                     		*/
-		/************************************************************************/
-
-		// Expand button
-		GUIElementStyle treeViewExpandButtonStyle;
-		treeViewExpandButtonStyle.normal.texture = getTexture(TreeViewExpandButtonOffNormal);
-		treeViewExpandButtonStyle.hover.texture = getTexture(TreeViewExpandButtonOffHover);
-		treeViewExpandButtonStyle.active.texture = treeViewExpandButtonStyle.hover.texture;
-		treeViewExpandButtonStyle.normalOn.texture = getTexture(TreeViewExpandButtonOnNormal);
-		treeViewExpandButtonStyle.hoverOn.texture = getTexture(TreeViewExpandButtonOnHover);
-		treeViewExpandButtonStyle.activeOn.texture = treeViewExpandButtonStyle.hoverOn.texture;
-		treeViewExpandButtonStyle.margins.left = 4;
-		treeViewExpandButtonStyle.margins.right = 4;
-		treeViewExpandButtonStyle.margins.top = 5;
-		treeViewExpandButtonStyle.margins.bottom = 4;
-		treeViewExpandButtonStyle.fixedHeight = true;
-		treeViewExpandButtonStyle.fixedWidth = true;
-		treeViewExpandButtonStyle.height = 16;
-		treeViewExpandButtonStyle.width = 16;
-
-		mSkin.setStyle("TreeViewFoldoutBtn", treeViewExpandButtonStyle);
-
-		// Entry
-		GUIElementStyle treeViewEntryStyle;
-		treeViewEntryStyle.font = font;
-		treeViewEntryStyle.fontSize = DefaultFontSize;
-		treeViewEntryStyle.fixedWidth = false;
-		treeViewEntryStyle.fixedHeight = true;
-		treeViewEntryStyle.height = 16;
-		treeViewEntryStyle.minWidth = 10;
-
-		mSkin.setStyle("TreeViewElementBtn", treeViewEntryStyle);
-
-		// Selection background
-		GUIElementStyle treeViewSelBackgroundStyle;
-		treeViewSelBackgroundStyle.normal.texture = getTexture(TreeViewSelectionBackground);
-		treeViewSelBackgroundStyle.fixedHeight = false;
-		treeViewSelBackgroundStyle.fixedWidth = false;
-		treeViewSelBackgroundStyle.height = 2;
-		treeViewSelBackgroundStyle.width = 2;
-
-		mSkin.setStyle("TreeViewSelectionBackground", treeViewSelBackgroundStyle);
-
-		// Edit box
-		GUIElementStyle treeViewEditBox;
-		treeViewEditBox.normal.texture = getTexture(TreeViewEditBox);
-		treeViewEditBox.hover.texture = treeViewEditBox.normal.texture;
-		treeViewEditBox.focused.texture = treeViewEditBox.normal.texture;
-		treeViewEditBox.active.texture = treeViewEditBox.normal.texture;
-		treeViewEditBox.border.left = 1;
-		treeViewEditBox.border.right = 1;
-		treeViewEditBox.border.top = 1;
-		treeViewEditBox.border.bottom = 1;
-		treeViewEditBox.margins.left = 1;
-		treeViewEditBox.margins.right = 1;
-		treeViewEditBox.margins.top = 1;
-		treeViewEditBox.margins.bottom = 1;
-		treeViewEditBox.fixedHeight = true;
-		treeViewEditBox.height = 13;
-		treeViewEditBox.minWidth = 10;
-		treeViewEditBox.font = font;
-		treeViewEditBox.fontSize = DefaultFontSize;
-		treeViewEditBox.textHorzAlign = THA_Left;
-		treeViewEditBox.textVertAlign = TVA_Top;
-
-		mSkin.setStyle(GUITreeViewEditBox::getGUITypeName(), treeViewEditBox);
-
-		// Element highlight
-		GUIElementStyle treeViewElementHighlight;
-		treeViewElementHighlight.normal.texture = getTexture(TreeViewElementHighlight);
-		treeViewElementHighlight.border.left = 1;
-		treeViewElementHighlight.border.right = 1;
-		treeViewElementHighlight.border.top = 1;
-		treeViewElementHighlight.border.bottom = 1;
-
-		mSkin.setStyle("TreeViewElementHighlight", treeViewElementHighlight);
-
-		// Element separator highlight
-		GUIElementStyle treeViewElementSepHighlight;
-		treeViewElementSepHighlight.normal.texture = getTexture(TreeViewElementSepHighlight);
-		treeViewElementSepHighlight.border.left = 1;
-		treeViewElementSepHighlight.border.right = 1;
-		treeViewElementSepHighlight.border.top = 1;
-		treeViewElementSepHighlight.border.bottom = 1;
-
-		mSkin.setStyle("TreeViewElementSepHighlight", treeViewElementSepHighlight);
-	
-		/************************************************************************/
-		/* 							OBJECT DROP FIELD                      		*/
-		/************************************************************************/
-		GUIElementStyle objectDropStyle;
-		objectDropStyle.normal.texture = getTexture(ObjectDropBtnNormalTex);
-		objectDropStyle.normalOn.texture = getTexture(ObjectDropBtnNormalOnTex);
-		objectDropStyle.fixedHeight = true;
-		objectDropStyle.height = 15;
-		objectDropStyle.minWidth = 50;
-		objectDropStyle.font = font;
-		objectDropStyle.fontSize = DefaultFontSize;
-		objectDropStyle.textHorzAlign = THA_Center;
-		objectDropStyle.textVertAlign = TVA_Center;
-
-		mSkin.setStyle(ObjectFieldDropBtnStyleName, objectDropStyle);
-
-		GUIElementStyle objectClearBtnStyle;
-		objectClearBtnStyle.normal.texture = getTexture(ObjectClearBtnNormalTex);
-		objectClearBtnStyle.hover.texture = getTexture(ObjectClearBtnHoverTex);
-		objectClearBtnStyle.active.texture = getTexture(ObjectClearBtnActiveTex);
-		objectClearBtnStyle.fixedHeight = true;
-		objectClearBtnStyle.fixedWidth = true;
-		objectClearBtnStyle.height = 15;
-		objectClearBtnStyle.width = 13;
-
-		mSkin.setStyle(ObjectFieldClearBtnStyleName, objectClearBtnStyle);
-
-		GUIElementStyle editorObjectFieldStyle;
-		editorObjectFieldStyle.fixedHeight = true;
-		editorObjectFieldStyle.height = 15;
-		editorObjectFieldStyle.minWidth = 30;
-		editorObjectFieldStyle.subStyles[ObjectFieldLabelStyleName] = GUITextField::getLabelStyleType();
-		editorObjectFieldStyle.subStyles[ObjectFieldDropBtnStyleName] = ObjectFieldDropBtnStyleName;
-		editorObjectFieldStyle.subStyles[ObjectFieldClearBtnStyleName] = ObjectFieldClearBtnStyleName;
-
-		mSkin.setStyle(ObjectFieldStyleName, editorObjectFieldStyle);
-
-		/************************************************************************/
-		/* 								EDITOR FIELDS                      		*/
-		/************************************************************************/
-
-		GUIElementStyle editorFieldLabelStyle;
-		editorFieldLabelStyle.font = font;
-		editorFieldLabelStyle.fontSize = DefaultFontSize;
-		editorFieldLabelStyle.fixedWidth = false;
-		editorFieldLabelStyle.fixedHeight = true;
-		editorFieldLabelStyle.height = 11;
-		editorFieldLabelStyle.minWidth = 10;
-		editorFieldLabelStyle.textHorzAlign = THA_Left;
-
-		mSkin.setStyle(GUITextField::getLabelStyleType(), editorFieldLabelStyle);
-
-		GUIElementStyle editorIntFieldStyle;
-		editorIntFieldStyle.fixedHeight = true;
-		editorIntFieldStyle.height = 15;
-		editorIntFieldStyle.minWidth = 30;
-		editorIntFieldStyle.subStyles[GUIIntField::getLabelStyleType()] = GUITextField::getLabelStyleType();
-		editorIntFieldStyle.subStyles[GUIIntField::getInputStyleType()] = GUIInputBox::getGUITypeName();
-
-		mSkin.setStyle(GUIIntField::getGUITypeName(), editorIntFieldStyle);
-
-		GUIElementStyle editorFloatFieldStyle;
-		editorFloatFieldStyle.fixedHeight = true;
-		editorFloatFieldStyle.height = 15;
-		editorFloatFieldStyle.minWidth = 30;
-		editorFloatFieldStyle.subStyles[GUIFloatField::getLabelStyleType()] = GUITextField::getLabelStyleType();
-		editorFloatFieldStyle.subStyles[GUIFloatField::getInputStyleType()] = GUIInputBox::getGUITypeName();
-
-		mSkin.setStyle(GUIFloatField::getGUITypeName(), editorFloatFieldStyle);
-
-		GUIElementStyle editorTextFieldStyle;
-		editorTextFieldStyle.fixedHeight = true;
-		editorTextFieldStyle.height = 15;
-		editorTextFieldStyle.minWidth = 30;
-		editorTextFieldStyle.subStyles[GUITextField::getLabelStyleType()] = GUITextField::getLabelStyleType();
-		editorTextFieldStyle.subStyles[GUITextField::getInputStyleType()] = GUIInputBox::getGUITypeName();
-
-		mSkin.setStyle(GUITextField::getGUITypeName(), editorTextFieldStyle);
-
-		GUIElementStyle editorColorFieldStyle;
-		editorColorFieldStyle.fixedHeight = true;
-		editorColorFieldStyle.height = 15;
-		editorColorFieldStyle.minWidth = 30;
-		editorColorFieldStyle.subStyles[GUIColorField::getLabelStyleType()] = GUITextField::getLabelStyleType();
-		editorColorFieldStyle.subStyles[GUIColorField::getColorInputStyleType()] = GUIColor::getGUITypeName();
-
-		mSkin.setStyle(GUIColorField::getGUITypeName(), editorColorFieldStyle);
-
-		GUIElementStyle editorToggleFieldStyle;
-		editorToggleFieldStyle.fixedHeight = true;
-		editorToggleFieldStyle.height = 15;
-		editorToggleFieldStyle.minWidth = 30;
-		editorToggleFieldStyle.subStyles[GUIToggleField::getLabelStyleType()] = GUITextField::getLabelStyleType();
-		editorToggleFieldStyle.subStyles[GUIToggleField::getToggleStyleType()] = GUIToggle::getGUITypeName();
-
-		mSkin.setStyle(GUIToggleField::getGUITypeName(), editorToggleFieldStyle);
-
-		GUIElementStyle editorVector2FieldStyle;
-		editorVector2FieldStyle.fixedHeight = true;
-		editorVector2FieldStyle.height = 30;
-		editorVector2FieldStyle.minWidth = 30;
-		editorVector2FieldStyle.subStyles[GUIVector2Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
-		editorVector2FieldStyle.subStyles[GUIVector2Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
-
-		mSkin.setStyle(GUIVector2Field::getGUITypeName(), editorVector2FieldStyle);
-
-		GUIElementStyle editorVector3FieldStyle;
-		editorVector3FieldStyle.fixedHeight = true;
-		editorVector3FieldStyle.height = 30;
-		editorVector3FieldStyle.minWidth = 30;
-		editorVector3FieldStyle.subStyles[GUIVector3Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
-		editorVector3FieldStyle.subStyles[GUIVector3Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
-
-		mSkin.setStyle(GUIVector3Field::getGUITypeName(), editorVector3FieldStyle);
-
-		GUIElementStyle editorVector4FieldStyle;
-		editorVector4FieldStyle.fixedHeight = true;
-		editorVector4FieldStyle.height = 30;
-		editorVector4FieldStyle.minWidth = 30;
-		editorVector4FieldStyle.subStyles[GUIVector4Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
-		editorVector4FieldStyle.subStyles[GUIVector4Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
-
-		mSkin.setStyle(GUIVector4Field::getGUITypeName(), editorVector4FieldStyle);
-
-		/************************************************************************/
-		/* 							COMPONENT FOLDOUT                      		*/
-		/************************************************************************/
-		GUIElementStyle cmpFoldoutBtnStyle;
-		cmpFoldoutBtnStyle.normal.texture = getTexture(CmpFoldoutClosedNormalTex);
-		cmpFoldoutBtnStyle.hover.texture = getTexture(CmpFoldoutClosedHoverTex);
-		cmpFoldoutBtnStyle.active.texture = getTexture(CmpFoldoutOpenActiveTex);
-		cmpFoldoutBtnStyle.normalOn.texture = getTexture(CmpFoldoutOpenNormalTex);
-		cmpFoldoutBtnStyle.hoverOn.texture = getTexture(CmpFoldoutOpenHoverTex);
-		cmpFoldoutBtnStyle.activeOn.texture = getTexture(CmpFoldoutOpenActiveTex);
-		cmpFoldoutBtnStyle.fixedHeight = true;
-		cmpFoldoutBtnStyle.fixedWidth = false;
-		cmpFoldoutBtnStyle.height = 10;
-		cmpFoldoutBtnStyle.minWidth = 10;
-		cmpFoldoutBtnStyle.font = font;
-		cmpFoldoutBtnStyle.fontSize = DefaultFontSize;
-		cmpFoldoutBtnStyle.textHorzAlign = THA_Left;
-		cmpFoldoutBtnStyle.textVertAlign = TVA_Center;
-		cmpFoldoutBtnStyle.contentOffset = RectOffset(12, 0, 0, 0);
-		cmpFoldoutBtnStyle.border.left = 8;
-
-		mSkin.setStyle(GUIComponentFoldout::getFoldoutButtonStyleType(), cmpFoldoutBtnStyle);
-
-		GUIElementStyle cmpFoldoutStyle;
-		cmpFoldoutStyle.fixedHeight = true;
-		cmpFoldoutStyle.height = 12;
-		cmpFoldoutStyle.minWidth = 30;
-		cmpFoldoutStyle.subStyles[GUIComponentFoldout::getFoldoutButtonStyleType()] = GUIComponentFoldout::getFoldoutButtonStyleType();
-
-		mSkin.setStyle(GUIComponentFoldout::getGUITypeName(), cmpFoldoutStyle);
-
-		/************************************************************************/
-		/* 							     FOLDOUT                      		    */
-		/************************************************************************/
-		GUIElementStyle foldoutBtnStyle;
-		foldoutBtnStyle.normal.texture = getTexture(FoldoutClosedNormalTex);
-		foldoutBtnStyle.hover.texture = getTexture(FoldoutClosedHoverTex);
-		foldoutBtnStyle.active.texture = foldoutBtnStyle.hover.texture;
-		foldoutBtnStyle.normalOn.texture = getTexture(FoldoutOpenNormalTex);
-		foldoutBtnStyle.hoverOn.texture = getTexture(FoldoutOpenHoverTex);
-		foldoutBtnStyle.activeOn.texture = foldoutBtnStyle.hoverOn.texture;
-		foldoutBtnStyle.fixedHeight = true;
-		foldoutBtnStyle.fixedWidth = true;
-		foldoutBtnStyle.height = 10;
-		foldoutBtnStyle.width = 8;
-
-		mSkin.setStyle(GUIFoldout::getFoldoutButtonStyleType(), foldoutBtnStyle);
-
-		GUIElementStyle foldoutStyle;
-		foldoutStyle.fixedHeight = true;
-		foldoutStyle.height = 12;
-		foldoutStyle.minWidth = 30;
-		foldoutStyle.subStyles[GUIFoldout::getLabelStyleType()] = GUIFoldout::getLabelStyleType();
-		foldoutStyle.subStyles[GUIFoldout::getFoldoutButtonStyleType()] = GUIFoldout::getFoldoutButtonStyleType();
-
-		mSkin.setStyle(GUIFoldout::getGUITypeName(), foldoutStyle);
-	}
-
-	HSpriteTexture EditorGUI::getTexture(const WString& name)
-	{
-		return SpriteTexture::create(static_resource_cast<Texture>(Importer::instance().import(FileSystem::getWorkingDirectoryPath().append(DefaultFolder).append(name))));
-	}
+#include "BsBuiltinEditorResources.h"
+#include "BsGUIElementStyle.h"
+
+#include "BsGUILabel.h"
+#include "BsGUIButton.h"
+#include "BsGUIInputBox.h"
+#include "BsGUIToggle.h"
+#include "BsGUIColor.h"
+#include "BsTextSprite.h"
+#include "BsSpriteTexture.h"
+#include "BsGUITreeViewEditBox.h"
+
+#include "BsGUIIntField.h"
+#include "BsGUIFloatField.h"
+#include "BsGUIColorField.h"
+#include "BsGUITextField.h"
+#include "BsGUIToggleField.h"
+#include "BsGUIVector2Field.h"
+#include "BsGUIVector3Field.h"
+#include "BsGUIVector4Field.h"
+#include "BsGUIComponentFoldout.h"
+#include "BsGUIFoldout.h"
+
+#include "BsFont.h"
+#include "BsFontImportOptions.h"
+#include "BsImporter.h"
+#include "BsGpuProgram.h"
+#include "BsShader.h"
+#include "BsTechnique.h"
+#include "BsPass.h"
+#include "BsMaterial.h"
+#include "BsBlendState.h"
+#include "BsDepthStencilState.h"
+#include "BsGpuProgramImportOptions.h"
+#include "BsResources.h"
+#include "BsRTTIType.h"
+#include "BsFileSystem.h"
+
+namespace BansheeEngine
+{
+	const String BuiltinEditorResources::ObjectFieldStyleName = "GUIObjectField";
+	const String BuiltinEditorResources::ObjectFieldLabelStyleName = "EditorFieldLabel";
+	const String BuiltinEditorResources::ObjectFieldDropBtnStyleName = "DropButton";
+	const String BuiltinEditorResources::ObjectFieldClearBtnStyleName = "ObjectClearButton";
+
+	const Path BuiltinEditorResources::DefaultSkinFolderRaw = L"..\\..\\..\\..\\Data\\Raw\\Editor\\Skin\\";
+	const Path BuiltinEditorResources::DefaultShaderFolderRaw = L"..\\..\\..\\..\\Data\\Raw\\Editor\\Shaders\\";
+
+	const Path BuiltinEditorResources::DefaultSkinFolder = L"..\\..\\..\\..\\Data\\Editor\\Skin\\";
+	const Path BuiltinEditorResources::DefaultShaderFolder = L"..\\..\\..\\..\\Data\\Editor\\Shaders\\";
+	
+	const WString BuiltinEditorResources::HLSL11ShaderSubFolder = L"HLSL11/";
+	const WString BuiltinEditorResources::HLSL9ShaderSubFolder = L"HLSL9/";
+	const WString BuiltinEditorResources::GLSLShaderSubFolder = L"GLSL/";
+
+	const WString BuiltinEditorResources::DefaultFontFilename = L"arial.ttf";
+	const UINT32 BuiltinEditorResources::DefaultFontSize = 10;
+
+	const WString BuiltinEditorResources::WindowBackgroundTexture = L"WindowBgTile.psd";
+
+	const WString BuiltinEditorResources::ButtonNormalTex = L"ButtonNormal.psd";
+	const WString BuiltinEditorResources::ButtonHoverTex = L"ButtonHover.psd";
+	const WString BuiltinEditorResources::ButtonActiveTex = L"ButtonActive.psd";
+
+	const WString BuiltinEditorResources::ToggleNormalTex = L"ToggleNormal.psd";
+	const WString BuiltinEditorResources::ToggleHoverTex = L"ToggleHover.psd";
+	const WString BuiltinEditorResources::ToggleActiveTex = L"ToggleActive.psd";
+	const WString BuiltinEditorResources::ToggleNormalOnTex = L"ToggleOnNormal.psd";
+	const WString BuiltinEditorResources::ToggleHoverOnTex = L"ToggleOnHover.psd";
+	const WString BuiltinEditorResources::ToggleActiveOnTex = L"ToggleOnActive.psd";
+
+	const WString BuiltinEditorResources::ObjectDropBtnNormalTex = L"ObjectFieldDropNormal.psd";
+	const WString BuiltinEditorResources::ObjectDropBtnNormalOnTex = L"ObjectFieldDropOnNormal.psd";
+	const WString BuiltinEditorResources::ObjectClearBtnNormalTex = L"ObjectFieldBtnNormal.psd";
+	const WString BuiltinEditorResources::ObjectClearBtnHoverTex = L"ObjectFieldBtnHover.psd";
+	const WString BuiltinEditorResources::ObjectClearBtnActiveTex = L"ObjectFieldBtnActive.psd";
+
+	const WString BuiltinEditorResources::FoldoutOpenNormalTex = L"FoldoutOpenNormal.psd";
+	const WString BuiltinEditorResources::FoldoutOpenHoverTex = L"FoldoutOpenHover.psd";
+	const WString BuiltinEditorResources::FoldoutClosedNormalTex = L"FoldoutClosedNormal.psd";
+	const WString BuiltinEditorResources::FoldoutClosedHoverTex = L"FoldoutClosedHover.psd";
+
+	const WString BuiltinEditorResources::CmpFoldoutOpenNormalTex = L"CmpFoldoutOpenNormal.psd";
+	const WString BuiltinEditorResources::CmpFoldoutOpenHoverTex = L"CmpFoldoutOpenHover.psd";
+	const WString BuiltinEditorResources::CmpFoldoutOpenActiveTex = L"CmpFoldoutOpenActive.psd";
+	const WString BuiltinEditorResources::CmpFoldoutClosedNormalTex = L"CmpFoldoutClosedNormal.psd";
+	const WString BuiltinEditorResources::CmpFoldoutClosedHoverTex = L"CmpFoldoutClosedHover.psd";
+	const WString BuiltinEditorResources::CmpFoldoutClosedActiveTex = L"CmpFoldoutClosedActive.psd";
+
+	const WString BuiltinEditorResources::WindowFrameNormal = L"WindowFrameNormal.psd";
+	const WString BuiltinEditorResources::WindowFrameFocused = L"WindowFrameFocused.psd";
+
+	const WString BuiltinEditorResources::WindowTitleBarBg = L"WindowTitleBarBg.psd";
+
+	const WString BuiltinEditorResources::WindowCloseButtonNormal = L"WindowCloseBtnNormal.psd";
+	const WString BuiltinEditorResources::WindowCloseButtonHover = L"WindowCloseBtnHover.psd";
+
+	const WString BuiltinEditorResources::WindowMinButtonNormal = L"WindowMaxBtnNormal.psd";
+	const WString BuiltinEditorResources::WindowMinButtonHover = L"WindowMaxBtnHover.psd";
+
+	const WString BuiltinEditorResources::WindowMaxButtonNormal = L"WindowMinBtnNormal.psd";
+	const WString BuiltinEditorResources::WindowMaxButtonHover = L"WindowMinBtnHover.psd";
+
+	const WString BuiltinEditorResources::TabbedBarBtnNormal = L"TabbedButtonNormal.psd";
+	const WString BuiltinEditorResources::TabbedBarBtnActive = L"TabbedButtonActive.psd";
+
+	const WString BuiltinEditorResources::InputBoxNormalTex = L"InputBoxNormal.psd";
+	const WString BuiltinEditorResources::InputBoxHoverTex = L"InputBoxHover.psd";
+	const WString BuiltinEditorResources::InputBoxFocusedTex = L"InputBoxFocused.psd";
+
+	const WString BuiltinEditorResources::ScrollBarUpNormalTex = L"ScrollBarUpNormal.psd";
+	const WString BuiltinEditorResources::ScrollBarUpHoverTex = L"ScrollBarUpHover.psd";
+	const WString BuiltinEditorResources::ScrollBarUpActiveTex = L"ScrollBarUpActive.psd";
+
+	const WString BuiltinEditorResources::ScrollBarDownNormalTex = L"ScrollBarDownNormal.psd";
+	const WString BuiltinEditorResources::ScrollBarDownHoverTex = L"ScrollBarDownHover.psd";
+	const WString BuiltinEditorResources::ScrollBarDownActiveTex = L"ScrollBarDownActive.psd";
+
+	const WString BuiltinEditorResources::ScrollBarLeftNormalTex = L"ScrollBarLeftNormal.psd";
+	const WString BuiltinEditorResources::ScrollBarLeftHoverTex = L"ScrollBarLeftHover.psd";
+	const WString BuiltinEditorResources::ScrollBarLeftActiveTex = L"ScrollBarLeftActive.psd";
+
+	const WString BuiltinEditorResources::ScrollBarRightNormalTex = L"ScrollBarRightNormal.psd";
+	const WString BuiltinEditorResources::ScrollBarRightHoverTex = L"ScrollBarRightHover.psd";
+	const WString BuiltinEditorResources::ScrollBarRightActiveTex = L"ScrollBarRightActive.psd";
+
+	const WString BuiltinEditorResources::ScrollBarHandleHorzNormalTex = L"ScrollBarHorzHandleNormal.psd";
+	const WString BuiltinEditorResources::ScrollBarHandleHorzHoverTex = L"ScrollBarHorzHandleHover.psd";
+	const WString BuiltinEditorResources::ScrollBarHandleHorzActiveTex = L"ScrollBarHorzHandleActive.psd";
+
+	const WString BuiltinEditorResources::ScrollBarHandleVertNormalTex = L"ScrollBarVertHandleNormal.psd";
+	const WString BuiltinEditorResources::ScrollBarHandleVertHoverTex = L"ScrollBarVertHandleHover.psd";
+	const WString BuiltinEditorResources::ScrollBarHandleVertActiveTex = L"ScrollBarVertHandleActive.psd";
+
+	const WString BuiltinEditorResources::DropDownBtnNormalTex = L"DropDownNormal.psd";
+	const WString BuiltinEditorResources::DropDownBtnHoverTex = L"DropDownHover.psd";
+
+	const WString BuiltinEditorResources::DropDownBoxBgTex = L"DropDownBoxBg.psd";
+	const WString BuiltinEditorResources::DropDownBoxEntryNormalTex = L"DropDownButtonNormal.psd";
+	const WString BuiltinEditorResources::DropDownBoxEntryHoverTex = L"DropDownButtonHover.psd";
+
+	const WString BuiltinEditorResources::DropDownBoxBtnUpNormalTex = L"DropDownBoxBtnUpNormal.psd";
+	const WString BuiltinEditorResources::DropDownBoxBtnUpHoverTex = L"DropDownBoxBtnUpHover.psd";
+
+	const WString BuiltinEditorResources::DropDownBoxBtnDownNormalTex = L"DropDownBoxBtnDownNormal.psd";
+	const WString BuiltinEditorResources::DropDownBoxBtnDownHoverTex = L"DropDownBoxBtnDownHover.psd";
+
+	const WString BuiltinEditorResources::DropDownBoxEntryExpNormalTex = L"DropDownExpNormal.psd";
+	const WString BuiltinEditorResources::DropDownBoxEntryExpHoverTex = L"DropDownExpHover.psd";
+
+	const WString BuiltinEditorResources::DropDownSeparatorTex = L"DropDownSeparator.psd";
+
+	const WString BuiltinEditorResources::DropDownBoxBtnUpArrowTex = L"DropDownBoxBtnUpArrow.psd";
+	const WString BuiltinEditorResources::DropDownBoxBtnDownArrowTex = L"DropDownBoxBtnDownArrow.psd";
+
+	const WString BuiltinEditorResources::ScrollBarBgTex = L"ScrollBarBg.psd";
+
+	const WString BuiltinEditorResources::MenuBarBgTex = L"MenuBarBg.psd";
+
+	const WString BuiltinEditorResources::MenuBarBtnNormalTex = L"MenuBarButtonNormal.psd";
+	const WString BuiltinEditorResources::MenuBarBtnHoverTex = L"MenuBarButtonHover.psd";
+
+	const WString BuiltinEditorResources::MenuBarBansheeLogoTex = L"MenuBarBansheeLogo.psd";
+
+	const WString BuiltinEditorResources::DockSliderNormalTex = L"DockSliderBtn.psd";
+
+	const WString BuiltinEditorResources::TreeViewExpandButtonOffNormal = L"TreeViewExpandButtonOffNormal.psd";
+	const WString BuiltinEditorResources::TreeViewExpandButtonOffHover = L"TreeViewExpandButtonOffHover.psd";
+	const WString BuiltinEditorResources::TreeViewExpandButtonOnNormal = L"TreeViewExpandButtonOnNormal.psd";
+	const WString BuiltinEditorResources::TreeViewExpandButtonOnHover = L"TreeViewExpandButtonOnHover.psd";
+
+	const WString BuiltinEditorResources::TreeViewSelectionBackground = L"TreeViewSelectionBackground.psd";
+	const WString BuiltinEditorResources::TreeViewEditBox = L"TreeViewEditBox.psd";
+	const WString BuiltinEditorResources::TreeViewElementHighlight = L"TreeViewElementHighlight.psd";
+	const WString BuiltinEditorResources::TreeViewElementSepHighlight = L"TreeViewElementSepHighlight.psd";
+
+	/************************************************************************/
+	/* 									SHADERS                      		*/
+	/************************************************************************/
+
+	struct GpuProgramImportData
+	{
+		WString filename;
+		String entryPoint;
+		GpuProgramType type;
+		GpuProgramProfile profile;
+		String language;
+		WString folder;
+	};
+
+	const WString BuiltinEditorResources::ShaderDockOverlayVSFile = L"dockDropOverlayVS.gpuprog";
+	const WString BuiltinEditorResources::ShaderDockOverlayPSFile = L"dockDropOverlayPS.gpuprog";
+	const WString BuiltinEditorResources::SceneGridVSFile = L"sceneGridVS.gpuprog";
+	const WString BuiltinEditorResources::SceneGridPSFile = L"sceneGridPS.gpuprog";
+
+	BuiltinEditorResources::BuiltinEditorResources(RenderSystemPlugin activeRSPlugin)
+		:mRenderSystemPlugin(activeRSPlugin)
+	{
+		switch (activeRSPlugin)
+		{
+		case RenderSystemPlugin::DX11:
+			mActiveShaderSubFolder = HLSL11ShaderSubFolder;
+			mActiveRenderSystem = RenderSystemDX11;
+			break;
+		case RenderSystemPlugin::DX9:
+			mActiveShaderSubFolder = HLSL9ShaderSubFolder;
+			mActiveRenderSystem = RenderSystemDX9;
+			break;
+		case RenderSystemPlugin::OpenGL:
+			mActiveShaderSubFolder = GLSLShaderSubFolder;
+			mActiveRenderSystem = RenderSystemOpenGL;
+			break;
+		}
+
+		preprocess();
+
+		initDockDropOverlayShader();
+		initSceneGridShader();
+
+		Path fontPath = FileSystem::getWorkingDirectoryPath();
+		fontPath.append(DefaultSkinFolder);
+		fontPath.append(DefaultFontFilename + L".asset");
+
+		HFont font = Resources::instance().load<Font>(fontPath);
+
+		// Label
+		GUIElementStyle labelStyle;
+		labelStyle.font = font;
+		labelStyle.fontSize = DefaultFontSize;
+		labelStyle.fixedWidth = false;
+		labelStyle.fixedHeight = true;
+		labelStyle.height = 11;
+		labelStyle.minWidth = 10;
+
+		mSkin.setStyle(GUILabel::getGUITypeName(), labelStyle);
+
+		// Window frame
+		GUIElementStyle windowFrameStyle;
+		windowFrameStyle.normal.texture = getGUITexture(WindowFrameNormal);
+		windowFrameStyle.focused.texture = getGUITexture(WindowFrameFocused);
+		windowFrameStyle.border.left = 1;
+		windowFrameStyle.border.right = 1;
+		windowFrameStyle.border.top = 1;
+		windowFrameStyle.border.bottom = 1;
+
+		mSkin.setStyle("WindowFrame", windowFrameStyle);
+
+		// Button
+		GUIElementStyle buttonStyle;
+		buttonStyle.normal.texture = getGUITexture(ButtonNormalTex);
+		buttonStyle.hover.texture = getGUITexture(ButtonHoverTex);
+		buttonStyle.active.texture = getGUITexture(ButtonActiveTex);
+		buttonStyle.border.left = 6;
+		buttonStyle.border.right = 6;
+		buttonStyle.border.top = 6;
+		buttonStyle.border.bottom = 6;
+		buttonStyle.contentOffset.left = 3;
+		buttonStyle.contentOffset.right = 3;
+		buttonStyle.fixedHeight = true;
+		buttonStyle.height = 15;
+		buttonStyle.minWidth = 50;
+		buttonStyle.font = font;
+		buttonStyle.fontSize = DefaultFontSize;
+		buttonStyle.textHorzAlign = THA_Center;
+		buttonStyle.textVertAlign = TVA_Center;
+
+		mSkin.setStyle(GUIButton::getGUITypeName(), buttonStyle);
+
+		// Toggle
+		GUIElementStyle toggleStyle;
+		toggleStyle.normal.texture = getGUITexture(ToggleNormalTex);
+		toggleStyle.hover.texture = getGUITexture(ToggleHoverTex);
+		toggleStyle.active.texture = getGUITexture(ToggleActiveTex);
+		toggleStyle.normalOn.texture = getGUITexture(ToggleNormalOnTex);
+		toggleStyle.hoverOn.texture = getGUITexture(ToggleHoverOnTex);
+		toggleStyle.activeOn.texture = getGUITexture(ToggleActiveOnTex);
+		toggleStyle.fixedHeight = true;
+		toggleStyle.fixedWidth = true;
+		toggleStyle.height = 15;
+		toggleStyle.width = 15;
+
+		mSkin.setStyle(GUIToggle::getGUITypeName(), toggleStyle);
+
+		// Color
+		GUIElementStyle colorStyle;
+		colorStyle.margins.left = 2;
+		colorStyle.margins.right = 2;
+		colorStyle.margins.top = 2;
+		colorStyle.margins.bottom = 2;
+		colorStyle.fixedHeight = true;
+		colorStyle.height = 10;
+		colorStyle.minWidth = 10;
+
+		mSkin.setStyle(GUIColor::getGUITypeName(), colorStyle);
+
+		// Window background texture
+		GUIElementStyle windowBgStyle;
+		windowBgStyle.normal.texture = getGUITexture(WindowBackgroundTexture);
+
+		mSkin.setStyle("WindowBackground", windowBgStyle);
+
+		// Window title bar background
+		GUIElementStyle titleBarBgStyle;
+		titleBarBgStyle.normal.texture = getGUITexture(WindowTitleBarBg);
+		titleBarBgStyle.fixedHeight = true;
+		titleBarBgStyle.height = 13;
+
+		mSkin.setStyle("TitleBarBackground", titleBarBgStyle);
+
+		// Tabbed title bar tab button
+		GUIElementStyle tabbedBarButton;
+		tabbedBarButton.normal.texture = getGUITexture(TabbedBarBtnNormal);
+		tabbedBarButton.hover.texture = getGUITexture(TabbedBarBtnActive);
+		tabbedBarButton.active.texture = tabbedBarButton.hover.texture;
+		tabbedBarButton.normalOn.texture = tabbedBarButton.hover.texture;
+		tabbedBarButton.hoverOn.texture = tabbedBarButton.hover.texture;
+		tabbedBarButton.activeOn.texture = tabbedBarButton.hover.texture;
+		tabbedBarButton.fixedHeight = true;
+		tabbedBarButton.height = 13;
+		tabbedBarButton.minWidth = 10;
+		tabbedBarButton.maxWidth = 110;
+		tabbedBarButton.font = font;
+		tabbedBarButton.fontSize = DefaultFontSize;
+		tabbedBarButton.textHorzAlign = THA_Center;
+		tabbedBarButton.textVertAlign = TVA_Center;
+
+		mSkin.setStyle("TabbedBarBtn", tabbedBarButton);
+
+		// Tabbed title bar drag/drop button
+		GUIElementStyle tabbedBarDropButton;
+		tabbedBarDropButton.fixedHeight = true;
+		tabbedBarDropButton.fixedWidth = true;
+		tabbedBarDropButton.height = 13;
+		tabbedBarDropButton.width = 6;
+
+		mSkin.setStyle("TabbedBarDropArea", tabbedBarDropButton);
+
+		// Window minimize button
+		GUIElementStyle winMinButtonStyle;
+		winMinButtonStyle.normal.texture = getGUITexture(WindowMinButtonNormal);
+		winMinButtonStyle.hover.texture = getGUITexture(WindowMinButtonHover);
+		winMinButtonStyle.active.texture = winMinButtonStyle.hover.texture;
+		winMinButtonStyle.fixedHeight = true;
+		winMinButtonStyle.fixedWidth = true;
+		winMinButtonStyle.height = 7;
+		winMinButtonStyle.width = 8;
+
+		mSkin.setStyle("WinMinimizeBtn", winMinButtonStyle);
+
+		// Window maximize button
+		GUIElementStyle winMaxButtonStyle;
+		winMaxButtonStyle.normal.texture = getGUITexture(WindowMaxButtonNormal);
+		winMaxButtonStyle.hover.texture = getGUITexture(WindowMaxButtonHover);
+		winMaxButtonStyle.active.texture = winMaxButtonStyle.hover.texture;
+		winMaxButtonStyle.fixedHeight = true;
+		winMaxButtonStyle.fixedWidth = true;
+		winMaxButtonStyle.height = 8;
+		winMaxButtonStyle.width = 8;
+
+		mSkin.setStyle("WinMaximizeBtn", winMaxButtonStyle);
+
+		// Window close button
+		GUIElementStyle winCloseButtonStyle;
+		winCloseButtonStyle.normal.texture = getGUITexture(WindowCloseButtonNormal);
+		winCloseButtonStyle.hover.texture = getGUITexture(WindowCloseButtonHover);
+		winCloseButtonStyle.active.texture = winCloseButtonStyle.hover.texture;
+		winCloseButtonStyle.fixedHeight = true;
+		winCloseButtonStyle.fixedWidth = true;
+		winCloseButtonStyle.height = 7;
+		winCloseButtonStyle.width = 8;
+
+		mSkin.setStyle("WinCloseBtn", winCloseButtonStyle);
+
+		// Input box
+		GUIElementStyle inputBoxStyle;
+		inputBoxStyle.normal.texture = getGUITexture(InputBoxNormalTex);
+		inputBoxStyle.hover.texture = getGUITexture(InputBoxHoverTex);
+		inputBoxStyle.focused.texture = getGUITexture(InputBoxFocusedTex);
+		inputBoxStyle.active.texture = inputBoxStyle.normal.texture;
+		inputBoxStyle.border.left = 1;
+		inputBoxStyle.border.right = 1;
+		inputBoxStyle.border.top = 1;
+		inputBoxStyle.border.bottom = 1;
+		inputBoxStyle.contentOffset.left = 3;
+		inputBoxStyle.contentOffset.right = 3;
+		inputBoxStyle.contentOffset.top = 2;
+		inputBoxStyle.contentOffset.bottom = 2;
+		inputBoxStyle.fixedHeight = true;
+		inputBoxStyle.height = 15;
+		inputBoxStyle.minWidth = 10;
+		inputBoxStyle.font = font;
+		inputBoxStyle.fontSize = DefaultFontSize;
+		inputBoxStyle.textHorzAlign = THA_Left;
+		inputBoxStyle.textVertAlign = TVA_Top;
+
+		mSkin.setStyle(GUIInputBox::getGUITypeName(), inputBoxStyle);
+
+		/************************************************************************/
+		/* 								SCROLL BAR                      		*/
+		/************************************************************************/
+
+		// Up button
+		GUIElementStyle scrollUpBtnStyle;
+		scrollUpBtnStyle.normal.texture = getGUITexture(ScrollBarUpNormalTex);
+		scrollUpBtnStyle.hover.texture = getGUITexture(ScrollBarUpHoverTex);
+		scrollUpBtnStyle.active.texture = getGUITexture(ScrollBarUpActiveTex);
+		scrollUpBtnStyle.fixedHeight = true;
+		scrollUpBtnStyle.fixedWidth = true;
+		scrollUpBtnStyle.height = 4;
+		scrollUpBtnStyle.width = 8;
+
+		mSkin.setStyle("ScrollUpBtn", scrollUpBtnStyle);
+
+		// Down button
+		GUIElementStyle scrollDownBtnStyle;
+		scrollDownBtnStyle.normal.texture = getGUITexture(ScrollBarDownNormalTex);
+		scrollDownBtnStyle.hover.texture = getGUITexture(ScrollBarDownHoverTex);
+		scrollDownBtnStyle.active.texture = getGUITexture(ScrollBarDownActiveTex);
+		scrollDownBtnStyle.fixedHeight = true;
+		scrollDownBtnStyle.fixedWidth = true;
+		scrollDownBtnStyle.height = 4;
+		scrollDownBtnStyle.width = 8;
+
+		mSkin.setStyle("ScrollDownBtn", scrollDownBtnStyle);
+
+		// Left button
+		GUIElementStyle scrollLeftBtnStyle;
+		scrollLeftBtnStyle.normal.texture = getGUITexture(ScrollBarLeftNormalTex);
+		scrollLeftBtnStyle.hover.texture = getGUITexture(ScrollBarLeftHoverTex);
+		scrollLeftBtnStyle.active.texture = getGUITexture(ScrollBarLeftActiveTex);
+		scrollLeftBtnStyle.fixedHeight = true;
+		scrollLeftBtnStyle.fixedWidth = true;
+		scrollLeftBtnStyle.height = 8;
+		scrollLeftBtnStyle.width = 4;
+
+		mSkin.setStyle("ScrollLeftBtn", scrollLeftBtnStyle);
+
+		// Right button
+		GUIElementStyle scrollRightBtnStyle;
+		scrollRightBtnStyle.normal.texture = getGUITexture(ScrollBarRightNormalTex);
+		scrollRightBtnStyle.hover.texture = getGUITexture(ScrollBarRightHoverTex);
+		scrollRightBtnStyle.active.texture = getGUITexture(ScrollBarRightActiveTex);
+		scrollRightBtnStyle.fixedHeight = true;
+		scrollRightBtnStyle.fixedWidth = true;
+		scrollRightBtnStyle.height = 8;
+		scrollRightBtnStyle.width = 4;
+
+		mSkin.setStyle("ScrollRightBtn", scrollRightBtnStyle);
+
+		// Horizontal handle
+		GUIElementStyle scrollBarHorzBtnStyle;
+		scrollBarHorzBtnStyle.normal.texture = getGUITexture(ScrollBarHandleHorzNormalTex);
+		scrollBarHorzBtnStyle.hover.texture = getGUITexture(ScrollBarHandleHorzHoverTex);
+		scrollBarHorzBtnStyle.active.texture = getGUITexture(ScrollBarHandleHorzActiveTex);
+		scrollBarHorzBtnStyle.fixedHeight = true;
+		scrollBarHorzBtnStyle.fixedWidth = true;
+		scrollBarHorzBtnStyle.height = 6;
+		scrollBarHorzBtnStyle.width = 4;
+
+		mSkin.setStyle("ScrollBarHorzBtn", scrollBarHorzBtnStyle);
+
+		// Vertical handle
+		GUIElementStyle scrollBarVertBtnStyle;
+		scrollBarVertBtnStyle.normal.texture = getGUITexture(ScrollBarHandleVertNormalTex);
+		scrollBarVertBtnStyle.hover.texture = getGUITexture(ScrollBarHandleVertHoverTex);
+		scrollBarVertBtnStyle.active.texture = getGUITexture(ScrollBarHandleVertActiveTex);
+		scrollBarVertBtnStyle.fixedHeight = true;
+		scrollBarVertBtnStyle.fixedWidth = true;
+		scrollBarVertBtnStyle.height = 4;
+		scrollBarVertBtnStyle.width = 6;
+
+		mSkin.setStyle("ScrollBarVertBtn", scrollBarVertBtnStyle);
+
+		HSpriteTexture scrollBarBgPtr = getGUITexture(ScrollBarBgTex);
+
+		// Vertical scroll bar
+		GUIElementStyle vertScrollBarStyle;
+		vertScrollBarStyle.normal.texture = scrollBarBgPtr;
+		vertScrollBarStyle.hover.texture = scrollBarBgPtr;
+		vertScrollBarStyle.active.texture = scrollBarBgPtr;
+		vertScrollBarStyle.fixedHeight = false;
+		vertScrollBarStyle.fixedWidth = true;
+		vertScrollBarStyle.minHeight = 16;
+		vertScrollBarStyle.width = 8;
+
+		mSkin.setStyle("ScrollBarVert", vertScrollBarStyle);
+
+		// Horizontal scroll bar
+		GUIElementStyle horzScrollBarStyle;
+		horzScrollBarStyle.normal.texture = scrollBarBgPtr;
+		horzScrollBarStyle.hover.texture = scrollBarBgPtr;
+		horzScrollBarStyle.active.texture = scrollBarBgPtr;
+		horzScrollBarStyle.fixedHeight = true;
+		horzScrollBarStyle.fixedWidth = false;
+		horzScrollBarStyle.minWidth = 16;
+		horzScrollBarStyle.height = 8;
+
+		mSkin.setStyle("ScrollBarHorz", horzScrollBarStyle);
+
+		/************************************************************************/
+		/* 								DROP DOWN BOX                      		*/
+		/************************************************************************/
+
+		// ListBox button
+		GUIElementStyle dropDownListStyle;
+		dropDownListStyle.normal.texture = getGUITexture(DropDownBtnNormalTex);
+		dropDownListStyle.hover.texture = getGUITexture(DropDownBtnHoverTex);
+		dropDownListStyle.active.texture = dropDownListStyle.hover.texture;
+		dropDownListStyle.normalOn.texture = dropDownListStyle.hover.texture;
+		dropDownListStyle.hoverOn.texture = dropDownListStyle.hover.texture;
+		dropDownListStyle.activeOn.texture = dropDownListStyle.hover.texture;
+		dropDownListStyle.fixedHeight = true;
+		dropDownListStyle.fixedWidth = false;
+		dropDownListStyle.height = 13;
+		dropDownListStyle.width = 30;
+		dropDownListStyle.contentOffset.left = 3;
+		dropDownListStyle.contentOffset.right = 11;
+		dropDownListStyle.contentOffset.top = 1;
+		dropDownListStyle.contentOffset.bottom = 1;
+		dropDownListStyle.border.left = 1;
+		dropDownListStyle.border.right = 10;
+		dropDownListStyle.border.top = 1;
+		dropDownListStyle.border.bottom = 1;
+		dropDownListStyle.font = font;
+		dropDownListStyle.fontSize = DefaultFontSize;
+		dropDownListStyle.textHorzAlign = THA_Left;
+		dropDownListStyle.textVertAlign = TVA_Top;
+
+		mSkin.setStyle("ListBox", dropDownListStyle);
+
+		// DropDown scroll up button arrow
+		HTexture dropDownBtnScrollUpArrow = getGUITexture(DropDownBoxBtnUpArrowTex);
+
+		GUIElementStyle dropDownScrollUpBtnArrowStyle;
+		dropDownScrollUpBtnArrowStyle.normal.texture = getGUITexture(DropDownBoxBtnUpArrowTex);
+		dropDownScrollUpBtnArrowStyle.hover.texture = dropDownScrollUpBtnArrowStyle.normal.texture;
+		dropDownScrollUpBtnArrowStyle.active.texture = dropDownScrollUpBtnArrowStyle.hover.texture;
+		dropDownScrollUpBtnArrowStyle.fixedHeight = true;
+		dropDownScrollUpBtnArrowStyle.fixedWidth = false;
+		dropDownScrollUpBtnArrowStyle.height = 7;
+		dropDownScrollUpBtnArrowStyle.width = 30;
+		dropDownScrollUpBtnArrowStyle.border.left = 1;
+		dropDownScrollUpBtnArrowStyle.border.right = 1;
+		dropDownScrollUpBtnArrowStyle.border.top = 1;
+		dropDownScrollUpBtnArrowStyle.border.bottom = 1;
+
+		mSkin.setStyle("ListBoxScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
+		mSkin.setStyle("MenuBarScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
+		mSkin.setStyle("ContextMenuScrollUpBtnArrow", dropDownScrollUpBtnArrowStyle);
+
+		// DropDown scroll up button
+		GUIElementStyle dropDownScrollUpBtnStyle;
+		dropDownScrollUpBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnUpNormalTex);
+		dropDownScrollUpBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnUpHoverTex);
+		dropDownScrollUpBtnStyle.active.texture = dropDownScrollUpBtnStyle.hover.texture;
+		dropDownScrollUpBtnStyle.fixedHeight = true;
+		dropDownScrollUpBtnStyle.fixedWidth = false;
+		dropDownScrollUpBtnStyle.height = 7;
+		dropDownScrollUpBtnStyle.width = 30;
+		dropDownScrollUpBtnStyle.border.left = 1;
+		dropDownScrollUpBtnStyle.border.right = 1;
+		dropDownScrollUpBtnStyle.border.top = 1;
+		dropDownScrollUpBtnStyle.border.bottom = 1;
+
+		mSkin.setStyle("ListBoxScrollUpBtn", dropDownScrollUpBtnStyle);
+		mSkin.setStyle("MenuBarScrollUpBtn", dropDownScrollUpBtnStyle);
+		mSkin.setStyle("ContextMenuScrollUpBtn", dropDownScrollUpBtnStyle);
+
+		// DropDown scroll down button arrow
+		GUIElementStyle dropDownScrollDownBtnArrowStyle;
+		dropDownScrollDownBtnArrowStyle.normal.texture = getGUITexture(DropDownBoxBtnDownArrowTex);
+		dropDownScrollDownBtnArrowStyle.hover.texture = dropDownScrollDownBtnArrowStyle.normal.texture;
+		dropDownScrollDownBtnArrowStyle.active.texture = dropDownScrollDownBtnArrowStyle.hover.texture;
+		dropDownScrollDownBtnArrowStyle.fixedHeight = true;
+		dropDownScrollDownBtnArrowStyle.fixedWidth = false;
+		dropDownScrollDownBtnArrowStyle.height = 7;
+		dropDownScrollDownBtnArrowStyle.width = 30;
+		dropDownScrollDownBtnArrowStyle.border.left = 1;
+		dropDownScrollDownBtnArrowStyle.border.right = 1;
+		dropDownScrollDownBtnArrowStyle.border.top = 1;
+		dropDownScrollDownBtnArrowStyle.border.bottom = 1;
+
+		mSkin.setStyle("ListBoxScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
+		mSkin.setStyle("MenuBarScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
+		mSkin.setStyle("ContextMenuScrollDownBtnArrow", dropDownScrollDownBtnArrowStyle);
+
+		// DropDown scroll down button
+		GUIElementStyle dropDownScrollDownBtnStyle;
+		dropDownScrollDownBtnStyle.normal.texture = getGUITexture(DropDownBoxBtnDownNormalTex);
+		dropDownScrollDownBtnStyle.hover.texture = getGUITexture(DropDownBoxBtnDownHoverTex);
+		dropDownScrollDownBtnStyle.active.texture = dropDownScrollDownBtnStyle.hover.texture;
+		dropDownScrollDownBtnStyle.fixedHeight = true;
+		dropDownScrollDownBtnStyle.fixedWidth = false;
+		dropDownScrollDownBtnStyle.height = 7;
+		dropDownScrollDownBtnStyle.width = 30;
+		dropDownScrollDownBtnStyle.border.left = 1;
+		dropDownScrollDownBtnStyle.border.right = 1;
+		dropDownScrollDownBtnStyle.border.top = 1;
+		dropDownScrollDownBtnStyle.border.bottom = 1;
+
+		mSkin.setStyle("ListBoxScrollDownBtn", dropDownScrollDownBtnStyle);
+		mSkin.setStyle("MenuBarScrollDownBtn", dropDownScrollDownBtnStyle);
+		mSkin.setStyle("ContextMenuScrollDownBtn", dropDownScrollDownBtnStyle);
+
+		// DropDown entry button
+		GUIElementStyle dropDownEntryBtnStyle;
+		dropDownEntryBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryNormalTex);
+		dropDownEntryBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryHoverTex);
+		dropDownEntryBtnStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
+		dropDownEntryBtnStyle.fixedHeight = true;
+		dropDownEntryBtnStyle.fixedWidth = false;
+		dropDownEntryBtnStyle.height = 14;
+		dropDownEntryBtnStyle.width = 30;
+		dropDownEntryBtnStyle.border.left = 1;
+		dropDownEntryBtnStyle.border.right = 1;
+		dropDownEntryBtnStyle.border.top = 1;
+		dropDownEntryBtnStyle.border.bottom = 1;
+		dropDownEntryBtnStyle.font = font;
+		dropDownEntryBtnStyle.fontSize = DefaultFontSize;
+		dropDownEntryBtnStyle.textHorzAlign = THA_Left;
+		dropDownEntryBtnStyle.textVertAlign = TVA_Top;
+
+		mSkin.setStyle("ListBoxEntryBtn", dropDownEntryBtnStyle);
+		mSkin.setStyle("MenuBarEntryBtn", dropDownEntryBtnStyle);
+		mSkin.setStyle("ContextMenuEntryBtn", dropDownEntryBtnStyle);
+
+		// DropDown entry button with expand
+		GUIElementStyle dropDownEntryExpBtnStyle;
+		dropDownEntryExpBtnStyle.normal.texture = getGUITexture(DropDownBoxEntryExpNormalTex);
+		dropDownEntryExpBtnStyle.hover.texture = getGUITexture(DropDownBoxEntryExpHoverTex);
+		dropDownEntryExpBtnStyle.active.texture = dropDownEntryExpBtnStyle.hover.texture;
+		dropDownEntryExpBtnStyle.fixedHeight = true;
+		dropDownEntryExpBtnStyle.fixedWidth = false;
+		dropDownEntryExpBtnStyle.height = 14;
+		dropDownEntryExpBtnStyle.width = 30;
+		dropDownEntryExpBtnStyle.border.left = 1;
+		dropDownEntryExpBtnStyle.border.right = 6;
+		dropDownEntryExpBtnStyle.border.top = 1;
+		dropDownEntryExpBtnStyle.border.bottom = 1;
+		dropDownEntryExpBtnStyle.font = font;
+		dropDownEntryExpBtnStyle.fontSize = DefaultFontSize;
+		dropDownEntryExpBtnStyle.textHorzAlign = THA_Left;
+		dropDownEntryExpBtnStyle.textVertAlign = TVA_Top;
+
+		mSkin.setStyle("ListBoxEntryExpBtn", dropDownEntryExpBtnStyle);
+		mSkin.setStyle("MenuBarEntryExpBtn", dropDownEntryExpBtnStyle);
+		mSkin.setStyle("ContextMenuEntryExpBtn", dropDownEntryExpBtnStyle);
+
+		// DropDown box frame
+		GUIElementStyle dropDownBoxStyle;
+		dropDownBoxStyle.normal.texture = getGUITexture(DropDownBoxBgTex);
+		dropDownBoxStyle.hover.texture = dropDownEntryBtnStyle.normal.texture;
+		dropDownBoxStyle.active.texture = dropDownEntryBtnStyle.hover.texture;
+		dropDownBoxStyle.fixedHeight = false;
+		dropDownBoxStyle.fixedWidth = false;
+		dropDownBoxStyle.border.left = 1;
+		dropDownBoxStyle.border.right = 1;
+		dropDownBoxStyle.border.top = 1;
+		dropDownBoxStyle.border.bottom = 1;
+		dropDownBoxStyle.margins.left = 1;
+		dropDownBoxStyle.margins.right = 1;
+		dropDownBoxStyle.margins.top = 1;
+		dropDownBoxStyle.margins.bottom = 1;
+
+		mSkin.setStyle("ListBoxFrame", dropDownBoxStyle);
+		mSkin.setStyle("MenuBarFrame", dropDownBoxStyle);
+		mSkin.setStyle("ContextMenuFrame", dropDownBoxStyle);
+
+		// Drop down separator
+		GUIElementStyle dropDownSeparatorStyle;
+		dropDownSeparatorStyle.normal.texture = getGUITexture(DropDownSeparatorTex);
+		dropDownSeparatorStyle.fixedHeight = true;
+		dropDownSeparatorStyle.fixedWidth = false;
+		dropDownSeparatorStyle.height = 3;
+		dropDownSeparatorStyle.width = 30;
+		dropDownSeparatorStyle.border.left = 1;
+		dropDownSeparatorStyle.border.right = 1;
+		dropDownSeparatorStyle.border.top = 1;
+		dropDownSeparatorStyle.border.bottom = 1;
+
+		mSkin.setStyle("ListBoxSeparator", dropDownSeparatorStyle);
+		mSkin.setStyle("MenuBarSeparator", dropDownSeparatorStyle);
+		mSkin.setStyle("ContextMenuSeparator", dropDownSeparatorStyle);
+
+		/************************************************************************/
+		/* 								MENU BAR	                     		*/
+		/************************************************************************/
+
+		// MenuBar background
+		GUIElementStyle menuBarBgStyle;
+		menuBarBgStyle.normal.texture = getGUITexture(MenuBarBgTex);
+		menuBarBgStyle.fixedHeight = false;
+		menuBarBgStyle.fixedWidth = false;
+		menuBarBgStyle.height = 4;
+		menuBarBgStyle.width = 4;
+
+		mSkin.setStyle("MenuBarBg", menuBarBgStyle);
+
+		// MenuBar Banshee logo
+		GUIElementStyle menuBarBansheeLogoStyle;
+		menuBarBansheeLogoStyle.normal.texture = getGUITexture(MenuBarBansheeLogoTex);
+		menuBarBansheeLogoStyle.fixedHeight = true;
+		menuBarBansheeLogoStyle.fixedWidth = true;
+		menuBarBansheeLogoStyle.height = 7;
+		menuBarBansheeLogoStyle.width = 51;
+
+		mSkin.setStyle("MenuBarBansheeLogo", menuBarBansheeLogoStyle);
+
+		// MenuBar button
+		GUIElementStyle menuBarBtnStyle;
+		menuBarBtnStyle.normal.texture = getGUITexture(MenuBarBtnNormalTex);
+		menuBarBtnStyle.hover.texture = getGUITexture(MenuBarBtnHoverTex);
+		menuBarBtnStyle.active.texture = menuBarBtnStyle.hover.texture;
+		menuBarBtnStyle.normalOn.texture = menuBarBtnStyle.hover.texture;
+		menuBarBtnStyle.hoverOn.texture = menuBarBtnStyle.hover.texture;
+		menuBarBtnStyle.activeOn.texture = menuBarBtnStyle.hover.texture;
+		menuBarBtnStyle.fixedHeight = true;
+		menuBarBtnStyle.fixedWidth = false;
+		menuBarBtnStyle.height = 15;
+		menuBarBtnStyle.width = 4;
+		menuBarBtnStyle.margins.left = 2;
+		menuBarBtnStyle.margins.right = 2;
+		menuBarBtnStyle.margins.top = 2;
+		menuBarBtnStyle.margins.bottom = 2;
+		menuBarBtnStyle.font = font;
+		menuBarBtnStyle.fontSize = DefaultFontSize;
+		menuBarBtnStyle.textHorzAlign = THA_Left;
+		menuBarBtnStyle.textVertAlign = TVA_Top;
+
+		mSkin.setStyle("MenuBarBtn", menuBarBtnStyle);
+
+		/************************************************************************/
+		/* 								DOCK SLIDER	                     		*/
+		/************************************************************************/
+
+		GUIElementStyle dockSliderBtnStyle;
+		dockSliderBtnStyle.normal.texture = getGUITexture(DockSliderNormalTex);
+		dockSliderBtnStyle.fixedHeight = false;
+		dockSliderBtnStyle.fixedWidth = false;
+		dockSliderBtnStyle.height = 2;
+		dockSliderBtnStyle.width = 2;
+
+		mSkin.setStyle("DockSliderBtn", dockSliderBtnStyle);
+
+		/************************************************************************/
+		/* 								TREE VIEW	                     		*/
+		/************************************************************************/
+
+		// Expand button
+		GUIElementStyle treeViewExpandButtonStyle;
+		treeViewExpandButtonStyle.normal.texture = getGUITexture(TreeViewExpandButtonOffNormal);
+		treeViewExpandButtonStyle.hover.texture = getGUITexture(TreeViewExpandButtonOffHover);
+		treeViewExpandButtonStyle.active.texture = treeViewExpandButtonStyle.hover.texture;
+		treeViewExpandButtonStyle.normalOn.texture = getGUITexture(TreeViewExpandButtonOnNormal);
+		treeViewExpandButtonStyle.hoverOn.texture = getGUITexture(TreeViewExpandButtonOnHover);
+		treeViewExpandButtonStyle.activeOn.texture = treeViewExpandButtonStyle.hoverOn.texture;
+		treeViewExpandButtonStyle.margins.left = 4;
+		treeViewExpandButtonStyle.margins.right = 4;
+		treeViewExpandButtonStyle.margins.top = 5;
+		treeViewExpandButtonStyle.margins.bottom = 4;
+		treeViewExpandButtonStyle.fixedHeight = true;
+		treeViewExpandButtonStyle.fixedWidth = true;
+		treeViewExpandButtonStyle.height = 16;
+		treeViewExpandButtonStyle.width = 16;
+
+		mSkin.setStyle("TreeViewFoldoutBtn", treeViewExpandButtonStyle);
+
+		// Entry
+		GUIElementStyle treeViewEntryStyle;
+		treeViewEntryStyle.font = font;
+		treeViewEntryStyle.fontSize = DefaultFontSize;
+		treeViewEntryStyle.fixedWidth = false;
+		treeViewEntryStyle.fixedHeight = true;
+		treeViewEntryStyle.height = 16;
+		treeViewEntryStyle.minWidth = 10;
+
+		mSkin.setStyle("TreeViewElementBtn", treeViewEntryStyle);
+
+		// Selection background
+		GUIElementStyle treeViewSelBackgroundStyle;
+		treeViewSelBackgroundStyle.normal.texture = getGUITexture(TreeViewSelectionBackground);
+		treeViewSelBackgroundStyle.fixedHeight = false;
+		treeViewSelBackgroundStyle.fixedWidth = false;
+		treeViewSelBackgroundStyle.height = 2;
+		treeViewSelBackgroundStyle.width = 2;
+
+		mSkin.setStyle("TreeViewSelectionBackground", treeViewSelBackgroundStyle);
+
+		// Edit box
+		GUIElementStyle treeViewEditBox;
+		treeViewEditBox.normal.texture = getGUITexture(TreeViewEditBox);
+		treeViewEditBox.hover.texture = treeViewEditBox.normal.texture;
+		treeViewEditBox.focused.texture = treeViewEditBox.normal.texture;
+		treeViewEditBox.active.texture = treeViewEditBox.normal.texture;
+		treeViewEditBox.border.left = 1;
+		treeViewEditBox.border.right = 1;
+		treeViewEditBox.border.top = 1;
+		treeViewEditBox.border.bottom = 1;
+		treeViewEditBox.margins.left = 1;
+		treeViewEditBox.margins.right = 1;
+		treeViewEditBox.margins.top = 1;
+		treeViewEditBox.margins.bottom = 1;
+		treeViewEditBox.fixedHeight = true;
+		treeViewEditBox.height = 13;
+		treeViewEditBox.minWidth = 10;
+		treeViewEditBox.font = font;
+		treeViewEditBox.fontSize = DefaultFontSize;
+		treeViewEditBox.textHorzAlign = THA_Left;
+		treeViewEditBox.textVertAlign = TVA_Top;
+
+		mSkin.setStyle(GUITreeViewEditBox::getGUITypeName(), treeViewEditBox);
+
+		// Element highlight
+		GUIElementStyle treeViewElementHighlight;
+		treeViewElementHighlight.normal.texture = getGUITexture(TreeViewElementHighlight);
+		treeViewElementHighlight.border.left = 1;
+		treeViewElementHighlight.border.right = 1;
+		treeViewElementHighlight.border.top = 1;
+		treeViewElementHighlight.border.bottom = 1;
+
+		mSkin.setStyle("TreeViewElementHighlight", treeViewElementHighlight);
+
+		// Element separator highlight
+		GUIElementStyle treeViewElementSepHighlight;
+		treeViewElementSepHighlight.normal.texture = getGUITexture(TreeViewElementSepHighlight);
+		treeViewElementSepHighlight.border.left = 1;
+		treeViewElementSepHighlight.border.right = 1;
+		treeViewElementSepHighlight.border.top = 1;
+		treeViewElementSepHighlight.border.bottom = 1;
+
+		mSkin.setStyle("TreeViewElementSepHighlight", treeViewElementSepHighlight);
+	
+		/************************************************************************/
+		/* 							OBJECT DROP FIELD                      		*/
+		/************************************************************************/
+		GUIElementStyle objectDropStyle;
+		objectDropStyle.normal.texture = getGUITexture(ObjectDropBtnNormalTex);
+		objectDropStyle.normalOn.texture = getGUITexture(ObjectDropBtnNormalOnTex);
+		objectDropStyle.fixedHeight = true;
+		objectDropStyle.height = 15;
+		objectDropStyle.minWidth = 50;
+		objectDropStyle.font = font;
+		objectDropStyle.fontSize = DefaultFontSize;
+		objectDropStyle.textHorzAlign = THA_Center;
+		objectDropStyle.textVertAlign = TVA_Center;
+
+		mSkin.setStyle(ObjectFieldDropBtnStyleName, objectDropStyle);
+
+		GUIElementStyle objectClearBtnStyle;
+		objectClearBtnStyle.normal.texture = getGUITexture(ObjectClearBtnNormalTex);
+		objectClearBtnStyle.hover.texture = getGUITexture(ObjectClearBtnHoverTex);
+		objectClearBtnStyle.active.texture = getGUITexture(ObjectClearBtnActiveTex);
+		objectClearBtnStyle.fixedHeight = true;
+		objectClearBtnStyle.fixedWidth = true;
+		objectClearBtnStyle.height = 15;
+		objectClearBtnStyle.width = 13;
+
+		mSkin.setStyle(ObjectFieldClearBtnStyleName, objectClearBtnStyle);
+
+		GUIElementStyle editorObjectFieldStyle;
+		editorObjectFieldStyle.fixedHeight = true;
+		editorObjectFieldStyle.height = 15;
+		editorObjectFieldStyle.minWidth = 30;
+		editorObjectFieldStyle.subStyles[ObjectFieldLabelStyleName] = GUITextField::getLabelStyleType();
+		editorObjectFieldStyle.subStyles[ObjectFieldDropBtnStyleName] = ObjectFieldDropBtnStyleName;
+		editorObjectFieldStyle.subStyles[ObjectFieldClearBtnStyleName] = ObjectFieldClearBtnStyleName;
+
+		mSkin.setStyle(ObjectFieldStyleName, editorObjectFieldStyle);
+
+		/************************************************************************/
+		/* 								EDITOR FIELDS                      		*/
+		/************************************************************************/
+
+		GUIElementStyle editorFieldLabelStyle;
+		editorFieldLabelStyle.font = font;
+		editorFieldLabelStyle.fontSize = DefaultFontSize;
+		editorFieldLabelStyle.fixedWidth = false;
+		editorFieldLabelStyle.fixedHeight = true;
+		editorFieldLabelStyle.height = 11;
+		editorFieldLabelStyle.minWidth = 10;
+		editorFieldLabelStyle.textHorzAlign = THA_Left;
+
+		mSkin.setStyle(GUITextField::getLabelStyleType(), editorFieldLabelStyle);
+
+		GUIElementStyle editorIntFieldStyle;
+		editorIntFieldStyle.fixedHeight = true;
+		editorIntFieldStyle.height = 15;
+		editorIntFieldStyle.minWidth = 30;
+		editorIntFieldStyle.subStyles[GUIIntField::getLabelStyleType()] = GUITextField::getLabelStyleType();
+		editorIntFieldStyle.subStyles[GUIIntField::getInputStyleType()] = GUIInputBox::getGUITypeName();
+
+		mSkin.setStyle(GUIIntField::getGUITypeName(), editorIntFieldStyle);
+
+		GUIElementStyle editorFloatFieldStyle;
+		editorFloatFieldStyle.fixedHeight = true;
+		editorFloatFieldStyle.height = 15;
+		editorFloatFieldStyle.minWidth = 30;
+		editorFloatFieldStyle.subStyles[GUIFloatField::getLabelStyleType()] = GUITextField::getLabelStyleType();
+		editorFloatFieldStyle.subStyles[GUIFloatField::getInputStyleType()] = GUIInputBox::getGUITypeName();
+
+		mSkin.setStyle(GUIFloatField::getGUITypeName(), editorFloatFieldStyle);
+
+		GUIElementStyle editorTextFieldStyle;
+		editorTextFieldStyle.fixedHeight = true;
+		editorTextFieldStyle.height = 15;
+		editorTextFieldStyle.minWidth = 30;
+		editorTextFieldStyle.subStyles[GUITextField::getLabelStyleType()] = GUITextField::getLabelStyleType();
+		editorTextFieldStyle.subStyles[GUITextField::getInputStyleType()] = GUIInputBox::getGUITypeName();
+
+		mSkin.setStyle(GUITextField::getGUITypeName(), editorTextFieldStyle);
+
+		GUIElementStyle editorColorFieldStyle;
+		editorColorFieldStyle.fixedHeight = true;
+		editorColorFieldStyle.height = 15;
+		editorColorFieldStyle.minWidth = 30;
+		editorColorFieldStyle.subStyles[GUIColorField::getLabelStyleType()] = GUITextField::getLabelStyleType();
+		editorColorFieldStyle.subStyles[GUIColorField::getColorInputStyleType()] = GUIColor::getGUITypeName();
+
+		mSkin.setStyle(GUIColorField::getGUITypeName(), editorColorFieldStyle);
+
+		GUIElementStyle editorToggleFieldStyle;
+		editorToggleFieldStyle.fixedHeight = true;
+		editorToggleFieldStyle.height = 15;
+		editorToggleFieldStyle.minWidth = 30;
+		editorToggleFieldStyle.subStyles[GUIToggleField::getLabelStyleType()] = GUITextField::getLabelStyleType();
+		editorToggleFieldStyle.subStyles[GUIToggleField::getToggleStyleType()] = GUIToggle::getGUITypeName();
+
+		mSkin.setStyle(GUIToggleField::getGUITypeName(), editorToggleFieldStyle);
+
+		GUIElementStyle editorVector2FieldStyle;
+		editorVector2FieldStyle.fixedHeight = true;
+		editorVector2FieldStyle.height = 30;
+		editorVector2FieldStyle.minWidth = 30;
+		editorVector2FieldStyle.subStyles[GUIVector2Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
+		editorVector2FieldStyle.subStyles[GUIVector2Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
+
+		mSkin.setStyle(GUIVector2Field::getGUITypeName(), editorVector2FieldStyle);
+
+		GUIElementStyle editorVector3FieldStyle;
+		editorVector3FieldStyle.fixedHeight = true;
+		editorVector3FieldStyle.height = 30;
+		editorVector3FieldStyle.minWidth = 30;
+		editorVector3FieldStyle.subStyles[GUIVector3Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
+		editorVector3FieldStyle.subStyles[GUIVector3Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
+
+		mSkin.setStyle(GUIVector3Field::getGUITypeName(), editorVector3FieldStyle);
+
+		GUIElementStyle editorVector4FieldStyle;
+		editorVector4FieldStyle.fixedHeight = true;
+		editorVector4FieldStyle.height = 30;
+		editorVector4FieldStyle.minWidth = 30;
+		editorVector4FieldStyle.subStyles[GUIVector4Field::getLabelStyleType()] = GUITextField::getLabelStyleType();
+		editorVector4FieldStyle.subStyles[GUIVector4Field::getFloatFieldStyleType()] = GUIFloatField::getGUITypeName();
+
+		mSkin.setStyle(GUIVector4Field::getGUITypeName(), editorVector4FieldStyle);
+
+		/************************************************************************/
+		/* 							COMPONENT FOLDOUT                      		*/
+		/************************************************************************/
+		GUIElementStyle cmpFoldoutBtnStyle;
+		cmpFoldoutBtnStyle.normal.texture = getGUITexture(CmpFoldoutClosedNormalTex);
+		cmpFoldoutBtnStyle.hover.texture = getGUITexture(CmpFoldoutClosedHoverTex);
+		cmpFoldoutBtnStyle.active.texture = getGUITexture(CmpFoldoutOpenActiveTex);
+		cmpFoldoutBtnStyle.normalOn.texture = getGUITexture(CmpFoldoutOpenNormalTex);
+		cmpFoldoutBtnStyle.hoverOn.texture = getGUITexture(CmpFoldoutOpenHoverTex);
+		cmpFoldoutBtnStyle.activeOn.texture = getGUITexture(CmpFoldoutOpenActiveTex);
+		cmpFoldoutBtnStyle.fixedHeight = true;
+		cmpFoldoutBtnStyle.fixedWidth = false;
+		cmpFoldoutBtnStyle.height = 10;
+		cmpFoldoutBtnStyle.minWidth = 10;
+		cmpFoldoutBtnStyle.font = font;
+		cmpFoldoutBtnStyle.fontSize = DefaultFontSize;
+		cmpFoldoutBtnStyle.textHorzAlign = THA_Left;
+		cmpFoldoutBtnStyle.textVertAlign = TVA_Center;
+		cmpFoldoutBtnStyle.contentOffset = RectOffset(12, 0, 0, 0);
+		cmpFoldoutBtnStyle.border.left = 8;
+
+		mSkin.setStyle(GUIComponentFoldout::getFoldoutButtonStyleType(), cmpFoldoutBtnStyle);
+
+		GUIElementStyle cmpFoldoutStyle;
+		cmpFoldoutStyle.fixedHeight = true;
+		cmpFoldoutStyle.height = 12;
+		cmpFoldoutStyle.minWidth = 30;
+		cmpFoldoutStyle.subStyles[GUIComponentFoldout::getFoldoutButtonStyleType()] = GUIComponentFoldout::getFoldoutButtonStyleType();
+
+		mSkin.setStyle(GUIComponentFoldout::getGUITypeName(), cmpFoldoutStyle);
+
+		/************************************************************************/
+		/* 							     FOLDOUT                      		    */
+		/************************************************************************/
+		GUIElementStyle foldoutBtnStyle;
+		foldoutBtnStyle.normal.texture = getGUITexture(FoldoutClosedNormalTex);
+		foldoutBtnStyle.hover.texture = getGUITexture(FoldoutClosedHoverTex);
+		foldoutBtnStyle.active.texture = foldoutBtnStyle.hover.texture;
+		foldoutBtnStyle.normalOn.texture = getGUITexture(FoldoutOpenNormalTex);
+		foldoutBtnStyle.hoverOn.texture = getGUITexture(FoldoutOpenHoverTex);
+		foldoutBtnStyle.activeOn.texture = foldoutBtnStyle.hoverOn.texture;
+		foldoutBtnStyle.fixedHeight = true;
+		foldoutBtnStyle.fixedWidth = true;
+		foldoutBtnStyle.height = 10;
+		foldoutBtnStyle.width = 8;
+
+		mSkin.setStyle(GUIFoldout::getFoldoutButtonStyleType(), foldoutBtnStyle);
+
+		GUIElementStyle foldoutStyle;
+		foldoutStyle.fixedHeight = true;
+		foldoutStyle.height = 12;
+		foldoutStyle.minWidth = 30;
+		foldoutStyle.subStyles[GUIFoldout::getLabelStyleType()] = GUIFoldout::getLabelStyleType();
+		foldoutStyle.subStyles[GUIFoldout::getFoldoutButtonStyleType()] = GUIFoldout::getFoldoutButtonStyleType();
+
+		mSkin.setStyle(GUIFoldout::getGUITypeName(), foldoutStyle);
+	}
+
+	void BuiltinEditorResources::preprocess()
+	{
+		static const WString GUI_TEXTURES[] = 
+		{   WindowBackgroundTexture, ButtonNormalTex, ButtonHoverTex, ButtonActiveTex, ToggleNormalTex,
+			ToggleHoverTex, ToggleActiveTex, ToggleNormalOnTex, ToggleHoverOnTex, ToggleActiveOnTex,
+			ObjectDropBtnNormalTex, ObjectDropBtnNormalOnTex, ObjectClearBtnNormalTex, ObjectClearBtnHoverTex,
+			ObjectClearBtnActiveTex, FoldoutOpenNormalTex, FoldoutOpenHoverTex, FoldoutClosedNormalTex,
+			FoldoutClosedHoverTex, CmpFoldoutOpenNormalTex, CmpFoldoutOpenHoverTex, CmpFoldoutOpenActiveTex,
+			CmpFoldoutClosedNormalTex, CmpFoldoutClosedHoverTex, CmpFoldoutClosedActiveTex, WindowFrameNormal,
+			WindowFrameFocused, WindowTitleBarBg, WindowCloseButtonNormal, WindowCloseButtonHover, WindowMinButtonNormal,
+			WindowMinButtonHover, WindowMaxButtonNormal, WindowMaxButtonHover, TabbedBarBtnNormal, TabbedBarBtnActive,
+			InputBoxNormalTex, InputBoxHoverTex, InputBoxFocusedTex, ScrollBarUpNormalTex, ScrollBarUpHoverTex,
+			ScrollBarUpActiveTex, ScrollBarDownNormalTex, ScrollBarDownHoverTex, ScrollBarDownActiveTex, ScrollBarLeftNormalTex,
+			ScrollBarLeftHoverTex, ScrollBarLeftActiveTex, ScrollBarRightNormalTex, ScrollBarRightHoverTex, ScrollBarRightActiveTex,
+			ScrollBarHandleHorzNormalTex, ScrollBarHandleHorzHoverTex, ScrollBarHandleHorzActiveTex, ScrollBarHandleVertNormalTex,
+			ScrollBarHandleVertHoverTex, ScrollBarHandleVertActiveTex, DropDownBtnNormalTex, DropDownBtnHoverTex,
+			DropDownBoxBgTex, DropDownBoxEntryNormalTex, DropDownBoxEntryHoverTex, DropDownBoxBtnUpNormalTex,
+			DropDownBoxBtnUpHoverTex, DropDownBoxBtnDownNormalTex, DropDownBoxBtnDownHoverTex, DropDownBoxEntryExpNormalTex,
+			DropDownBoxEntryExpHoverTex, DropDownSeparatorTex, DropDownBoxBtnUpArrowTex, DropDownBoxBtnDownArrowTex,
+			ScrollBarBgTex, MenuBarBgTex, MenuBarBtnNormalTex, MenuBarBtnHoverTex, MenuBarBansheeLogoTex, DockSliderNormalTex,
+			TreeViewExpandButtonOffNormal, TreeViewExpandButtonOffHover, TreeViewExpandButtonOnNormal, TreeViewExpandButtonOnHover,
+			TreeViewSelectionBackground, TreeViewEditBox, TreeViewElementHighlight, TreeViewElementSepHighlight };
+
+		static const GpuProgramImportData GPU_PROGRAM_IMPORT_DATA[] = 
+		{
+			{ SceneGridVSFile,			"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"hlsl", HLSL11ShaderSubFolder },
+			{ SceneGridPSFile,			"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0,		"hlsl", HLSL11ShaderSubFolder },
+			{ ShaderDockOverlayVSFile,	"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"hlsl", HLSL11ShaderSubFolder },
+			{ ShaderDockOverlayPSFile,	"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0,		"hlsl", HLSL11ShaderSubFolder },
+			{ SceneGridVSFile,			"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_2_0,		"hlsl", HLSL9ShaderSubFolder },
+			{ SceneGridPSFile,			"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_PS_2_0,		"hlsl", HLSL9ShaderSubFolder },
+			{ ShaderDockOverlayVSFile,	"vs_main",	GPT_VERTEX_PROGRAM,		GPP_VS_2_0,		"hlsl", HLSL9ShaderSubFolder },
+			{ ShaderDockOverlayPSFile,	"ps_main",	GPT_FRAGMENT_PROGRAM,	GPP_PS_2_0,		"hlsl", HLSL9ShaderSubFolder },
+			{ SceneGridVSFile,			"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"glsl", GLSLShaderSubFolder },
+			{ SceneGridPSFile,			"main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0,		"glsl", GLSLShaderSubFolder },
+			{ ShaderDockOverlayVSFile,	"main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0,		"glsl", GLSLShaderSubFolder },
+			{ ShaderDockOverlayPSFile,	"main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0,		"glsl", GLSLShaderSubFolder }
+		};
+
+		if (FileSystem::exists(DefaultSkinFolderRaw))
+		{
+			FileSystem::remove(DefaultSkinFolder);
+
+			for (auto& tex : GUI_TEXTURES)
+				importGUITexture(tex);
+
+			{
+				Path fontPath = FileSystem::getWorkingDirectoryPath();
+				fontPath.append(DefaultSkinFolderRaw);
+				fontPath.append(DefaultFontFilename);
+
+				ImportOptionsPtr fontImportOptions = Importer::instance().createImportOptions(fontPath);
+				if (rtti_is_of_type<FontImportOptions>(fontImportOptions))
+				{
+					FontImportOptions* importOptions = static_cast<FontImportOptions*>(fontImportOptions.get());
+
+					Vector<UINT32> fontSizes;
+					fontSizes.push_back(DefaultFontSize);
+					importOptions->setFontSizes(fontSizes);
+					importOptions->setAntialiasing(false);
+				}
+
+				HFont font = Importer::instance().import(fontPath, fontImportOptions);
+
+				Path outputPath = FileSystem::getWorkingDirectoryPath();
+				outputPath.append(DefaultSkinFolder);
+				outputPath.append(DefaultFontFilename + L".asset");
+
+				Resources::instance().save(font, outputPath, true);
+
+				// Save font texture pages as well. TODO - Later maybe figure out a more automatic way to do this
+				const FontData* fontData = font->getFontDataForSize(DefaultFontSize);
+
+				Path texPageOutputPath = FileSystem::getWorkingDirectoryPath();
+				texPageOutputPath.append(DefaultSkinFolder);
+
+				UINT32 pageIdx = 0;
+				for (auto tex : fontData->texturePages)
+				{
+					texPageOutputPath.setFilename(DefaultFontFilename + L"_texpage_" + toWString(pageIdx) + L".asset");
+					Resources::instance().save(tex, texPageOutputPath, true);
+				}
+			}
+		}
+
+		if (FileSystem::exists(DefaultShaderFolderRaw))
+		{
+			Path shaderFolder = DefaultShaderFolder;
+			shaderFolder.append(mActiveShaderSubFolder);
+
+			FileSystem::remove(shaderFolder);
+
+			for (auto& importData : GPU_PROGRAM_IMPORT_DATA)
+			{
+				if (importData.folder != mActiveShaderSubFolder)
+					continue;
+
+				Path gpuProgInputLoc = DefaultShaderFolderRaw;
+				gpuProgInputLoc.append(importData.folder);
+				gpuProgInputLoc.append(importData.filename);
+
+				Path gpuProgOutputLoc = DefaultShaderFolder;
+				gpuProgOutputLoc.append(importData.folder);
+				gpuProgOutputLoc.append(importData.filename + L".asset");
+
+				ImportOptionsPtr gpuProgImportOptions = Importer::instance().createImportOptions(gpuProgInputLoc);
+				if (rtti_is_of_type<GpuProgramImportOptions>(gpuProgImportOptions))
+				{
+					GpuProgramImportOptions* importOptions = static_cast<GpuProgramImportOptions*>(gpuProgImportOptions.get());
+
+					importOptions->setEntryPoint(importData.entryPoint);
+					importOptions->setLanguage(importData.language);
+					importOptions->setProfile(importData.profile);
+					importOptions->setType(importData.type);
+				}
+
+				HGpuProgram gpuProgram = Importer::instance().import(gpuProgInputLoc, gpuProgImportOptions);
+				Resources::instance().save(gpuProgram, gpuProgOutputLoc, true);
+			}
+		}
+
+		Resources::instance().unloadAllUnused();
+	}
+
+	void BuiltinEditorResources::importGUITexture(const WString& name)
+	{
+		Path texturePath = FileSystem::getWorkingDirectoryPath();
+		texturePath.append(DefaultSkinFolderRaw);
+		texturePath.append(name);
+
+		Path texOutputPath = FileSystem::getWorkingDirectoryPath();
+		texOutputPath.append(DefaultSkinFolder);
+		Path spriteTexOutputPath = texOutputPath;
+		texOutputPath.append(name + L".asset");
+		spriteTexOutputPath.append(L"sprite_" + name + L".asset");
+
+		HTexture tex = Importer::instance().import<Texture>(texturePath);
+		Resources::instance().save(tex, texOutputPath, true);
+
+		HSpriteTexture spriteTex = SpriteTexture::create(tex);
+		Resources::instance().save(spriteTex, spriteTexOutputPath, true);
+	}
+
+	HSpriteTexture BuiltinEditorResources::getGUITexture(const WString& name)
+	{
+		Path texturePath = FileSystem::getWorkingDirectoryPath();
+		texturePath.append(DefaultSkinFolder);
+		texturePath.append(L"sprite_" + name + L".asset");
+
+		return Resources::instance().load<SpriteTexture>(texturePath);
+	}
+
+	HGpuProgram BuiltinEditorResources::getGpuProgram(const WString& name)
+	{
+		Path programPath = DefaultShaderFolder;
+		programPath.append(mActiveShaderSubFolder);
+		programPath.append(name + L".asset");
+
+		return gResources().load<GpuProgram>(programPath);
+	}
+
+	void BuiltinEditorResources::initDockDropOverlayShader()
+	{
+		HGpuProgram vsProgram = getGpuProgram(ShaderDockOverlayVSFile);
+		HGpuProgram psProgram = getGpuProgram(ShaderDockOverlayPSFile);
+
+		mShaderDockOverlay = Shader::create("DockDropOverlayShader");
+
+		mShaderDockOverlay->addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
+		mShaderDockOverlay->addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
+
+		mShaderDockOverlay->addParameter("tintColor", "tintColor", GPDT_FLOAT4);
+		mShaderDockOverlay->addParameter("highlightColor", "highlightColor", GPDT_FLOAT4);
+		mShaderDockOverlay->addParameter("highlightActive", "highlightActive", GPDT_FLOAT4);
+
+		TechniquePtr newTechnique = mShaderDockOverlay->addTechnique(mActiveRenderSystem, RendererInvariant);
+		PassPtr newPass = newTechnique->addPass();
+		newPass->setVertexProgram(vsProgram);
+		newPass->setFragmentProgram(psProgram);
+
+		BLEND_STATE_DESC desc;
+		desc.renderTargetDesc[0].blendEnable = true;
+		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
+		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
+		desc.renderTargetDesc[0].blendOp = BO_ADD;
+
+		HBlendState blendState = BlendState::create(desc);
+		newPass->setBlendState(blendState);
+
+		DEPTH_STENCIL_STATE_DESC depthStateDesc;
+		depthStateDesc.depthReadEnable = false;
+		depthStateDesc.depthWriteEnable = false;
+
+		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
+		newPass->setDepthStencilState(depthState);
+	}
+
+	void BuiltinEditorResources::initSceneGridShader()
+	{
+		HGpuProgram vsProgram = getGpuProgram(SceneGridVSFile);
+		HGpuProgram psProgram = getGpuProgram(SceneGridPSFile);
+
+		mShaderSceneGrid = Shader::create("DebugDraw3DShader");
+
+		mShaderSceneGrid->addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
+
+		TechniquePtr newTechnique = mShaderSceneGrid->addTechnique(mActiveRenderSystem, RendererInvariant);
+		PassPtr newPass = newTechnique->addPass();
+		newPass->setVertexProgram(vsProgram);
+		newPass->setFragmentProgram(psProgram);
+
+		BLEND_STATE_DESC desc;
+		desc.renderTargetDesc[0].blendEnable = true;
+		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
+		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
+		desc.renderTargetDesc[0].blendOp = BO_ADD;
+
+		HBlendState blendState = BlendState::create(desc);
+		newPass->setBlendState(blendState);
+	}
+
+	HMaterial BuiltinEditorResources::createDockDropOverlayMaterial() const
+	{
+		return Material::create(mShaderDockOverlay);
+	}
+
+	HMaterial BuiltinEditorResources::createSceneGridMaterial() const
+	{
+		return Material::create(mShaderSceneGrid);
+	}
 }

+ 2 - 2
BansheeEditor/Source/BsDockManager.cpp

@@ -13,7 +13,7 @@
 #include "BsRenderer.h"
 #include "BsSceneObject.h"
 #include "BsGUIManager.h"
-#include "BsBuiltinMaterialManager.h"
+#include "BsBuiltinEditorResources.h"
 #include "BsGUIWidget.h"
 #include "BsCamera.h"
 #include "BsDragAndDropManager.h"
@@ -416,7 +416,7 @@ namespace BansheeEngine
 		mLeftDropPolygon = bs_newN<Vector2>(4);
 		mRightDropPolygon = bs_newN<Vector2>(4);
 
-		mDropOverlayMat = BuiltinMaterialManager::instance().createDockDropOverlayMaterial();
+		mDropOverlayMat = BuiltinEditorResources::instance().createDockDropOverlayMaterial();
 	}
 
 	DockManager::~DockManager()

+ 3 - 3
BansheeEditor/Source/BsEditorApplication.cpp

@@ -3,7 +3,7 @@
 #include "BsEditorWidgetManager.h"
 #include "BsMainEditorWindow.h"
 #include "BsRenderWindow.h"
-#include "BsEditorGUI.h"
+#include "BsBuiltinEditorResources.h"
 #include "BsUndoRedo.h"
 #include "BsFileSerializer.h"
 #include "BsFileSystem.h"
@@ -57,7 +57,7 @@ namespace BansheeEngine
 		:Application(createRenderWindowDesc(), renderSystemPlugin, RendererPlugin::Default), 
 		mActiveRSPlugin(renderSystemPlugin)
 	{
-		EditorGUI::startUp();
+		BuiltinEditorResources::startUp(renderSystemPlugin);
 
 		{
 			auto inputConfig = VirtualInput::instance().getConfiguration();
@@ -122,7 +122,7 @@ namespace BansheeEngine
 		/************************************************************************/
 
 		ProjectLibrary::shutDown();
-		EditorGUI::shutDown();
+		BuiltinEditorResources::shutDown();
 	}
 
 	void EditorApplication::onStartUp()

+ 3 - 3
BansheeEditor/Source/BsEditorWindowBase.cpp

@@ -7,7 +7,7 @@
 #include "BsEditorWindowManager.h"
 #include "BsCamera.h"
 #include "BsGUIWindowFrameWidget.h"
-#include "BsEditorGUI.h"
+#include "BsBuiltinEditorResources.h"
 
 namespace BansheeEngine
 {
@@ -71,9 +71,9 @@ namespace BansheeEngine
 		mGUI = mSceneObject->addComponent<GUIWidget>(mCamera->getViewport().get());
 		mGUI->setDepth(128);
 
-		mGUI->setSkin(EditorGUI::instance().getSkin());
+		mGUI->setSkin(BuiltinEditorResources::instance().getSkin());
 
-		mWindowFrame = mSceneObject->addComponent<WindowFrameWidget>(mCamera->getViewport().get(), renderWindow.get(), EditorGUI::instance().getSkin());
+		mWindowFrame = mSceneObject->addComponent<WindowFrameWidget>(mCamera->getViewport().get(), renderWindow.get(), BuiltinEditorResources::instance().getSkin());
 		mWindowFrame->setDepth(129);
 
 		mResizedConn = renderWindow->onResized.connect(std::bind(&EditorWindowBase::resized, this));

+ 1 - 1
BansheeEditor/Source/BsGUIResourceTreeView.cpp

@@ -142,7 +142,7 @@ namespace BansheeEngine
 	{
 		ResourceTreeElement* newChild = bs_new<ResourceTreeElement>();
 		newChild->mParent = parent;
-		newChild->mName = fullPath.getFilename();
+		newChild->mName = fullPath.getTail();
 		newChild->mFullPath = fullPath;
 		newChild->mSortedIdx = (UINT32)parent->mChildren.size();
 		newChild->mIsVisible = parent->mIsVisible && parent->mIsExpanded;

+ 135 - 0
BansheeEditor/Source/BsSceneGrid.cpp

@@ -0,0 +1,135 @@
+#include "BsSceneGrid.h"
+#include "BsMath.h"
+#include "BsDrawHelper3D.h"
+#include "BsVertexDataDesc.h"
+#include "BsMesh.h"
+
+namespace BansheeEngine
+{
+	const float SceneGrid::LINE_WIDTH = 0.025f;
+	const float SceneGrid::LINE_BORDER_WIDTH = 0.005f;
+	const float SceneGrid::MAJOR_AXIS_WIDTH = 0.075f;
+	const float SceneGrid::MAJOR_AXIS_BORDER_WIDTH = 0.015f;
+	const float SceneGrid::AXIS_MARKER_WIDTH = 0.1f;
+	const float SceneGrid::AXIS_MARKER_BORDER_WIDTH = 0.02f;
+	const Color SceneGrid::AXIS_X_MARKER_COLOR = Color::Red;
+	const Color SceneGrid::AXIS_Z_MARKER_COLOR = Color::Blue;
+
+	SceneGrid::SceneGrid()
+	{
+		mVertexDesc = bs_shared_ptr<VertexDataDesc>();
+		mVertexDesc->addVertElem(VET_FLOAT3, VES_POSITION);
+		mVertexDesc->addVertElem(VET_COLOR, VES_COLOR);
+	}
+
+	void SceneGrid::setOrigin(const Vector3& origin)
+	{
+		mOrigin = origin;
+		updateGridMesh();
+	}
+
+	void SceneGrid::setSize(float size)
+	{
+		mSize = size;
+		updateGridMesh();
+	}
+
+	void SceneGrid::setSpacing(float spacing)
+	{
+		mSpacing = spacing;
+		updateGridMesh();
+	}
+
+	void SceneGrid::setMajorAxisSpacing(UINT32 spacing)
+	{
+		mMajorAxisSpacing = spacing;
+		updateGridMesh();
+	}
+
+	void SceneGrid::setAxisMarkerSpacing(UINT32 spacing)
+	{
+		mAxisMarkerSpacing = spacing;
+		updateGridMesh();
+	}
+
+	void SceneGrid::updateGridMesh()
+	{
+		UINT32 numLines = (UINT32)Math::roundToInt(mSize / mSpacing);
+		if (numLines % 2 != 0)
+			numLines++;
+
+		INT32 originX = Math::roundToInt(mOrigin.x / mSpacing);
+		INT32 originZ = Math::roundToInt(mOrigin.y / mSpacing);
+
+		INT32 startX = originX - numLines / 2;
+		INT32 startZ = originZ - numLines / 2;
+
+		float minX = startX * mSpacing;
+		float minZ = startZ * mSpacing;
+
+		float maxX = (startX + numLines) * mSpacing;
+		float maxZ = (startZ + numLines) * mSpacing;
+
+		UINT32 totalNumVertices = DrawHelper3D::NUM_VERTICES_AA_LINE * numLines * 2;
+		UINT32 totalNumIndices = DrawHelper3D::NUM_INDICES_AA_LINE * numLines * 2;
+
+		MeshDataPtr meshData = bs_shared_ptr<MeshData, PoolAlloc>(totalNumVertices, totalNumIndices, mVertexDesc);
+		UINT32 vertexOffset = 0;
+		UINT32 indexOffset = 0;
+
+		for (UINT32 i = 0; i < numLines; i++)
+		{
+			INT32 x = startX + i;
+			float linePosX = x * mSpacing;
+
+			Vector3 lineStartX(linePosX, 0, minZ);
+			Vector3 lineEndX(linePosX, 0, maxZ);
+
+			if (x % mAxisMarkerSpacing == 0)
+			{
+				DrawHelper3D::instance().line_AA(lineStartX, lineEndX, Vector3::UNIT_Y, AXIS_MARKER_WIDTH, 
+					AXIS_MARKER_BORDER_WIDTH, AXIS_X_MARKER_COLOR, meshData, vertexOffset, indexOffset);
+			}
+			else if (x % mMajorAxisSpacing == 0)
+			{
+				DrawHelper3D::instance().line_AA(lineStartX, lineEndX, Vector3::UNIT_Y, MAJOR_AXIS_WIDTH,
+					MAJOR_AXIS_BORDER_WIDTH, Color::White, meshData, vertexOffset, indexOffset);
+			}
+			else
+			{
+				DrawHelper3D::instance().line_AA(lineStartX, lineEndX, Vector3::UNIT_Y, LINE_WIDTH,
+					LINE_BORDER_WIDTH, Color::White, meshData, vertexOffset, indexOffset);
+			}
+
+			vertexOffset += DrawHelper3D::NUM_VERTICES_AA_LINE;
+			indexOffset += DrawHelper3D::NUM_INDICES_AA_LINE;
+
+			INT32 z = startZ + i;
+			float linePosZ = z * mSpacing;
+
+			Vector3 lineStartZ(minX, 0, linePosZ);
+			Vector3 lineEndZ(maxX, 0, linePosZ);
+
+			if (z % mAxisMarkerSpacing == 0)
+			{
+				DrawHelper3D::instance().line_AA(lineStartZ, lineEndZ, Vector3::UNIT_Y, AXIS_MARKER_WIDTH,
+					AXIS_MARKER_BORDER_WIDTH, AXIS_Z_MARKER_COLOR, meshData, vertexOffset, indexOffset);
+			}
+			else if (z % mMajorAxisSpacing == 0)
+			{
+				DrawHelper3D::instance().line_AA(lineStartZ, lineEndZ, Vector3::UNIT_Y, MAJOR_AXIS_WIDTH,
+					MAJOR_AXIS_BORDER_WIDTH, Color::White, meshData, vertexOffset, indexOffset);
+			}
+			else
+			{
+				DrawHelper3D::instance().line_AA(lineStartZ, lineEndZ, Vector3::UNIT_Y, LINE_WIDTH,
+					LINE_BORDER_WIDTH, Color::White, meshData, vertexOffset, indexOffset);
+			}
+
+			vertexOffset += DrawHelper3D::NUM_VERTICES_AA_LINE;
+			indexOffset += DrawHelper3D::NUM_INDICES_AA_LINE;
+		}
+
+		mGridMesh = Mesh::create(meshData);
+	}
+}

+ 2 - 2
BansheeEditor/Source/BsTestTextSprite.cpp

@@ -11,7 +11,7 @@
 #include "BsGUISkin.h"
 #include "BsOverlayManager.h"
 #include "BsSpriteTexture.h"
-#include "BsEditorGUI.h"
+#include "BsBuiltinEditorResources.h"
 #include "BsGUITexture.h"
 #include "BsGUIRenderTexture.h"
 #include "BsGUIArea.h"
@@ -43,7 +43,7 @@ namespace BansheeEngine
 
 	void TestTextSprite::init(const HCamera& camera, const String& text, RenderTexturePtr sceneView)
 	{
-		setSkin(BansheeEngine::EditorGUI::instance().getSkin());
+		setSkin(BansheeEngine::BuiltinEditorResources::instance().getSkin());
 		setDepth(128);
 
 		SceneObject::create("FILLER_A");

+ 1 - 1
BansheeEditorExec/BsEditorExec.cpp

@@ -11,7 +11,7 @@ int CALLBACK WinMain(
 	_In_  int nCmdShow
 	)
 {
-	EditorApplication::startUp(RenderSystemPlugin::DX9);
+	EditorApplication::startUp(RenderSystemPlugin::DX11);
 	EditorApplication::instance().runMainLoop();
 	EditorApplication::shutDown();
 

+ 0 - 8
BansheeEngine/BansheeEngine.vcxproj

@@ -308,10 +308,6 @@
     <ClInclude Include="Include\BsOverlayManager.h" />
     <ClInclude Include="Include\BsRenderable.h" />
     <ClInclude Include="Include\BsRenderableRTTI.h" />
-    <ClInclude Include="Include\BsBuiltinMaterialManager.h" />
-    <ClInclude Include="Include\BsD3D11BuiltinMaterialFactory.h" />
-    <ClInclude Include="Include\BsD3D9BuiltinMaterialFactory.h" />
-    <ClInclude Include="Include\BsGLBuiltinMaterialFactory.h" />
     <ClInclude Include="Include\BsUpdateCallback.h" />
     <ClCompile Include="Source\BsGUIButtonBase.cpp" />
     <ClCompile Include="Source\BsGUIContextMenu.cpp" />
@@ -370,10 +366,6 @@
     <ClCompile Include="Source\BsOverlay.cpp" />
     <ClCompile Include="Source\BsOverlayManager.cpp" />
     <ClCompile Include="Source\BsRenderable.cpp" />
-    <ClCompile Include="Source\BsBuiltinMaterialManager.cpp" />
-    <ClCompile Include="Source\BsD3D11BuiltinMaterialFactory.cpp" />
-    <ClCompile Include="Source\BsD3D9BuiltinMaterialFactory.cpp" />
-    <ClCompile Include="Source\BsGLBuiltinMaterialFactory.cpp" />
     <ClCompile Include="Source\BsUpdateCallback.cpp" />
     <ClCompile Include="Source\BsGUILayoutX.cpp" />
     <ClCompile Include="Source\BsGUIViewport.cpp" />

+ 0 - 24
BansheeEngine/BansheeEngine.vcxproj.filters

@@ -102,18 +102,6 @@
     <ClInclude Include="Include\BsOverlayManager.h">
       <Filter>Header Files\2D</Filter>
     </ClInclude>
-    <ClInclude Include="Include\BsBuiltinMaterialManager.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="Include\BsD3D11BuiltinMaterialFactory.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="Include\BsD3D9BuiltinMaterialFactory.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
-    <ClInclude Include="Include\BsGLBuiltinMaterialFactory.h">
-      <Filter>Header Files</Filter>
-    </ClInclude>
     <ClInclude Include="Include\BsUpdateCallback.h">
       <Filter>Header Files\Components</Filter>
     </ClInclude>
@@ -335,18 +323,6 @@
     <ClCompile Include="Source\BsRenderable.cpp">
       <Filter>Source Files\Components</Filter>
     </ClCompile>
-    <ClCompile Include="Source\BsBuiltinMaterialManager.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="Source\BsD3D11BuiltinMaterialFactory.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="Source\BsD3D9BuiltinMaterialFactory.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
-    <ClCompile Include="Source\BsGLBuiltinMaterialFactory.cpp">
-      <Filter>Source Files</Filter>
-    </ClCompile>
     <ClCompile Include="Source\BsUpdateCallback.cpp">
       <Filter>Source Files\Components</Filter>
     </ClCompile>

+ 1 - 0
BansheeEngine/Include/BsApplication.h

@@ -48,6 +48,7 @@ namespace BansheeEngine
 		 * @note	e.g. player or game view.
 		 */
 		const ViewportPtr& getPrimaryViewport() const;
+
 	protected:
 		/**
 		 * @copydoc	Module::onStartUp

+ 0 - 133
BansheeEngine/Include/BsBuiltinMaterialManager.h

@@ -1,133 +0,0 @@
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsGUIMaterialInfo.h"
-#include "BsDebugDrawMaterialInfo.h"
-#include "BsModule.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @brief	Handles creation of built-in materials for a specific render system.
-	 *			Needs to be specialized for each used render system.
-	 */
-	class BS_EXPORT BuiltinMaterialFactory
-	{
-	public:
-		virtual ~BuiltinMaterialFactory() {}
-
-		/**
-		 * @brief	Triggered when the factory is made active.
-		 */
-		virtual void startUp() {}
-
-		/**
-		 * @brief	Triggered before the factory is made inactive.
-		 */
-		virtual void shutDown() {}
-
-		/**
-		 * @brief	Returns the name of the render system this factory creates materials for.
-		 */
-		virtual const String& getSupportedRenderSystem() const = 0;
-
-		/**
-		 * @brief	Creates material used for textual sprite rendering (e.g. text in GUI).
-		 */
-		virtual HMaterial createSpriteTextMaterial() const = 0;
-
-		/**
-		 * @brief	Creates material used for image sprite rendering (e.g. images in GUI).
-		 */
-		virtual HMaterial createSpriteImageMaterial() const = 0;
-
-		/**
-		 * @brief	Creates a material used for debug drawing in clip space (e.g. 2D shapes that resize with the viewport).
-		 */
-		virtual HMaterial createDebugDraw2DClipSpaceMaterial() const = 0;
-
-		/**
-		 * @brief	Creates a material used for debug drawing in screen space (e.g. 2D shapes of fixed pixel size).
-		 */
-		virtual HMaterial createDebugDraw2DScreenSpaceMaterial() const = 0;
-
-		/**
-		 * @brief	Creates a material used for debug drawing in 3D.
-		 */
-		virtual HMaterial createDebugDraw3DMaterial() const = 0;
-
-		/**
-		 * @brief	Creates a material used for docking drop overlay used by the editor.
-		 *
-		 * TODO: Move this to Editor as it's editor-specific.
-		 */
-		virtual HMaterial createDockDropOverlayMaterial() const = 0;
-
-		/**
-		 * @brief	Creates a material used as a replacement when no other material is usable.
-		 */
-		virtual HMaterial createDummyMaterial() const = 0;
-	};
-
-	/**
-	 * @brief	Provides access to various materials that are required for core engine systems. 
-	 * 			Each render system implementation needs to provide its own implementation of
-	 *			BuiltinMaterialFactory and register it with this module.
-	 */
-	class BS_EXPORT BuiltinMaterialManager : public Module<BuiltinMaterialManager>
-	{
-	public:
-		BuiltinMaterialManager();
-		~BuiltinMaterialManager();
-
-		/**
-		 * @copydoc	BuiltinMaterialFactory::createSpriteTextMaterial
-		 */
-		GUIMaterialInfo createSpriteTextMaterial() const;
-
-		/**
-		 * @copydoc	BuiltinMaterialFactory::createSpriteImageMaterial
-		 */
-		GUIMaterialInfo createSpriteImageMaterial() const;
-
-		/**
-		 * @copydoc	BuiltinMaterialFactory::createDebugDraw2DClipSpaceMaterial
-		 */
-		DebugDraw2DClipSpaceMatInfo createDebugDraw2DClipSpaceMaterial() const;
-
-		/**
-		 * @copydoc	BuiltinMaterialFactory::createDebugDraw2DScreenSpaceMaterial
-		 */
-		DebugDraw2DScreenSpaceMatInfo createDebugDraw2DScreenSpaceMaterial() const;
-
-		/**
-		 * @copydoc	BuiltinMaterialFactory::createDebugDraw3DMaterial
-		 */
-		DebugDraw3DMatInfo createDebugDraw3DMaterial() const;
-
-		/**
-		 * @copydoc	BuiltinMaterialFactory::createDockDropOverlayMaterial
-		 */
-		HMaterial createDockDropOverlayMaterial() const; // TODO - This belongs in editor
-
-		/**
-		 * @copydoc	BuiltinMaterialFactory::createDummyMaterial
-		 */
-		HMaterial createDummyMaterial() const;
-
-		/**
-		 * @brief	Registers a new material creation factory.
-		 */
-		void addFactory(BuiltinMaterialFactory* factory);
-
-		/**
-		 * @brief	Attempts to find a factory responsible for creating materials for the provided
-		 *			render system and makes it active.
-		 */
-		void setActive(const String& renderSystemName);
-
-	private:
-		UnorderedMap<String, BuiltinMaterialFactory*> mAvailableFactories;
-		BuiltinMaterialFactory* mActiveFactory;
-	};
-}

+ 128 - 4
BansheeEngine/Include/BsBuiltinResources.h

@@ -5,18 +5,19 @@
 #include "BsModule.h"
 #include "BsPath.h"
 #include "BsVector2I.h"
+#include "BsGUIMaterialInfo.h"
+#include "BsDebugDrawMaterialInfo.h"
+#include "BsApplication.h"
 
 namespace BansheeEngine
 {
-	// TODO - Currently this class will always import resources, but it would be better if it first
-	// checks for a pre-processed asset and only import it if that doesn't exist
 	/**
 	 * @brief	Holds references to built-in resources used by the core engine.
 	 */
 	class BS_EXPORT BuiltinResources : public BansheeEngine::Module<BuiltinResources>
 	{
 	public:
-		BuiltinResources();
+		BuiltinResources(RenderSystemPlugin activeRSPlugin);
 		~BuiltinResources();
 
 		/**
@@ -79,7 +80,45 @@ namespace BansheeEngine
 		 */
 		const PixelData& getCursorMoveLeftRight(Vector2I& hotSpot);
 
+		/**
+		 * @brief	Creates material used for textual sprite rendering (e.g. text in GUI).
+		 */
+		GUIMaterialInfo createSpriteTextMaterial() const;
+
+		/**
+		 * @brief	Creates material used for image sprite rendering (e.g. images in GUI).
+		 */
+		GUIMaterialInfo createSpriteImageMaterial() const;
+
+		/**
+		 * @brief	Creates a material used for debug drawing in clip space (e.g. 2D shapes that resize with the viewport).
+		 */
+		DebugDraw2DClipSpaceMatInfo createDebugDraw2DClipSpaceMaterial() const;
+
+		/**
+		 * @brief	Creates a material used for debug drawing in screen space (e.g. 2D shapes of fixed pixel size).
+		 */
+		DebugDraw2DScreenSpaceMatInfo createDebugDraw2DScreenSpaceMaterial() const;
+
+		/**
+		 * @brief	Creates a material used for debug drawing in 3D.
+		 */
+		DebugDraw3DMatInfo createDebugDraw3DMaterial() const;
+
+		/**
+		 * @brief	Creates a material used as a replacement when no other material is usable.
+		 */
+		HMaterial createDummyMaterial() const;
+
 	private:
+		/**
+		 * @brief	Imports all necessary resources and converts them to engine-ready format.
+		 *
+		 * @note	Normally you only want to use this during development phase and then ship
+		 *			with engine-ready format only.
+		 */
+		void preprocess();
+
 		/**
 		 * @brief	Loads a GUI skin texture with the specified filename.
 		 */
@@ -90,6 +129,57 @@ namespace BansheeEngine
 		 */
 		static HTexture getCursorTexture(const WString& name);
 
+		/**
+		 * @brief	Loads a GPU program with the specified filename.
+		 */
+		HGpuProgram getGpuProgram(const WString& name);
+
+		/**
+		 * @brief	Imports a GUI skin texture with the specified filename.
+		 *			Saves the imported texture in engine-ready format in the corresponding
+		 *			output folder.
+		 */
+		static void importSkinTexture(const WString& name);
+
+		/**
+		 * @brief	Imports a cursor texture with the specified filename.
+		 *			Saves the imported texture in engine-ready format in the corresponding
+		 *			output folder.
+		 */
+		static void importCursorTexture(const WString& name);
+
+		/**
+		 * @brief	Loads an compiles a shader for text rendering.
+		 */
+		void initSpriteTextShader();
+
+		/**
+		 * @brief	Loads an compiles a shader for image sprite rendering.
+		 */
+		void initSpriteImageShader();
+
+		/**
+		 * @brief	Loads an compiles a shader for debug 2D clip space rendering.
+		 */
+		void initDebugDraw2DClipSpaceShader();
+
+		/**
+		 * @brief	Loads an compiles a shader for debug 2D screen space rendering.
+		 */
+		void initDebugDraw2DScreenSpaceShader();
+
+		/**
+		 * @brief	Loads an compiles a shader for debug 3D rendering.
+		 */
+		void initDebugDraw3DShader();
+
+		/**
+		 * @brief	Loads an compiles a simple shader to be used with no other is usable.
+		 */
+		void initDummyShader();
+
+		RenderSystemPlugin mRenderSystemPlugin;
+
 		GUISkin mSkin;
 
 		PixelDataPtr mCursorArrow;
@@ -105,10 +195,29 @@ namespace BansheeEngine
 
 		HSpriteTexture mWhiteSpriteTexture;
 
+		ShaderPtr mShaderSpriteText;
+		ShaderPtr mShaderSpriteImage;
+		ShaderPtr mShaderDebugDraw2DClipSpace;
+		ShaderPtr mShaderDebugDraw2DScreenSpace;
+		ShaderPtr mShaderDebugDraw3D;
+		ShaderPtr mShaderDummy;
+
+		WString mActiveShaderSubFolder;
+		String mActiveRenderSystem;
+
+		static const Path DefaultSkinFolderRaw;
+		static const Path DefaultCursorFolderRaw;
+		static const Path DefaultShaderFolderRaw;
+
 		static const Path DefaultSkinFolder;
 		static const Path DefaultCursorFolder;
+		static const Path DefaultShaderFolder;
+
+		static const WString HLSL11ShaderSubFolder;
+		static const WString HLSL9ShaderSubFolder;
+		static const WString GLSLShaderSubFolder;
 
-		static const WString DefaultFontPath;
+		static const WString DefaultFontFilename;
 		static const UINT32 DefaultFontSize;
 
 		static const WString WhiteTex;
@@ -196,5 +305,20 @@ namespace BansheeEngine
 		static const Vector2I CursorSizeNSHotspot;
 		static const Vector2I CursorSizeNWSEHotspot;
 		static const Vector2I CursorSizeWEHotspot;
+
+		static const WString ShaderSpriteTextVSFile;
+		static const WString ShaderSpriteTextPSFile;
+		static const WString ShaderSpriteImageVSFile;
+		static const WString ShaderSpriteImagePSFile;
+		static const WString ShaderDebugDraw2DClipSpaceVSFile;
+		static const WString ShaderDebugDraw2DClipSpacePSFile;
+		static const WString ShaderDebugDraw2DScreenSpaceVSFile;
+		static const WString ShaderDebugDraw2DScreenSpacePSFile;
+		static const WString ShaderDebugDraw3DVSFile;
+		static const WString ShaderDebugDraw3DPSFile;
+		static const WString ShaderDockOverlayVSFile;
+		static const WString ShaderDockOverlayPSFile;
+		static const WString ShaderDummyVSFile;
+		static const WString ShaderDummyPSFile;
 	};
 }

+ 0 - 90
BansheeEngine/Include/BsD3D11BuiltinMaterialFactory.h

@@ -1,90 +0,0 @@
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsBuiltinMaterialManager.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @copydoc BuiltinMaterialFactory
-	 */
-	class D3D11BuiltinMaterialFactory : public BuiltinMaterialFactory
-	{
-	public:
-		/** @copydoc BuiltinMaterialFactory::startUp */
-		void startUp();
-
-		/** @copydoc BuiltinMaterialFactory::startUp */
-		void shutDown();
-
-		/** @copydoc BuiltinMaterialFactory::getSupportedRenderSystem */
-		const String& getSupportedRenderSystem() const;
-
-		/** @copydoc BuiltinMaterialFactory::createSpriteTextMaterial */
-		HMaterial createSpriteTextMaterial() const;
-
-		/** @copydoc BuiltinMaterialFactory::createSpriteImageMaterial */
-		HMaterial createSpriteImageMaterial() const;
-
-		/** @copydoc BuiltinMaterialFactory::createDebugDraw2DClipSpaceMaterial */
-		HMaterial createDebugDraw2DClipSpaceMaterial() const;
-
-		/** @copydoc BuiltinMaterialFactory::createDebugDraw2DScreenSpaceMaterial */
-		HMaterial createDebugDraw2DScreenSpaceMaterial() const;
-
-		/** @copydoc BuiltinMaterialFactory::createDebugDraw3DMaterial */
-		HMaterial createDebugDraw3DMaterial() const;
-
-		/** @copydoc BuiltinMaterialFactory::createDockDropOverlayMaterial */
-		HMaterial createDockDropOverlayMaterial() const;
-
-		/** @copydoc BuiltinMaterialFactory::createDummyMaterial */
-		HMaterial createDummyMaterial() const;
-
-	protected:
-		/**
-		 * @brief	Loads an compiles a shader for text rendering.
-		 */
-		void initSpriteTextShader();
-
-		/**
-		 * @brief	Loads an compiles a shader for image sprite rendering.
-		 */
-		void initSpriteImageShader();
-
-		/**
-		 * @brief	Loads an compiles a shader for debug 2D clip space rendering.
-		 */
-		void initDebugDraw2DClipSpaceShader();
-
-		/**
-		 * @brief	Loads an compiles a shader for debug 2D screen space rendering.
-		 */
-		void initDebugDraw2DScreenSpaceShader();
-
-		/**
-		 * @brief	Loads an compiles a shader for debug 3D rendering.
-		 */
-		void initDebugDraw3DShader();
-
-		/**
-		 * @brief	Loads an compiles a shader for dock overlay rendering.
-		 */
-		void initDockDropOverlayShader();
-
-		/**
-		 * @brief	Loads an compiles a simple shader to be used with no other is usable.
-		 */
-		void initDummyShader();
-
-		ShaderPtr mSpriteTextShader;
-		ShaderPtr mSpriteImageShader;
-		ShaderPtr mDebugDraw2DClipSpaceShader;
-		ShaderPtr mDebugDraw2DScreenSpaceShader;
-		ShaderPtr mDebugDraw3DShader;
-		ShaderPtr mDockDropOverlayShader;
-		ShaderPtr mDummyShader;
-
-		HSamplerState mGUISamplerState;
-	};
-}

+ 0 - 90
BansheeEngine/Include/BsD3D9BuiltinMaterialFactory.h

@@ -1,90 +0,0 @@
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsBuiltinMaterialManager.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @copydoc BuiltinMaterialFactory
-	 */
-	class D3D9BuiltinMaterialFactory : public BuiltinMaterialFactory
-	{
-	public:
-		/** @copydoc BuiltinMaterialFactory::startUp */
-		void startUp();
-
-		/** @copydoc BuiltinMaterialFactory::startUp */
-		void shutDown();
-
-		/** @copydoc BuiltinMaterialFactory::getSupportedRenderSystem */
-		const String& getSupportedRenderSystem() const;
-
-		/** @copydoc BuiltinMaterialFactory::createSpriteTextMaterial */
-		HMaterial createSpriteTextMaterial() const;
-
-		/** @copydoc BuiltinMaterialFactory::createSpriteImageMaterial */
-		HMaterial createSpriteImageMaterial() const;
-
-		/** @copydoc BuiltinMaterialFactory::createDebugDraw2DClipSpaceMaterial */
-		HMaterial createDebugDraw2DClipSpaceMaterial() const;
-
-		/** @copydoc BuiltinMaterialFactory::createDebugDraw2DScreenSpaceMaterial */
-		HMaterial createDebugDraw2DScreenSpaceMaterial() const;
-
-		/** @copydoc BuiltinMaterialFactory::createDebugDraw3DMaterial */
-		HMaterial createDebugDraw3DMaterial() const;
-
-		/** @copydoc BuiltinMaterialFactory::createDockDropOverlayMaterial */
-		HMaterial createDockDropOverlayMaterial() const;
-
-		/** @copydoc BuiltinMaterialFactory::createDummyMaterial */
-		HMaterial createDummyMaterial() const;
-
-	protected:
-		/**
-		 * @brief	Loads an compiles a shader for text rendering.
-		 */
-		void initSpriteTextShader();
-
-		/**
-		 * @brief	Loads an compiles a shader for image sprite rendering.
-		 */
-		void initSpriteImageShader();
-
-		/**
-		 * @brief	Loads an compiles a shader for debug 2D clip space rendering.
-		 */
-		void initDebugDraw2DClipSpaceShader();
-
-		/**
-		 * @brief	Loads an compiles a shader for debug 2D screen space rendering.
-		 */
-		void initDebugDraw2DScreenSpaceShader();
-
-		/**
-		 * @brief	Loads an compiles a shader for debug 3D rendering.
-		 */
-		void initDebugDraw3DShader();
-
-		/**
-		 * @brief	Loads an compiles a shader for dock overlay rendering.
-		 */
-		void initDockDropOverlayShader();
-
-		/**
-		 * @brief	Loads an compiles a simple shader to be used with no other is usable.
-		 */
-		void initDummyShader();
-
-		ShaderPtr mSpriteTextShader;
-		ShaderPtr mSpriteImageShader;
-		ShaderPtr mDebugDraw2DClipSpaceShader;
-		ShaderPtr mDebugDraw2DScreenSpaceShader;
-		ShaderPtr mDebugDraw3DShader;
-		ShaderPtr mDockDropOverlayShader;
-		ShaderPtr mDummyShader;
-
-		HSamplerState mGUISamplerState;
-	};
-}

+ 4 - 4
BansheeEngine/Include/BsDrawHelper2D.h

@@ -125,15 +125,15 @@ namespace BansheeEngine
 
 	protected:
 		/**
-		 * @copydoc	DrawHelperTemplate::line_AA(const Vector2&, const Vector2&, float, float, const Color&, UINT8*, UINT8*, UINT32, UINT32, UINT32*, UINT32)
+		 * @copydoc	DrawHelperTemplate::line_AA(const Vector2&, const Vector2&, const Vector2&, float, float, const Color&, UINT8*, UINT8*, UINT32, UINT32, UINT32*, UINT32)
 		 */
-		void line_AA(const Vector2& a, const Vector2& b, float width, float borderWidth, const Color& color, UINT8* outVertices, UINT8* outColors, 
+		void line_AA(const Vector2& a, const Vector2& b, const Vector2& up, float width, float borderWidth, const Color& color, UINT8* outVertices, UINT8* outColors, 
 			UINT32 vertexOffset, UINT32 vertexStride, UINT32* outIndices, UINT32 indexOffset);
 
 		/**
-		 * @copydoc	DrawHelperTemplate::polygon_AA(const Vector<Vector2>&, float, const Color&, UINT8*, UINT8*, UINT32, UINT32, UINT32*, UINT32)
+		 * @copydoc	DrawHelperTemplate::polygon_AA(const Vector<Vector2>&, const Vector2&, float, const Color&, UINT8*, UINT8*, UINT32, UINT32, UINT32*, UINT32)
 		 */
-		void polygon_AA(const Vector<Vector2>& points, float borderWidth, const Color& color, UINT8* outVertices, UINT8* outColors, 
+		void polygon_AA(const Vector<Vector2>& points, const Vector2& up, float borderWidth, const Color& color, UINT8* outVertices, UINT8* outColors,
 			UINT32 vertexOffset, UINT32 vertexStride, UINT32* outIndices, UINT32 indexOffset);
 
 	private:

+ 12 - 8
BansheeEngine/Include/BsDrawHelper3D.h

@@ -40,7 +40,8 @@ namespace BansheeEngine
 		/**
 		 * @copydoc	DrawHelperTemplate::line_AA
 		 */
-		void line_AA(const Vector3& a, const Vector3& b, float width, float borderWidth, const Color& color, const MeshDataPtr& meshData, UINT32 vertexOffset, UINT32 indexOffset);
+		void line_AA(const Vector3& a, const Vector3& b, const Vector3& up, float width, float borderWidth, const Color& color, 
+			const MeshDataPtr& meshData, UINT32 vertexOffset, UINT32 indexOffset);
 
 		/**
 		 * @copydoc	DrawHelperTemplate::lineList_Pixel
@@ -50,7 +51,8 @@ namespace BansheeEngine
 		/**
 		 * @copydoc	DrawHelperTemplate::lineList_AA
 		 */
-		void lineList_AA(const Vector<Vector3>& linePoints, float width, float borderWidth, const Color& color, const MeshDataPtr& meshData, UINT32 vertexOffset, UINT32 indexOffset);
+		void lineList_AA(const Vector<Vector3>& linePoints, const Vector3& up, float width, float borderWidth, 
+			const Color& color, const MeshDataPtr& meshData, UINT32 vertexOffset, UINT32 indexOffset);
 
 		/**
 		 * @brief	Constructs a one-pixel wide line and draws it in the specified camera. 
@@ -69,12 +71,13 @@ namespace BansheeEngine
 		 * @param	camera		Camera to draw the line in.
 		 * @param	x			Starting position of the line. Coordinates must be normalized in [0, 1] range. Coordinate origin is top left of the camera viewport.
 		 * @param	y			End position of the line. Coordinates must be normalized in [0, 1] range. Coordinate origin is top left of the camera viewport.
+		 * @param	up			Up direction to which the line will run perpendicular to.
 		 * @param	width		Width of the line in pixels.
 		 * @param	borderWidth	Width of the antialiased border in pixels.
 		 * @param	color		Color of the line.
 		 * @param	timeout		Optional timeout on how long to display the line in seconds. If 0 the line will be displayed one frame.
 		 */
-		void drawLine_AA(const HCamera& camera, const Vector3& a, const Vector3& b, float width, float borderWidth, 
+		void drawLine_AA(const HCamera& camera, const Vector3& a, const Vector3& b, const Vector3& up, float width, float borderWidth, 
 			const Color& color = Color::White, float timeout = 0.0f);
 
 		/**
@@ -94,12 +97,13 @@ namespace BansheeEngine
 		 * @param	camera		Camera to draw the line list in.
 		 * @param	linePoints	List of line start and end points. This list must be a multiple of 2, where each start point is followed by and end point.
 		 *						Coordinates must be normalized in ([0, 1], [0, 1]) range. Coordinate origin is top left of the camera viewport.
+		 * @param	up			Up direction to which the line will run perpendicular to.
 		 * @param	width		Width of the line in pixels.
 		 * @param	borderWidth	Width of the antialiased border in pixels.
 		 * @param	color		Color of the line list.
 		 * @param	timeout		Optional timeout on how long to display the line list in seconds. If 0 the line list will be displayed one frame.
 		 */
-		void drawLineList_AA(const HCamera& camera, const Vector<Vector3>& linePoints, float width, float borderWidth, 
+		void drawLineList_AA(const HCamera& camera, const Vector<Vector3>& linePoints, const Vector3& up, float width, float borderWidth, 
 			const Color& color = Color::White, float timeout = 0.0f);
 
 		/**
@@ -114,15 +118,15 @@ namespace BansheeEngine
 
 	protected:
 		/**
-		 * @copydoc	DrawHelperTemplate::line_AA(const Vector2&, const Vector2&, float, float, const Color&, UINT8*, UINT8*, UINT32, UINT32, UINT32*, UINT32)
+		 * @copydoc	DrawHelperTemplate::line_AA(const Vector3&, const Vector3&, const Vector3&, float, float, const Color&, UINT8*, UINT8*, UINT32, UINT32, UINT32*, UINT32)
 		 */
-		void line_AA(const Vector3& a, const Vector3& b, float width, float borderWidth, const Color& color, UINT8* outVertices, UINT8* outColors, 
+		void line_AA(const Vector3& a, const Vector3& b, const Vector3& up, float width, float borderWidth, const Color& color, UINT8* outVertices, UINT8* outColors, 
 			UINT32 vertexOffset, UINT32 vertexStride, UINT32* outIndices, UINT32 indexOffset);
 
 		/**
-		 * @copydoc	DrawHelperTemplate::polygon_AA(const Vector<Vector2>&, float, const Color&, UINT8*, UINT8*, UINT32, UINT32, UINT32*, UINT32)
+		 * @copydoc	DrawHelperTemplate::polygon_AA(const Vector<Vector3>&, const Vector3&, float, const Color&, UINT8*, UINT8*, UINT32, UINT32, UINT32*, UINT32)
 		 */
-		void polygon_AA(const Vector<Vector3>& points, float borderWidth, const Color& color, UINT8* outVertices, UINT8* outColors, 
+		void polygon_AA(const Vector<Vector3>& points, const Vector3& up, float borderWidth, const Color& color, UINT8* outVertices, UINT8* outColors, 
 			UINT32 vertexOffset, UINT32 vertexStride, UINT32* outIndices, UINT32 indexOffset);
 
 		/**

+ 17 - 10
BansheeEngine/Include/BsDrawHelperTemplate.h

@@ -50,6 +50,9 @@ namespace BansheeEngine
 	class BS_EXPORT DrawHelperTemplateBase
 	{
 	public:
+		static const UINT32 NUM_VERTICES_AA_LINE;
+		static const UINT32 NUM_INDICES_AA_LINE;
+
 		/**
 		 * @brief	Called by the renderer when it is ready to render objects into the provided camera.
 		 */
@@ -100,6 +103,7 @@ namespace BansheeEngine
 		 *
 		 * @param	a				Start point of the line.
 		 * @param	b				End point of the line.
+		 * @param	up				Up direction to which the line will run perpendicular to.
 		 * @param	width			Width of the line.
 		 * @param	borderWidth		Width of the anti-aliased border.
 		 * @param	color			Color of the line.
@@ -113,16 +117,16 @@ namespace BansheeEngine
 		 * 			  32bit index buffer
 		 *			  Enough space for 8 vertices and 30 indices
 		 */
-		void line_AA(const T& a, const T& b, float width, float borderWidth, const Color& color, const MeshDataPtr& meshData, UINT32 vertexOffset, UINT32 indexOffset)
+		void line_AA(const T& a, const T& b, const T& up, float width, float borderWidth, const Color& color, const MeshDataPtr& meshData, UINT32 vertexOffset, UINT32 indexOffset)
 		{
 			UINT32* indexData = meshData->getIndices32();
 			UINT8* positionData = meshData->getElementData(VES_POSITION);
 			UINT8* colorData = meshData->getElementData(VES_COLOR);
 
-			assert((vertexOffset + 8) <= meshData->getNumVertices());
-			assert((indexOffset + 30) <= meshData->getNumIndices());
+			assert((vertexOffset + NUM_VERTICES_AA_LINE) <= meshData->getNumVertices());
+			assert((indexOffset + NUM_INDICES_AA_LINE) <= meshData->getNumIndices());
 
-			line_AA(a, b, width, borderWidth, color, positionData, colorData, vertexOffset, meshData->getVertexDesc()->getVertexStride(), indexData, indexOffset);
+			line_AA(a, b, up, width, borderWidth, color, positionData, colorData, vertexOffset, meshData->getVertexDesc()->getVertexStride(), indexData, indexOffset);
 		}
 
 		/**
@@ -168,6 +172,7 @@ namespace BansheeEngine
 		 * @brief	Fills the mesh data with vertices representing anti-aliased lines of specific width. Antialiasing is done using alpha blending.
 		 *
 		 * @param	linePoints		A list of start and end points for the lines. Must be a multiple of 2.
+		 * @param	up				Up direction to which the line will run perpendicular to.
 		 * @param	width			Width of the line.
 		 * @param	borderWidth		Width of the anti-aliased border.
 		 * @param	color			Color of the line.
@@ -181,7 +186,7 @@ namespace BansheeEngine
 		 * 			  32bit index buffer
 		 *			  Enough space for (numLines * 8) vertices and (numLines * 30) indices
 		 */
-		void lineList_AA(const typename Vector<T>& linePoints, float width, float borderWidth, const Color& color, const MeshDataPtr& meshData, UINT32 vertexOffset, UINT32 indexOffset)
+		void lineList_AA(const typename Vector<T>& linePoints, const T& up, float width, float borderWidth, const Color& color, const MeshDataPtr& meshData, UINT32 vertexOffset, UINT32 indexOffset)
 		{
 			assert(linePoints.size() % 2 == 0);
 
@@ -198,10 +203,10 @@ namespace BansheeEngine
 			UINT32 numPoints = (UINT32)linePoints.size();
 			for(UINT32 i = 0; i < numPoints; i += 2)
 			{
-				line_AA(linePoints[i], linePoints[i + 1], width, borderWidth, color, positionData, colorData, curVertOffset, meshData->getVertexDesc()->getVertexStride(), indexData, curIdxOffset);
+				line_AA(linePoints[i], linePoints[i + 1], up, width, borderWidth, color, positionData, colorData, curVertOffset, meshData->getVertexDesc()->getVertexStride(), indexData, curIdxOffset);
 
-				curVertOffset += 8;
-				curIdxOffset += 30;
+				curVertOffset += NUM_VERTICES_AA_LINE;
+				curIdxOffset += NUM_INDICES_AA_LINE;
 			}
 		}
 
@@ -246,6 +251,7 @@ namespace BansheeEngine
 		 *
 		 * @param	a				Start point of the line.
 		 * @param	b				End point of the line.
+		 * @param	up				Up direction to which the line will run perpendicular to.
 		 * @param	width			Width of the line.
 		 * @param	borderWidth		Width of the anti-aliased border.
 		 * @param	color			Color of the line.
@@ -256,13 +262,14 @@ namespace BansheeEngine
 		 * @param	outIndices		Output buffer that will store the index data. Indices are 32bit.
 		 * @param	indexOffset 	Offset in number of indices from the start of the buffer to start writing at.
 		 */
-		virtual void line_AA(const T& a, const T& b, float width, float borderWidth, const Color& color, UINT8* outVertices, UINT8* outColors, 
+		virtual void line_AA(const T& a, const T& b, const T& up, float width, float borderWidth, const Color& color, UINT8* outVertices, UINT8* outColors, 
 			UINT32 vertexOffset, UINT32 vertexStride, UINT32* outIndices, UINT32 indexOffset) = 0;
 
 		/**
 		 * @brief	Fills the provided buffers with vertices representing an antialiased polygon.
 		 *
 		 * @param	points			Points defining the polygon. First point is assumed to be the start and end point.
+		 * @param	up				Up direction to which the polygon will run perpendicular to.
 		 * @param	borderWidth		Width of the anti-aliased border.
 		 * @param	color			Color of the polygon.
 		 * @param	outVertices		Output buffer that will store the vertex position data.
@@ -272,7 +279,7 @@ namespace BansheeEngine
 		 * @param	outIndices		Output buffer that will store the index data. Indices are 32bit.
 		 * @param	indexOffset 	Offset in number of indices from the start of the buffer to start writing at.
 		 */
-		virtual void polygon_AA(const typename Vector<T>& points, float borderWidth, const Color& color, UINT8* outVertices, UINT8* outColors, 
+		virtual void polygon_AA(const typename Vector<T>& points, const T& up, float borderWidth, const Color& color, UINT8* outVertices, UINT8* outColors,
 			UINT32 vertexOffset, UINT32 vertexStride, UINT32* outIndices, UINT32 indexOffset) = 0;
 
 		/**

+ 0 - 90
BansheeEngine/Include/BsGLBuiltinMaterialFactory.h

@@ -1,90 +0,0 @@
-#pragma once
-
-#include "BsPrerequisites.h"
-#include "BsBuiltinMaterialManager.h"
-
-namespace BansheeEngine
-{
-	/**
-	 * @copydoc BuiltinMaterialFactory
-	 */
-	class GLBuiltinMaterialFactory : public BuiltinMaterialFactory
-	{
-	public:
-		/** @copydoc BuiltinMaterialFactory::startUp */
-		void startUp();
-
-		/** @copydoc BuiltinMaterialFactory::startUp */
-		void shutDown();
-
-		/** @copydoc BuiltinMaterialFactory::getSupportedRenderSystem */
-		const String& getSupportedRenderSystem() const;
-
-		/** @copydoc BuiltinMaterialFactory::createSpriteTextMaterial */
-		HMaterial createSpriteTextMaterial() const;
-
-		/** @copydoc BuiltinMaterialFactory::createSpriteImageMaterial */
-		HMaterial createSpriteImageMaterial() const;
-
-		/** @copydoc BuiltinMaterialFactory::createDebugDraw2DClipSpaceMaterial */
-		HMaterial createDebugDraw2DClipSpaceMaterial() const;
-
-		/** @copydoc BuiltinMaterialFactory::createDebugDraw2DScreenSpaceMaterial */
-		HMaterial createDebugDraw2DScreenSpaceMaterial() const;
-
-		/** @copydoc BuiltinMaterialFactory::createDebugDraw3DMaterial */
-		HMaterial createDebugDraw3DMaterial() const;
-
-		/** @copydoc BuiltinMaterialFactory::createDockDropOverlayMaterial */
-		HMaterial createDockDropOverlayMaterial() const;
-
-		/** @copydoc BuiltinMaterialFactory::createDummyMaterial */
-		HMaterial createDummyMaterial() const;
-
-	protected:
-		/**
-		 * @brief	Loads an compiles a shader for text rendering.
-		 */
-		void initSpriteTextShader();
-
-		/**
-		 * @brief	Loads an compiles a shader for image sprite rendering.
-		 */
-		void initSpriteImageShader();
-
-		/**
-		 * @brief	Loads an compiles a shader for debug 2D clip space rendering.
-		 */
-		void initDebugDraw2DClipSpaceShader();
-
-		/**
-		 * @brief	Loads an compiles a shader for debug 2D screen space rendering.
-		 */
-		void initDebugDraw2DScreenSpaceShader();
-
-		/**
-		 * @brief	Loads an compiles a shader for debug 3D rendering.
-		 */
-		void initDebugDraw3DShader();
-
-		/**
-		 * @brief	Loads an compiles a shader for dock overlay rendering.
-		 */
-		void initDockDropOverlayShader();
-
-		/**
-		 * @brief	Loads an compiles a simple shader to be used with no other is usable.
-		 */
-		void initDummyShader();
-
-		ShaderPtr mSpriteTextShader;
-		ShaderPtr mSpriteImageShader;
-		ShaderPtr mDebugDraw2DClipSpaceShader;
-		ShaderPtr mDebugDraw2DScreenSpaceShader;
-		ShaderPtr mDebugDraw3DShader;
-		ShaderPtr mDockDropOverlayShader;
-		ShaderPtr mDummyShader;
-
-		HSamplerState mGUISamplerState;
-	};
-}

+ 1 - 0
BansheeEngine/Include/BsGUIMaterialInfo.h

@@ -14,6 +14,7 @@ namespace BansheeEngine
 		GpuParamMat4 worldTransform;
 		GpuParamFloat invViewportWidth;
 		GpuParamFloat invViewportHeight;
+		GpuParamSampState mainTexSampler;
 		GpuParamTexture mainTexture;
 		GpuParamVec4 tint;
 	};

+ 4 - 0
BansheeEngine/Include/BsGUIMaterialManager.h

@@ -13,6 +13,8 @@ namespace BansheeEngine
 	class BS_EXPORT GUIMaterialManager : public Module<GUIMaterialManager>
 	{
 	public:
+		GUIMaterialManager();
+
 		/**
 		 * @brief	Creates a new material, or returns a reference to an existing one based on
 		 * 			the provided primary texture.
@@ -69,6 +71,8 @@ namespace BansheeEngine
 			UINT32 refCount;
 		};
 
+		HSamplerState mGUISamplerState;
+
 		mutable Vector<GUIMaterial> mTextMaterials;
 		mutable Vector<GUIMaterial> mImageMaterials;
 	};

+ 1 - 0
BansheeEngine/Include/BsPrerequisites.h

@@ -27,6 +27,7 @@ namespace BansheeEngine
 	static const String RenderSystemDX11 = "D3D11RenderSystem";
 	static const String RenderSystemOpenGL = "GLRenderSystem";
 	static const String RendererDefault = "BansheeRenderer";
+	static const String RendererInvariant = "CoreRenderer";
 
 	class VirtualButton;
 	class VirtualInput;

+ 2 - 14
BansheeEngine/Source/BsApplication.cpp

@@ -4,10 +4,6 @@
 #include "BsOverlayManager.h"
 #include "BsDrawHelper2D.h"
 #include "BsDrawHelper3D.h"
-#include "BsBuiltinMaterialManager.h"
-#include "BsD3D9BuiltinMaterialFactory.h"
-#include "BsD3D11BuiltinMaterialFactory.h"
-#include "BsGLBuiltinMaterialFactory.h"
 #include "BsBuiltinResources.h"
 #include "BsScriptManager.h"
 #include "BsProfilingManager.h"
@@ -38,20 +34,14 @@ namespace BansheeEngine
 	{
 		VirtualInput::startUp();
 		ScriptManager::startUp();
+		BuiltinResources::startUp(renderSystem);
 		GUIManager::startUp();
 		GUIMaterialManager::startUp();
 		OverlayManager::startUp();
 
-		BuiltinMaterialManager::startUp();
-		BuiltinMaterialManager::instance().addFactory(bs_new<D3D9BuiltinMaterialFactory>());
-		BuiltinMaterialManager::instance().addFactory(bs_new<D3D11BuiltinMaterialFactory>());
-		BuiltinMaterialManager::instance().addFactory(bs_new<GLBuiltinMaterialFactory>());
-		BuiltinMaterialManager::instance().setActive(getLibNameForRenderSystem(renderSystem));
-
 		DrawHelper2D::startUp();
 		DrawHelper3D::startUp();
 
-		BuiltinResources::startUp();
 		Cursor::startUp();
 
 #if BS_VER == BS_VER_DEV
@@ -68,18 +58,16 @@ namespace BansheeEngine
 #endif
 
 		Cursor::shutDown();
-		BuiltinResources::shutDown();
 
 		DrawHelper3D::shutDown();
 		DrawHelper2D::shutDown();
 
 		GUIMaterialManager::instance().forceReleaseAllMaterials();
 
-		BuiltinMaterialManager::shutDown();
-
 		OverlayManager::shutDown();
 		GUIManager::shutDown();
 		GUIMaterialManager::shutDown();
+		BuiltinResources::shutDown();
 		ScriptManager::shutDown();
 		VirtualInput::shutDown();
 	}

+ 0 - 117
BansheeEngine/Source/BsBuiltinMaterialManager.cpp

@@ -1,117 +0,0 @@
-#include "BsBuiltinMaterialManager.h"
-#include "BsMaterial.h"
-
-namespace BansheeEngine
-{
-	BuiltinMaterialManager::BuiltinMaterialManager()
-		:mActiveFactory(nullptr)
-	{
-
-	}
-
-	BuiltinMaterialManager::~BuiltinMaterialManager()
-	{
-		for(auto& iter : mAvailableFactories)
-		{
-			iter.second->shutDown();
-			bs_delete(iter.second);
-		}
-	}
-
-	GUIMaterialInfo BuiltinMaterialManager::createSpriteTextMaterial() const
-	{
-		assert(mActiveFactory != nullptr);
-
-		GUIMaterialInfo info;
-		info.material = mActiveFactory->createSpriteTextMaterial();
-		info.invViewportWidth = info.material->getParamFloat("invViewportWidth");
-		info.invViewportHeight = info.material->getParamFloat("invViewportHeight");
-		info.worldTransform = info.material->getParamMat4("worldTransform");
-		info.mainTexture = info.material->getParamTexture("mainTexture");
-		info.tint = info.material->getParamVec4("tint");
-
-		return info;
-	}
-
-	GUIMaterialInfo BuiltinMaterialManager::createSpriteImageMaterial() const
-	{
-		assert(mActiveFactory != nullptr);
-
-		GUIMaterialInfo info;
-		info.material = mActiveFactory->createSpriteImageMaterial();
-		info.invViewportWidth = info.material->getParamFloat("invViewportWidth");
-		info.invViewportHeight = info.material->getParamFloat("invViewportHeight");
-		info.worldTransform = info.material->getParamMat4("worldTransform");
-		info.mainTexture = info.material->getParamTexture("mainTexture");
-		info.tint = info.material->getParamVec4("tint");
-
-		return info;
-	}
-
-	DebugDraw2DClipSpaceMatInfo BuiltinMaterialManager::createDebugDraw2DClipSpaceMaterial() const
-	{
-		assert(mActiveFactory != nullptr);
-
-		DebugDraw2DClipSpaceMatInfo info;
-		info.material = mActiveFactory->createDebugDraw2DClipSpaceMaterial();
-
-		return info;
-	}
-
-	DebugDraw2DScreenSpaceMatInfo BuiltinMaterialManager::createDebugDraw2DScreenSpaceMaterial() const
-	{
-		assert(mActiveFactory != nullptr);
-
-		DebugDraw2DScreenSpaceMatInfo info;
-		info.material = mActiveFactory->createDebugDraw2DScreenSpaceMaterial();
-		info.invViewportWidth = info.material->getParamFloat("invViewportWidth");
-		info.invViewportHeight = info.material->getParamFloat("invViewportHeight");
-
-		return info;
-	}
-
-	DebugDraw3DMatInfo BuiltinMaterialManager::createDebugDraw3DMaterial() const
-	{
-		assert(mActiveFactory != nullptr);
-
-		DebugDraw3DMatInfo info;
-		info.material = mActiveFactory->createDebugDraw3DMaterial();
-		info.matViewProj = info.material->getParamMat4("matViewProj");
-
-		return info;
-	}
-
-	HMaterial BuiltinMaterialManager::createDockDropOverlayMaterial() const
-	{
-		assert(mActiveFactory != nullptr);
-
-		return mActiveFactory->createDockDropOverlayMaterial();
-	}
-
-	HMaterial BuiltinMaterialManager::createDummyMaterial() const
-	{
-		assert(mActiveFactory != nullptr);
-
-		return mActiveFactory->createDummyMaterial();
-	}
-
-	void BuiltinMaterialManager::addFactory(BuiltinMaterialFactory* factory)
-	{
-		assert(factory != nullptr);
-
-		mAvailableFactories[factory->getSupportedRenderSystem()] = factory;
-	}
-
-	void BuiltinMaterialManager::setActive(const String& renderSystemName)
-	{
-		auto iterFind = mAvailableFactories.find(renderSystemName);
-
-		if(iterFind == mAvailableFactories.end())
-		{
-			BS_EXCEPT(InvalidParametersException, "Cannot find a factory for the specified render system: " + renderSystemName);
-		}
-
-		mActiveFactory = iterFind->second;
-		mActiveFactory->startUp();
-	}
-}

+ 528 - 28
BansheeEngine/Source/BsBuiltinResources.cpp

@@ -10,19 +10,42 @@
 
 #include "BsFont.h"
 #include "BsFontImportOptions.h"
+#include "BsGpuProgramImportOptions.h"
 #include "BsImporter.h"
+#include "BsResources.h"
+#include "BsGpuProgram.h"
+#include "BsShader.h"
+#include "BsTechnique.h"
+#include "BsPass.h"
+#include "BsMaterial.h"
+#include "BsBlendState.h"
+#include "BsDepthStencilState.h"
 #include "BsRTTIType.h"
 #include "BsFileSystem.h"
 #include "BsCoreApplication.h"
 #include "BsCoreThread.h"
+#include "BsApplication.h"
 
 namespace BansheeEngine
 {
-	const WString BuiltinResources::DefaultFontPath = L"arial.ttf";
+	const WString BuiltinResources::DefaultFontFilename = L"arial.ttf";
 	const UINT32 BuiltinResources::DefaultFontSize = 10;
 
+	const Path BuiltinResources::DefaultSkinFolderRaw = L"..\\..\\..\\..\\Data\\Raw\\Engine\\Skin\\";
+	const Path BuiltinResources::DefaultCursorFolderRaw = L"..\\..\\..\\..\\Data\\Raw\\Engine\\Cursors\\";
+	const Path BuiltinResources::DefaultShaderFolderRaw = L"..\\..\\..\\..\\Data\\Raw\\Engine\\Shaders\\";
+
 	const Path BuiltinResources::DefaultSkinFolder = L"..\\..\\..\\..\\Data\\Engine\\Skin\\";
 	const Path BuiltinResources::DefaultCursorFolder = L"..\\..\\..\\..\\Data\\Engine\\Cursors\\";
+	const Path BuiltinResources::DefaultShaderFolder = L"..\\..\\..\\..\\Data\\Engine\\Shaders\\";
+
+	const WString BuiltinResources::HLSL11ShaderSubFolder = L"HLSL11/";
+	const WString BuiltinResources::HLSL9ShaderSubFolder = L"HLSL9/";
+	const WString BuiltinResources::GLSLShaderSubFolder = L"GLSL/";
+
+	/************************************************************************/
+	/* 								GUI TEXTURES                      		*/
+	/************************************************************************/
 
 	const WString BuiltinResources::WhiteTex = L"White.psd";
 
@@ -88,6 +111,10 @@ namespace BansheeEngine
 
 	const WString BuiltinResources::ScrollBarBgTex = L"ScrollBarBg.psd";
 
+	/************************************************************************/
+	/* 							CURSOR TEXTURES                      		*/
+	/************************************************************************/
+
 	const WString BuiltinResources::CursorArrowTex = L"Arrow.psd";
 	const WString BuiltinResources::CursorArrowDragTex = L"ArrowDrag.psd";
 	const WString BuiltinResources::CursorArrowLeftRightTex = L"ArrowLeftRight.psd";
@@ -110,6 +137,35 @@ namespace BansheeEngine
 	const Vector2I BuiltinResources::CursorSizeNWSEHotspot = Vector2I(15, 15);
 	const Vector2I BuiltinResources::CursorSizeWEHotspot = Vector2I(15, 15);
 
+	/************************************************************************/
+	/* 									SHADERS                      		*/
+	/************************************************************************/
+
+	struct GpuProgramImportData
+	{
+		WString filename;
+		String entryPoint;
+		GpuProgramType type;
+		GpuProgramProfile profile;
+		String language;
+		WString folder;
+	};
+
+	const WString BuiltinResources::ShaderSpriteTextVSFile = L"spriteTextVS.gpuprog";
+	const WString BuiltinResources::ShaderSpriteTextPSFile = L"spriteTextPS.gpuprog";
+	const WString BuiltinResources::ShaderSpriteImageVSFile = L"spriteImageVS.gpuprog";
+	const WString BuiltinResources::ShaderSpriteImagePSFile = L"spriteImagePS.gpuprog";
+	const WString BuiltinResources::ShaderDebugDraw2DClipSpaceVSFile = L"debugDraw2DClipSpaceVS.gpuprog";
+	const WString BuiltinResources::ShaderDebugDraw2DClipSpacePSFile = L"debugDraw2DClipSpacePS.gpuprog";
+	const WString BuiltinResources::ShaderDebugDraw2DScreenSpaceVSFile = L"debugDraw2DScreenSpaceVS.gpuprog";
+	const WString BuiltinResources::ShaderDebugDraw2DScreenSpacePSFile = L"debugDraw2DScreenSpacePS.gpuprog";
+	const WString BuiltinResources::ShaderDebugDraw3DVSFile = L"debugDraw3DVS.gpuprog";
+	const WString BuiltinResources::ShaderDebugDraw3DPSFile = L"debugDraw3DPS.gpuprog";
+	const WString BuiltinResources::ShaderDockOverlayVSFile = L"dockDropOverlayVS.gpuprog";
+	const WString BuiltinResources::ShaderDockOverlayPSFile = L"dockDropOverlayPS.gpuprog";
+	const WString BuiltinResources::ShaderDummyVSFile = L"dummyVS.gpuprog";
+	const WString BuiltinResources::ShaderDummyPSFile = L"dummyPS.gpuprog";
+
 	BuiltinResources::~BuiltinResources()
 	{
 		mCursorArrow = nullptr;
@@ -124,10 +180,34 @@ namespace BansheeEngine
 		mCursorSizeWE = nullptr;
 	}
 
-	BuiltinResources::BuiltinResources()
+	BuiltinResources::BuiltinResources(RenderSystemPlugin activeRSPlugin)
+		:mRenderSystemPlugin(activeRSPlugin)
 	{
-		// TODO - Normally I want to load this from some file
-		
+		switch (activeRSPlugin)
+		{
+		case RenderSystemPlugin::DX11:
+			mActiveShaderSubFolder = HLSL11ShaderSubFolder;
+			mActiveRenderSystem = RenderSystemDX11;
+			break;
+		case RenderSystemPlugin::DX9:
+			mActiveShaderSubFolder = HLSL9ShaderSubFolder;
+			mActiveRenderSystem = RenderSystemDX9;
+			break;
+		case RenderSystemPlugin::OpenGL:
+			mActiveShaderSubFolder = GLSLShaderSubFolder;
+			mActiveRenderSystem = RenderSystemOpenGL;
+			break;
+		}
+
+		preprocess();
+
+		initSpriteTextShader();
+		initSpriteImageShader();
+		initDebugDraw2DClipSpaceShader();
+		initDebugDraw2DScreenSpaceShader();
+		initDebugDraw3DShader();
+		initDummyShader();
+
 		mWhiteSpriteTexture = getSkinTexture(WhiteTex);
 
 		/************************************************************************/
@@ -177,28 +257,13 @@ namespace BansheeEngine
 
 		gCoreAccessor().submitToCoreThread(true);
 
-		// Label
-		// TODO - Instead of importing font every time, try to save a resource and then just load it?
-		HFont font;
+		Path fontPath = FileSystem::getWorkingDirectoryPath();
+		fontPath.append(DefaultSkinFolder);
+		fontPath.append(DefaultFontFilename + L".asset");
 
-		{
-			Path fontPath = DefaultSkinFolder;
-			fontPath.append(DefaultFontPath);
-
-			ImportOptionsPtr fontImportOptions = Importer::instance().createImportOptions(fontPath);
-			if(rtti_is_of_type<FontImportOptions>(fontImportOptions))
-			{
-				FontImportOptions* importOptions = static_cast<FontImportOptions*>(fontImportOptions.get());
-
-				Vector<BansheeEngine::UINT32> fontSizes;
-				fontSizes.push_back(DefaultFontSize);
-				importOptions->setFontSizes(fontSizes);
-				importOptions->setAntialiasing(false);
-			}
-
-			font = Importer::instance().import(fontPath, fontImportOptions);
-		}
+		HFont font = Resources::instance().load<Font>(fontPath);
 
+		// Label
 		GUIElementStyle labelStyle;
 		labelStyle.font = font;
 		labelStyle.fontSize = DefaultFontSize;
@@ -555,22 +620,397 @@ namespace BansheeEngine
 		mSkin.setStyle("ContextMenuSeparator", dropDownSeparatorStyle);
 	}
 
+	void BuiltinResources::preprocess()
+	{
+		static const WString GUI_TEXTURES[] = { WhiteTex, ButtonNormalTex, ButtonHoverTex, ButtonActiveTex, ToggleNormalTex,
+			ToggleHoverTex, ToggleActiveTex, ToggleNormalOnTex, ToggleHoverOnTex, ToggleActiveOnTex, InputBoxNormalTex,
+			InputBoxHoverTex, InputBoxFocusedTex, ScrollBarUpNormalTex, ScrollBarUpHoverTex, ScrollBarUpActiveTex,
+			ScrollBarDownNormalTex, ScrollBarDownHoverTex, ScrollBarDownActiveTex, ScrollBarLeftNormalTex,
+			ScrollBarLeftHoverTex, ScrollBarLeftActiveTex, ScrollBarRightNormalTex, ScrollBarRightHoverTex,
+			ScrollBarRightActiveTex, ScrollBarHandleHorzNormalTex, ScrollBarHandleHorzHoverTex, ScrollBarHandleHorzActiveTex,
+			ScrollBarHandleVertNormalTex, ScrollBarHandleVertHoverTex, ScrollBarHandleVertActiveTex, DropDownBtnNormalTex,
+			DropDownBtnHoverTex, DropDownBoxBgTex, DropDownBoxEntryNormalTex, DropDownBoxEntryHoverTex, DropDownBoxBtnUpNormalTex,
+			DropDownBoxBtnUpHoverTex, DropDownBoxBtnDownNormalTex, DropDownBoxBtnDownHoverTex, DropDownBoxEntryExpNormalTex, DropDownBoxEntryExpHoverTex,
+			DropDownSeparatorTex, DropDownBoxBtnUpArrowTex, DropDownBoxBtnDownArrowTex };
+
+		static const WString CURSOR_TEXTURES[] = { CursorArrowTex, CursorArrowDragTex, CursorArrowLeftRightTex, CursorIBeamTex,
+			CursorDenyTex, CursorWaitTex, CursorSizeNESWTex, CursorSizeNSTex, CursorSizeNWSETex, CursorSizeWETex };
+
+		static const GpuProgramImportData GPU_PROGRAM_IMPORT_DATA[] =
+		{
+			{ ShaderSpriteTextVSFile,				"vs_main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder},
+			{ ShaderSpriteTextPSFile,				"ps_main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0, "hlsl", HLSL11ShaderSubFolder },
+			{ ShaderSpriteImageVSFile,				"vs_main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
+			{ ShaderSpriteImagePSFile,				"ps_main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0, "hlsl", HLSL11ShaderSubFolder },
+			{ ShaderDebugDraw2DClipSpaceVSFile,		"vs_main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
+			{ ShaderDebugDraw2DClipSpacePSFile,		"ps_main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0, "hlsl", HLSL11ShaderSubFolder },
+			{ ShaderDebugDraw2DScreenSpaceVSFile,	"vs_main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
+			{ ShaderDebugDraw2DScreenSpacePSFile,	"ps_main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0, "hlsl", HLSL11ShaderSubFolder },
+			{ ShaderDebugDraw3DVSFile,				"vs_main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
+			{ ShaderDebugDraw3DPSFile,				"ps_main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0, "hlsl", HLSL11ShaderSubFolder },
+			{ ShaderDummyVSFile,					"vs_main",		GPT_VERTEX_PROGRAM,		GPP_VS_4_0, "hlsl", HLSL11ShaderSubFolder },
+			{ ShaderDummyPSFile,					"ps_main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0, "hlsl", HLSL11ShaderSubFolder },
+			{ ShaderSpriteTextVSFile,				"vs_main",		GPT_VERTEX_PROGRAM,		GPP_VS_2_0, "hlsl", HLSL9ShaderSubFolder },
+			{ ShaderSpriteTextPSFile,				"ps_main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_2_0, "hlsl", HLSL9ShaderSubFolder },
+			{ ShaderSpriteImageVSFile,				"vs_main",		GPT_VERTEX_PROGRAM,		GPP_VS_2_0, "hlsl", HLSL9ShaderSubFolder },
+			{ ShaderSpriteImagePSFile,				"ps_main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_2_0, "hlsl", HLSL9ShaderSubFolder },
+			{ ShaderDebugDraw2DClipSpaceVSFile,		"vs_main",		GPT_VERTEX_PROGRAM,		GPP_VS_2_0, "hlsl", HLSL9ShaderSubFolder },
+			{ ShaderDebugDraw2DClipSpacePSFile,		"ps_main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_2_0, "hlsl", HLSL9ShaderSubFolder },
+			{ ShaderDebugDraw2DScreenSpaceVSFile,	"vs_main",		GPT_VERTEX_PROGRAM,		GPP_VS_2_0, "hlsl", HLSL9ShaderSubFolder },
+			{ ShaderDebugDraw2DScreenSpacePSFile,	"ps_main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_2_0, "hlsl", HLSL9ShaderSubFolder },
+			{ ShaderDebugDraw3DVSFile,				"vs_main",		GPT_VERTEX_PROGRAM,		GPP_VS_2_0, "hlsl", HLSL9ShaderSubFolder },
+			{ ShaderDebugDraw3DPSFile,				"ps_main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_2_0, "hlsl", HLSL9ShaderSubFolder },
+			{ ShaderDummyVSFile,					"vs_main",		GPT_VERTEX_PROGRAM,		GPP_VS_2_0, "hlsl", HLSL9ShaderSubFolder },
+			{ ShaderDummyPSFile,					"ps_main",		GPT_FRAGMENT_PROGRAM,	GPP_PS_2_0, "hlsl", HLSL9ShaderSubFolder },
+			{ ShaderSpriteTextVSFile,				"main",			GPT_VERTEX_PROGRAM,		GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
+			{ ShaderSpriteTextPSFile,				"main",			GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0, "glsl", GLSLShaderSubFolder },
+			{ ShaderSpriteImageVSFile,				"main",			GPT_VERTEX_PROGRAM,		GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
+			{ ShaderSpriteImagePSFile,				"main",			GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0, "glsl", GLSLShaderSubFolder },
+			{ ShaderDebugDraw2DClipSpaceVSFile,		"main",			GPT_VERTEX_PROGRAM,		GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
+			{ ShaderDebugDraw2DClipSpacePSFile,		"main",			GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0, "glsl", GLSLShaderSubFolder },
+			{ ShaderDebugDraw2DScreenSpaceVSFile,	"main",			GPT_VERTEX_PROGRAM,		GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
+			{ ShaderDebugDraw2DScreenSpacePSFile,	"main",			GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0, "glsl", GLSLShaderSubFolder },
+			{ ShaderDebugDraw3DVSFile,				"main",			GPT_VERTEX_PROGRAM,		GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
+			{ ShaderDebugDraw3DPSFile,				"main",			GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0, "glsl", GLSLShaderSubFolder },
+			{ ShaderDummyVSFile,					"main",			GPT_VERTEX_PROGRAM,		GPP_VS_4_0, "glsl", GLSLShaderSubFolder },
+			{ ShaderDummyPSFile,					"main",			GPT_FRAGMENT_PROGRAM,	GPP_PS_4_0, "glsl", GLSLShaderSubFolder },
+		};
+
+		if (FileSystem::exists(DefaultCursorFolderRaw))
+		{
+			FileSystem::remove(DefaultCursorFolder);
+
+			for (auto& tex : CURSOR_TEXTURES)
+				importCursorTexture(tex);
+		}
+
+		if (FileSystem::exists(DefaultSkinFolderRaw))
+		{
+			FileSystem::remove(DefaultSkinFolder);
+
+			for (auto& tex : GUI_TEXTURES)
+				importSkinTexture(tex);
+
+			{
+				Path fontPath = FileSystem::getWorkingDirectoryPath();
+				fontPath.append(DefaultSkinFolderRaw);
+				fontPath.append(DefaultFontFilename);
+
+				ImportOptionsPtr fontImportOptions = Importer::instance().createImportOptions(fontPath);
+				if (rtti_is_of_type<FontImportOptions>(fontImportOptions))
+				{
+					FontImportOptions* importOptions = static_cast<FontImportOptions*>(fontImportOptions.get());
+
+					Vector<UINT32> fontSizes;
+					fontSizes.push_back(DefaultFontSize);
+					importOptions->setFontSizes(fontSizes);
+					importOptions->setAntialiasing(false);
+				}
+
+				HFont font = Importer::instance().import(fontPath, fontImportOptions);
+
+				Path outputPath = FileSystem::getWorkingDirectoryPath();
+				outputPath.append(DefaultSkinFolder);
+				outputPath.append(DefaultFontFilename + L".asset");
+
+				Resources::instance().save(font, outputPath, true);
+
+				// Save font texture pages as well. TODO - Later maybe figure out a more automatic way to do this
+				const FontData* fontData = font->getFontDataForSize(DefaultFontSize);
+
+				Path texPageOutputPath = FileSystem::getWorkingDirectoryPath();
+				texPageOutputPath.append(DefaultSkinFolder);
+
+				UINT32 pageIdx = 0;
+				for (auto tex : fontData->texturePages)
+				{
+					texPageOutputPath.setFilename(DefaultFontFilename + L"_texpage_" + toWString(pageIdx) + L".asset");
+					Resources::instance().save(tex, texPageOutputPath, true);
+				}
+			}
+		}
+
+		if (FileSystem::exists(DefaultShaderFolderRaw))
+		{
+			Path shaderFolder = DefaultShaderFolder;
+			shaderFolder.append(mActiveShaderSubFolder);
+
+			FileSystem::remove(shaderFolder);
+
+			for (auto& importData : GPU_PROGRAM_IMPORT_DATA)
+			{
+				if (importData.folder != mActiveShaderSubFolder)
+					continue;
+
+				Path gpuProgInputLoc = DefaultShaderFolderRaw;
+				gpuProgInputLoc.append(importData.folder);
+				gpuProgInputLoc.append(importData.filename);
+
+				Path gpuProgOutputLoc = DefaultShaderFolder;
+				gpuProgOutputLoc.append(importData.folder);
+				gpuProgOutputLoc.append(importData.filename + L".asset");
+
+				ImportOptionsPtr gpuProgImportOptions = Importer::instance().createImportOptions(gpuProgInputLoc);
+				if (rtti_is_of_type<GpuProgramImportOptions>(gpuProgImportOptions))
+				{
+					GpuProgramImportOptions* importOptions = static_cast<GpuProgramImportOptions*>(gpuProgImportOptions.get());
+
+					importOptions->setEntryPoint(importData.entryPoint);
+					importOptions->setLanguage(importData.language);
+					importOptions->setProfile(importData.profile);
+					importOptions->setType(importData.type);
+				}
+
+				HGpuProgram gpuProgram = Importer::instance().import(gpuProgInputLoc, gpuProgImportOptions);
+				Resources::instance().save(gpuProgram, gpuProgOutputLoc, true);
+			}
+		}
+
+		Resources::instance().unloadAllUnused();
+	}
+
 	HSpriteTexture BuiltinResources::getSkinTexture(const WString& name)
 	{
 		Path texturePath = FileSystem::getWorkingDirectoryPath();
 		texturePath.append(DefaultSkinFolder);
-		texturePath.append(name);
+		texturePath.append(L"sprite_" + name + L".asset");
 
-		return SpriteTexture::create(static_resource_cast<Texture>(Importer::instance().import(texturePath)));
+		return Resources::instance().load<SpriteTexture>(texturePath);
 	}
 
 	HTexture BuiltinResources::getCursorTexture(const WString& name)
 	{
 		Path cursorPath = FileSystem::getWorkingDirectoryPath();
 		cursorPath.append(DefaultCursorFolder);
-		cursorPath.append(name);
+		cursorPath.append(name + L".asset");
+
+		return Resources::instance().load<Texture>(cursorPath);
+	}
+
+	HGpuProgram BuiltinResources::getGpuProgram(const WString& name)
+	{
+		Path programPath = DefaultShaderFolder;
+		programPath.append(mActiveShaderSubFolder);
+		programPath.append(name + L".asset");
+
+		return gResources().load<GpuProgram>(programPath);
+	}
+
+	void BuiltinResources::importSkinTexture(const WString& name)
+	{
+		Path texturePath = FileSystem::getWorkingDirectoryPath();
+		texturePath.append(DefaultSkinFolderRaw);
+		texturePath.append(name);
+
+		Path texOutputPath = FileSystem::getWorkingDirectoryPath();
+		texOutputPath.append(DefaultSkinFolder);
+		Path spriteTexOutputPath = texOutputPath;
+		texOutputPath.append(name + L".asset");
+		spriteTexOutputPath.append(L"sprite_" + name + L".asset");
+
+		HTexture tex = Importer::instance().import<Texture>(texturePath);
+		Resources::instance().save(tex, texOutputPath, true);
+
+		HSpriteTexture spriteTex = SpriteTexture::create(tex);
+		Resources::instance().save(spriteTex, spriteTexOutputPath, true);
+	}
+
+	void BuiltinResources::importCursorTexture(const WString& name)
+	{
+		Path inputPath = FileSystem::getWorkingDirectoryPath();
+		inputPath.append(DefaultCursorFolderRaw);
+		inputPath.append(name);
+
+		Path ouputPath = FileSystem::getWorkingDirectoryPath();
+		ouputPath.append(DefaultCursorFolder);
+		ouputPath.append(name + L".asset");
+
+		HTexture tex = Importer::instance().import<Texture>(inputPath);
+		Resources::instance().save(tex, ouputPath, true);
+	}
+
+	void BuiltinResources::initSpriteTextShader()
+	{
+		HGpuProgram vsProgram = getGpuProgram(ShaderSpriteTextVSFile);
+		HGpuProgram psProgram = getGpuProgram(ShaderSpriteTextPSFile);
 
-		return static_resource_cast<Texture>(Importer::instance().import(cursorPath));
+		mShaderSpriteText = Shader::create("TextSpriteShader");
+
+		mShaderSpriteText->addParameter("worldTransform", "worldTransform", GPDT_MATRIX_4X4);
+		mShaderSpriteText->addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
+		mShaderSpriteText->addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
+
+		if (mRenderSystemPlugin == RenderSystemPlugin::DX11) // TODO: Find a way to avoid this
+			mShaderSpriteText->addParameter("mainTexSamp", "mainTexSamp", GPOT_SAMPLER2D);
+		else
+			mShaderSpriteText->addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
+
+		mShaderSpriteText->addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
+		mShaderSpriteText->addParameter("tint", "tint", GPDT_FLOAT4);
+
+		TechniquePtr newTechnique = mShaderSpriteText->addTechnique(mActiveRenderSystem, RendererInvariant);
+		PassPtr newPass = newTechnique->addPass();
+		newPass->setVertexProgram(vsProgram);
+		newPass->setFragmentProgram(psProgram);
+
+		BLEND_STATE_DESC desc;
+		desc.renderTargetDesc[0].blendEnable = true;
+		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
+		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
+		desc.renderTargetDesc[0].blendOp = BO_ADD;
+		desc.renderTargetDesc[0].renderTargetWriteMask = 0x7; // Don't write to alpha
+
+		HBlendState blendState = BlendState::create(desc);
+		newPass->setBlendState(blendState);
+
+		DEPTH_STENCIL_STATE_DESC depthStateDesc;
+		depthStateDesc.depthReadEnable = false;
+		depthStateDesc.depthWriteEnable = false;
+
+		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
+		newPass->setDepthStencilState(depthState);
+	}
+
+	void BuiltinResources::initSpriteImageShader()
+	{
+		HGpuProgram vsProgram = getGpuProgram(ShaderSpriteImageVSFile);
+		HGpuProgram psProgram = getGpuProgram(ShaderSpriteImagePSFile);
+
+		mShaderSpriteImage = Shader::create("ImageSpriteShader");
+
+		mShaderSpriteImage->addParameter("worldTransform", "worldTransform", GPDT_MATRIX_4X4);
+		mShaderSpriteImage->addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
+		mShaderSpriteImage->addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
+
+		if (mRenderSystemPlugin == RenderSystemPlugin::DX11) // TODO: Find a way to avoid this
+			mShaderSpriteImage->addParameter("mainTexSamp", "mainTexSamp", GPOT_SAMPLER2D);
+		else
+			mShaderSpriteImage->addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
+
+		mShaderSpriteImage->addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
+		mShaderSpriteImage->addParameter("tint", "tint", GPDT_FLOAT4);
+
+		TechniquePtr newTechnique = mShaderSpriteImage->addTechnique(mActiveRenderSystem, RendererInvariant);
+		PassPtr newPass = newTechnique->addPass();
+		newPass->setVertexProgram(vsProgram);
+		newPass->setFragmentProgram(psProgram);
+
+		BLEND_STATE_DESC desc;
+		desc.renderTargetDesc[0].blendEnable = true;
+		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
+		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
+		desc.renderTargetDesc[0].blendOp = BO_ADD;
+		desc.renderTargetDesc[0].renderTargetWriteMask = 0x7; // Don't write to alpha
+
+		HBlendState blendState = BlendState::create(desc);
+		newPass->setBlendState(blendState);
+
+		DEPTH_STENCIL_STATE_DESC depthStateDesc;
+		depthStateDesc.depthReadEnable = false;
+		depthStateDesc.depthWriteEnable = false;
+
+		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
+		newPass->setDepthStencilState(depthState);
+	}
+
+	void BuiltinResources::initDebugDraw2DClipSpaceShader()
+	{
+		HGpuProgram vsProgram = getGpuProgram(ShaderDebugDraw2DClipSpaceVSFile);
+		HGpuProgram psProgram = getGpuProgram(ShaderDebugDraw2DClipSpacePSFile);
+
+		mShaderDebugDraw2DClipSpace = Shader::create("DebugDraw2DClipSpaceShader");
+
+		TechniquePtr newTechnique = mShaderDebugDraw2DClipSpace->addTechnique(mActiveRenderSystem, RendererInvariant);
+		PassPtr newPass = newTechnique->addPass();
+		newPass->setVertexProgram(vsProgram);
+		newPass->setFragmentProgram(psProgram);
+
+		BLEND_STATE_DESC desc;
+		desc.renderTargetDesc[0].blendEnable = true;
+		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
+		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
+		desc.renderTargetDesc[0].blendOp = BO_ADD;
+
+		HBlendState blendState = BlendState::create(desc);
+		newPass->setBlendState(blendState);
+
+		DEPTH_STENCIL_STATE_DESC depthStateDesc;
+		depthStateDesc.depthReadEnable = false;
+		depthStateDesc.depthWriteEnable = false;
+
+		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
+		newPass->setDepthStencilState(depthState);
+	}
+
+	void BuiltinResources::initDebugDraw2DScreenSpaceShader()
+	{
+		HGpuProgram vsProgram = getGpuProgram(ShaderDebugDraw2DScreenSpaceVSFile);
+		HGpuProgram psProgram = getGpuProgram(ShaderDebugDraw2DScreenSpacePSFile);
+
+		mShaderDebugDraw2DScreenSpace = Shader::create("DebugDraw2DScreenSpaceShader");
+
+		mShaderDebugDraw2DScreenSpace->addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
+		mShaderDebugDraw2DScreenSpace->addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
+
+		TechniquePtr newTechnique = mShaderDebugDraw2DScreenSpace->addTechnique(mActiveRenderSystem, RendererInvariant);
+		PassPtr newPass = newTechnique->addPass();
+		newPass->setVertexProgram(vsProgram);
+		newPass->setFragmentProgram(psProgram);
+
+		BLEND_STATE_DESC desc;
+		desc.renderTargetDesc[0].blendEnable = true;
+		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
+		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
+		desc.renderTargetDesc[0].blendOp = BO_ADD;
+
+		HBlendState blendState = BlendState::create(desc);
+		newPass->setBlendState(blendState);
+
+		DEPTH_STENCIL_STATE_DESC depthStateDesc;
+		depthStateDesc.depthReadEnable = false;
+		depthStateDesc.depthWriteEnable = false;
+
+		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
+		newPass->setDepthStencilState(depthState);
+	}
+
+	void BuiltinResources::initDebugDraw3DShader()
+	{
+		HGpuProgram vsProgram = getGpuProgram(ShaderDebugDraw3DVSFile);
+		HGpuProgram psProgram = getGpuProgram(ShaderDebugDraw3DPSFile);
+
+		mShaderDebugDraw3D = Shader::create("DebugDraw3DShader");
+
+		mShaderDebugDraw3D->addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
+
+		TechniquePtr newTechnique = mShaderDebugDraw3D->addTechnique(mActiveRenderSystem, RendererInvariant);
+		PassPtr newPass = newTechnique->addPass();
+		newPass->setVertexProgram(vsProgram);
+		newPass->setFragmentProgram(psProgram);
+
+		BLEND_STATE_DESC desc;
+		desc.renderTargetDesc[0].blendEnable = true;
+		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
+		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
+		desc.renderTargetDesc[0].blendOp = BO_ADD;
+
+		HBlendState blendState = BlendState::create(desc);
+		newPass->setBlendState(blendState);
+	}
+
+	void BuiltinResources::initDummyShader()
+	{
+		HGpuProgram vsProgram = getGpuProgram(ShaderDummyVSFile);
+		HGpuProgram psProgram = getGpuProgram(ShaderDummyPSFile);
+
+		mShaderDummy = Shader::create("DummyShader");
+
+		mShaderDummy->addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4);
+
+		TechniquePtr newTechnique = mShaderDummy->addTechnique(mActiveRenderSystem, RendererInvariant);
+		PassPtr newPass = newTechnique->addPass();
+		newPass->setVertexProgram(vsProgram);
+		newPass->setFragmentProgram(psProgram);
 	}
 
 	const PixelData& BuiltinResources::getCursorArrow(Vector2I& hotSpot)
@@ -632,4 +1072,64 @@ namespace BansheeEngine
 		hotSpot = CursorArrowLeftRightHotspot;
 		return *mCursorArrowLeftRight.get();
 	}
+
+	GUIMaterialInfo BuiltinResources::createSpriteTextMaterial() const
+	{
+		GUIMaterialInfo info;
+		info.material = Material::create(mShaderSpriteText);
+		info.invViewportWidth = info.material->getParamFloat("invViewportWidth");
+		info.invViewportHeight = info.material->getParamFloat("invViewportHeight");
+		info.worldTransform = info.material->getParamMat4("worldTransform");
+		info.mainTexture = info.material->getParamTexture("mainTexture");
+		info.mainTexSampler = info.material->getParamSamplerState("mainTexSamp");
+		info.tint = info.material->getParamVec4("tint");
+
+		return info;
+	}
+
+	GUIMaterialInfo BuiltinResources::createSpriteImageMaterial() const
+	{
+		GUIMaterialInfo info;
+		info.material = Material::create(mShaderSpriteImage);
+		info.invViewportWidth = info.material->getParamFloat("invViewportWidth");
+		info.invViewportHeight = info.material->getParamFloat("invViewportHeight");
+		info.worldTransform = info.material->getParamMat4("worldTransform");
+		info.mainTexture = info.material->getParamTexture("mainTexture");
+		info.mainTexSampler = info.material->getParamSamplerState("mainTexSamp");
+		info.tint = info.material->getParamVec4("tint");
+
+		return info;
+	}
+
+	DebugDraw2DClipSpaceMatInfo BuiltinResources::createDebugDraw2DClipSpaceMaterial() const
+	{
+		DebugDraw2DClipSpaceMatInfo info;
+		info.material = Material::create(mShaderDebugDraw2DClipSpace);
+
+		return info;
+	}
+
+	DebugDraw2DScreenSpaceMatInfo BuiltinResources::createDebugDraw2DScreenSpaceMaterial() const
+	{
+		DebugDraw2DScreenSpaceMatInfo info;
+		info.material = Material::create(mShaderDebugDraw2DScreenSpace);
+		info.invViewportWidth = info.material->getParamFloat("invViewportWidth");
+		info.invViewportHeight = info.material->getParamFloat("invViewportHeight");
+
+		return info;
+	}
+
+	DebugDraw3DMatInfo BuiltinResources::createDebugDraw3DMaterial() const
+	{
+		DebugDraw3DMatInfo info;
+		info.material = Material::create(mShaderDebugDraw3D);
+		info.matViewProj = info.material->getParamMat4("matViewProj");
+
+		return info;
+	}
+
+	HMaterial BuiltinResources::createDummyMaterial() const
+	{
+		return Material::create(mShaderDummy);
+	}
 }

+ 0 - 493
BansheeEngine/Source/BsD3D11BuiltinMaterialFactory.cpp

@@ -1,493 +0,0 @@
-#include "BsD3D11BuiltinMaterialFactory.h"
-#include "BsRendererManager.h"
-#include "BsGpuProgram.h"
-#include "BsShader.h"
-#include "BsTechnique.h"
-#include "BsPass.h"
-#include "BsMaterial.h"
-#include "BsBlendState.h"
-#include "BsDepthStencilState.h"
-
-namespace BansheeEngine
-{
-	void D3D11BuiltinMaterialFactory::startUp()
-	{
-		initSpriteTextShader();
-		initSpriteImageShader();
-		initDebugDraw2DClipSpaceShader();
-		initDebugDraw2DScreenSpaceShader();
-		initDebugDraw3DShader();
-		initDockDropOverlayShader();
-		initDummyShader();
-
-		SAMPLER_STATE_DESC ssDesc;
-		ssDesc.magFilter = FO_POINT;
-		ssDesc.minFilter = FO_POINT;
-		ssDesc.mipFilter = FO_POINT;
-
-		mGUISamplerState = SamplerState::create(ssDesc);
-	}
-
-	void D3D11BuiltinMaterialFactory::shutDown()
-	{
-		mSpriteTextShader = nullptr;
-		mSpriteImageShader = nullptr;
-		mDebugDraw2DClipSpaceShader = nullptr;
-		mDebugDraw2DScreenSpaceShader = nullptr;
-		mDebugDraw3DShader = nullptr;
-		mDockDropOverlayShader = nullptr;
-		mDummyShader = nullptr;
-	}
-
-	const String& D3D11BuiltinMaterialFactory::getSupportedRenderSystem() const
-	{
-		static String renderSystem = "BansheeD3D11RenderSystem";
-
-		return renderSystem;
-	}
-
-	HMaterial D3D11BuiltinMaterialFactory::createSpriteTextMaterial() const
-	{
-		HMaterial newMaterial = Material::create(mSpriteTextShader);
-		newMaterial->setSamplerState("mainTexSamp", mGUISamplerState);
-
-		return newMaterial;
-	}
-
-	HMaterial D3D11BuiltinMaterialFactory::createSpriteImageMaterial() const
-	{
-		HMaterial newMaterial = Material::create(mSpriteImageShader);
-		newMaterial->setSamplerState("mainTexSamp", mGUISamplerState);
-
-		return newMaterial;
-	}
-
-	HMaterial D3D11BuiltinMaterialFactory::createDebugDraw2DClipSpaceMaterial() const
-	{
-		return Material::create(mDebugDraw2DClipSpaceShader);
-	}
-
-	HMaterial D3D11BuiltinMaterialFactory::createDebugDraw2DScreenSpaceMaterial() const
-	{
-		return Material::create(mDebugDraw2DScreenSpaceShader);
-	}
-
-	HMaterial D3D11BuiltinMaterialFactory::createDebugDraw3DMaterial() const
-	{
-		return Material::create(mDebugDraw3DShader);
-	}
-
-	HMaterial D3D11BuiltinMaterialFactory::createDockDropOverlayMaterial() const
-	{
-		return Material::create(mDockDropOverlayShader);
-	}
-
-	HMaterial D3D11BuiltinMaterialFactory::createDummyMaterial() const
-	{
-		return Material::create(mDummyShader);
-	}
-
-	void D3D11BuiltinMaterialFactory::initSpriteTextShader()
-	{
-		String vsCode = "										\
-			float invViewportWidth;								\
-			float invViewportHeight;							\
-			float4x4 worldTransform;							\
-																\
-			void vs_main(										\
-			in float3 inPos : POSITION,							\
-			in float2 uv : TEXCOORD0,							\
-			out float4 oPosition : SV_Position,					\
-			out float2 oUv : TEXCOORD0)							\
-			{													\
-				float4 tfrmdPos = mul(worldTransform, float4(inPos.xy, 0, 1));	\
-																				\
-				float tfrmdX = -1.0f + (tfrmdPos.x * invViewportWidth);			\
-				float tfrmdY = 1.0f - (tfrmdPos.y * invViewportHeight);			\
-																\
-				oPosition = float4(tfrmdX, tfrmdY, 0, 1);		\
-				oUv = uv;										\
-			}													\
-			";
-
-		String psCode = "																			\
-			SamplerState mainTexSamp : register(s0);												\
-			Texture2D mainTexture : register(t0);													\
-			float4 tint;																			\
-																									\
-			float4 ps_main(in float4 inPos : SV_Position, float2 uv : TEXCOORD0) : SV_Target		\
-			{																						\
-				float4 color = float4(tint.rgb, mainTexture.Sample(mainTexSamp, uv).r * tint.a);	\
-				return color;																		\
-			}";
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "hlsl", GPT_VERTEX_PROGRAM, GPP_VS_4_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "ps_main", "hlsl", GPT_FRAGMENT_PROGRAM, GPP_PS_4_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mSpriteTextShader = Shader::create("TextSpriteShader");
-
-		mSpriteTextShader->addParameter("worldTransform", "worldTransform", GPDT_MATRIX_4X4);
-		mSpriteTextShader->addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
-		mSpriteTextShader->addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
-		mSpriteTextShader->addParameter("mainTexSamp", "mainTexSamp", GPOT_SAMPLER2D);
-		mSpriteTextShader->addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
-		mSpriteTextShader->addParameter("tint", "tint", GPDT_FLOAT4);
-
-		TechniquePtr newTechnique = mSpriteTextShader->addTechnique("D3D11RenderSystem", RendererManager::getCoreRendererName()); 
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-		desc.renderTargetDesc[0].renderTargetWriteMask = 0x7; // Don't write to alpha
-
-		HBlendState blendState = BlendState::create(desc);
-		newPass->setBlendState(blendState);
-
-		DEPTH_STENCIL_STATE_DESC depthStateDesc;
-		depthStateDesc.depthReadEnable = false;
-		depthStateDesc.depthWriteEnable = false;
-
-		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
-		newPass->setDepthStencilState(depthState);
-	}
-
-	void D3D11BuiltinMaterialFactory::initSpriteImageShader()
-	{
-		String vsCode = "										\
-						float invViewportWidth;								\
-						float invViewportHeight;							\
-						float4x4 worldTransform;							\
-						\
-						void vs_main(										\
-						in float3 inPos : POSITION,							\
-						in float2 uv : TEXCOORD0,							\
-						out float4 oPosition : SV_Position,					\
-						out float2 oUv : TEXCOORD0)							\
-						{													\
-						float4 tfrmdPos = mul(worldTransform, float4(inPos.xy, 0, 1));	\
-						\
-						float tfrmdX = -1.0f + (tfrmdPos.x * invViewportWidth);			\
-						float tfrmdY = 1.0f - (tfrmdPos.y * invViewportHeight);			\
-						\
-						oPosition = float4(tfrmdX, tfrmdY, 0, 1);		\
-						oUv = uv;										\
-						}													\
-						";
-
-		String psCode = "																					\
-						SamplerState mainTexSamp : register(s0);											\
-						Texture2D mainTexture : register(t0);												\
-						float4 tint;																		\
-																											\
-						float4 ps_main(in float4 inPos : SV_Position, float2 uv : TEXCOORD0) : SV_Target	\
-						{																					\
-						float4 color = mainTexture.Sample(mainTexSamp, uv);									\
-						return color * tint;																\
-						}";
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "hlsl", GPT_VERTEX_PROGRAM, GPP_VS_4_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "ps_main", "hlsl", GPT_FRAGMENT_PROGRAM, GPP_PS_4_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mSpriteImageShader = Shader::create("ImageSpriteShader");
-
-		mSpriteImageShader->addParameter("worldTransform", "worldTransform", GPDT_MATRIX_4X4);
-		mSpriteImageShader->addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
-		mSpriteImageShader->addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
-		mSpriteImageShader->addParameter("mainTexSamp", "mainTexSamp", GPOT_SAMPLER2D);
-		mSpriteImageShader->addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
-		mSpriteImageShader->addParameter("tint", "tint", GPDT_FLOAT4);
-
-		TechniquePtr newTechnique = mSpriteImageShader->addTechnique("D3D11RenderSystem", RendererManager::getCoreRendererName()); 
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-		desc.renderTargetDesc[0].renderTargetWriteMask = 0x7; // Don't write to alpha
-
-		HBlendState blendState = BlendState::create(desc);
-		newPass->setBlendState(blendState);
-
-		DEPTH_STENCIL_STATE_DESC depthStateDesc;
-		depthStateDesc.depthReadEnable = false;
-		depthStateDesc.depthWriteEnable = false;
-
-		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
-		newPass->setDepthStencilState(depthState);
-	}
-
-	void D3D11BuiltinMaterialFactory::initDebugDraw2DClipSpaceShader()
-	{
-		String vsCode = "						\
-		void vs_main(							\
-			in float2 inPos : POSITION,			\
-			in float4 color : COLOR0,			\
-			out float4 oPosition : SV_Position, \
-			out float4 oColor : COLOR0)			\
-		{										\
-			oPosition = float4(inPos.xy, 0, 1); \
-			oColor = color;						\
-		}";
-
-		String psCode = "																		\
-		float4 ps_main(in float4 inPos : SV_Position, in float4 color : COLOR0) : SV_Target		\
-		{																						\
-			return color;																		\
-		}																						\
-		";	
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "hlsl", GPT_VERTEX_PROGRAM, GPP_VS_4_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "ps_main", "hlsl", GPT_FRAGMENT_PROGRAM, GPP_PS_4_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mDebugDraw2DClipSpaceShader = Shader::create("DebugDraw2DClipSpaceShader");
-
-		TechniquePtr newTechnique = mDebugDraw2DClipSpaceShader->addTechnique("D3D11RenderSystem", RendererManager::getCoreRendererName()); 
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-
-		HBlendState blendState = BlendState::create(desc);
-		newPass->setBlendState(blendState);
-
-		DEPTH_STENCIL_STATE_DESC depthStateDesc;
-		depthStateDesc.depthReadEnable = false;
-		depthStateDesc.depthWriteEnable = false;
-
-		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
-		newPass->setDepthStencilState(depthState);
-	}
-
-	void D3D11BuiltinMaterialFactory::initDebugDraw2DScreenSpaceShader()
-	{
-		String vsCode = "									\
-						float invViewportWidth;				\
-						float invViewportHeight;			\
-															\
-						void vs_main(						\
-						in float2 inPos : POSITION,			\
-						in float4 color : COLOR0,			\
-						out float4 oPosition : SV_Position, \
-						out float4 oColor : COLOR0)			\
-						{														\
-						float tfrmdX = -1.0f + (inPos.x * invViewportWidth);	\
-						float tfrmdY = 1.0f - (inPos.y * invViewportHeight);	\
-																				\
-						oPosition = float4(tfrmdX, tfrmdY, 0, 1);				\
-						oColor = color;											\
-						}";
-
-		String psCode = "																		\
-						float4 ps_main(in float4 inPos : SV_Position, in float4 color : COLOR0) : SV_Target		\
-						{																						\
-						return color;																		\
-						}																						\
-						";	
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "hlsl", GPT_VERTEX_PROGRAM, GPP_VS_4_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "ps_main", "hlsl", GPT_FRAGMENT_PROGRAM, GPP_PS_4_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mDebugDraw2DScreenSpaceShader = Shader::create("DebugDraw2DScreenSpaceShader");
-
-		mDebugDraw2DScreenSpaceShader->addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
-		mDebugDraw2DScreenSpaceShader->addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
-
-		TechniquePtr newTechnique = mDebugDraw2DScreenSpaceShader->addTechnique("D3D11RenderSystem", RendererManager::getCoreRendererName()); 
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-
-		HBlendState blendState = BlendState::create(desc);
-		newPass->setBlendState(blendState);
-
-		DEPTH_STENCIL_STATE_DESC depthStateDesc;
-		depthStateDesc.depthReadEnable = false;
-		depthStateDesc.depthWriteEnable = false;
-
-		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
-		newPass->setDepthStencilState(depthState);
-	}
-
-	void D3D11BuiltinMaterialFactory::initDebugDraw3DShader()
-	{
-		String vsCode = "float4x4 matViewProj;					\
-															\
-						void vs_main(						\
-						in float3 inPos : POSITION,			\
-						in float4 color : COLOR0,			\
-						out float4 oPosition : SV_Position, \
-						out float4 oColor : COLOR0)			\
-						{										\
-						oPosition = mul(matViewProj, float4(inPos.xyz, 1)); \
-						oColor = color;						\
-						}";
-
-		String psCode = "																		\
-						float4 ps_main(in float4 inPos : SV_Position, in float4 color : COLOR0) : SV_Target		\
-						{																						\
-						return color;																		\
-						}																						\
-						";	
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "hlsl", GPT_VERTEX_PROGRAM, GPP_VS_4_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "ps_main", "hlsl", GPT_FRAGMENT_PROGRAM, GPP_PS_4_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mDebugDraw3DShader = Shader::create("DebugDraw3DShader");
-
-		mDebugDraw3DShader->addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
-
-		TechniquePtr newTechnique = mDebugDraw3DShader->addTechnique("D3D11RenderSystem", RendererManager::getCoreRendererName()); 
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-
-		HBlendState blendState = BlendState::create(desc);
-		newPass->setBlendState(blendState);
-	}
-
-	void D3D11BuiltinMaterialFactory::initDockDropOverlayShader()
-	{
-		String vsCode = "									\
-						float invViewportWidth;				\
-						float invViewportHeight;			\
-						\
-						float4 tintColor;					\
-						float4 highlightColor;				\
-						float4 highlightActive;				\
-						\
-						void vs_main(						\
-						in float2 inPos : POSITION,			\
-						in float4 color : COLOR0,			\
-						out float4 oPosition : SV_Position, \
-						out float4 oColor : COLOR0)			\
-						{														\
-						float tfrmdX = -1.0f + (inPos.x * invViewportWidth);	\
-						float tfrmdY = 1.0f - (inPos.y * invViewportHeight);	\
-						\
-						oPosition = float4(tfrmdX, tfrmdY, 0, 1);				\
-																				\
-						float4 highlight = highlightActive * color;				\
-						float highlightSum = highlight.x + highlight.y +		\
-							highlight.z + highlight.a;							\
-																				\
-						oColor = (1.0f - highlightSum) * tintColor +			\
-							highlightSum * highlightColor;						\
-						}";
-
-		String psCode = "																		\
-						float4 ps_main(in float4 inPos : SV_Position, in float4 color : COLOR0) : SV_Target		\
-						{																						\
-						return color;																		\
-						}																						\
-						";	
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "hlsl", GPT_VERTEX_PROGRAM, GPP_VS_4_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "ps_main", "hlsl", GPT_FRAGMENT_PROGRAM, GPP_PS_4_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mDockDropOverlayShader = Shader::create("DockDropOverlayShader");
-
-		mDockDropOverlayShader->addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
-		mDockDropOverlayShader->addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
-
-		mDockDropOverlayShader->addParameter("tintColor", "tintColor", GPDT_FLOAT4);
-		mDockDropOverlayShader->addParameter("highlightColor", "highlightColor", GPDT_FLOAT4);
-		mDockDropOverlayShader->addParameter("highlightActive", "highlightActive", GPDT_FLOAT4);
-
-		TechniquePtr newTechnique = mDockDropOverlayShader->addTechnique("D3D11RenderSystem", RendererManager::getCoreRendererName()); 
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-
-		HBlendState blendState = BlendState::create(desc);
-		newPass->setBlendState(blendState);
-
-		DEPTH_STENCIL_STATE_DESC depthStateDesc;
-		depthStateDesc.depthReadEnable = false;
-		depthStateDesc.depthWriteEnable = false;
-
-		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
-		newPass->setDepthStencilState(depthState);
-	}
-
-	void D3D11BuiltinMaterialFactory::initDummyShader()
-	{
-		String vsCode = "float4x4 matWorldViewProj;				\
-																\
-						 void vs_main(							\
-						 in float3 inPos : POSITION,			\
-						 out float4 oPosition : SV_Position)	\
-						 {										\
-							 oPosition = mul(matWorldViewProj, float4(inPos.xyz, 1)); \
-						 }";
-
-		String psCode = "float4 ps_main() : SV_Target				\
-						 {											\
-							 return float4(0.5f, 0.5f, 0.5f, 0.5f);	\
-						 }";	
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "hlsl", GPT_VERTEX_PROGRAM, GPP_VS_4_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "ps_main", "hlsl", GPT_FRAGMENT_PROGRAM, GPP_PS_4_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mDummyShader = Shader::create("DummyShader");
-
-		mDummyShader->addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4);
-
-		TechniquePtr newTechnique = mDummyShader->addTechnique("D3D11RenderSystem", RendererManager::getCoreRendererName());
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-	}
-}

+ 0 - 491
BansheeEngine/Source/BsD3D9BuiltinMaterialFactory.cpp

@@ -1,491 +0,0 @@
-#include "BsD3D9BuiltinMaterialFactory.h"
-#include "BsGpuProgram.h"
-#include "BsShader.h"
-#include "BsTechnique.h"
-#include "BsPass.h"
-#include "BsMaterial.h"
-#include "BsBlendState.h"
-#include "BsDepthStencilState.h"
-#include "BsRendererManager.h"
-
-namespace BansheeEngine
-{
-	void D3D9BuiltinMaterialFactory::startUp()
-	{
-		initSpriteTextShader();
-		initSpriteImageShader();
-		initDebugDraw2DClipSpaceShader();
-		initDebugDraw2DScreenSpaceShader();
-		initDebugDraw3DShader();
-		initDockDropOverlayShader();
-		initDummyShader();
-
-		SAMPLER_STATE_DESC ssDesc;
-		ssDesc.magFilter = FO_POINT;
-		ssDesc.minFilter = FO_POINT;
-		ssDesc.mipFilter = FO_POINT;
-
-		mGUISamplerState = SamplerState::create(ssDesc);
-	}
-
-	void D3D9BuiltinMaterialFactory::shutDown()
-	{
-		mSpriteTextShader = nullptr;
-		mSpriteImageShader = nullptr;
-		mDebugDraw2DClipSpaceShader = nullptr;
-		mDebugDraw2DScreenSpaceShader = nullptr;
-		mDebugDraw3DShader = nullptr;
-		mDockDropOverlayShader = nullptr;
-		mDummyShader = nullptr;
-	}
-
-	const String& D3D9BuiltinMaterialFactory::getSupportedRenderSystem() const
-	{
-		static String renderSystem = "BansheeD3D9RenderSystem";
-
-		return renderSystem;
-	}
-
-	HMaterial D3D9BuiltinMaterialFactory::createSpriteTextMaterial() const
-	{
-		HMaterial newMaterial = Material::create(mSpriteTextShader);
-		newMaterial->setSamplerState("mainTexSamp", mGUISamplerState);
-
-		return newMaterial;
-	}
-
-	HMaterial D3D9BuiltinMaterialFactory::createSpriteImageMaterial() const
-	{
-		HMaterial newMaterial = Material::create(mSpriteImageShader);
-		newMaterial->setSamplerState("mainTexSamp", mGUISamplerState);
-
-		return newMaterial;
-	}
-
-	HMaterial D3D9BuiltinMaterialFactory::createDebugDraw2DClipSpaceMaterial() const
-	{
-		return Material::create(mDebugDraw2DClipSpaceShader);
-	}
-
-	HMaterial D3D9BuiltinMaterialFactory::createDebugDraw2DScreenSpaceMaterial() const
-	{
-		return Material::create(mDebugDraw2DScreenSpaceShader);
-	}
-
-	HMaterial D3D9BuiltinMaterialFactory::createDebugDraw3DMaterial() const
-	{
-		return Material::create(mDebugDraw3DShader);
-	}
-
-	HMaterial D3D9BuiltinMaterialFactory::createDockDropOverlayMaterial() const
-	{
-		return Material::create(mDockDropOverlayShader);
-	}
-
-	HMaterial D3D9BuiltinMaterialFactory::createDummyMaterial() const
-	{
-		return Material::create(mDummyShader);
-	}
-
-	void D3D9BuiltinMaterialFactory::initSpriteTextShader()
-	{
-		String vsCode = "										\
-			float invViewportWidth;								\
-			float invViewportHeight;							\
-			float4x4 worldTransform;							\
-																\
-			void vs_main(										\
-			in float3 inPos : POSITION,							\
-			in float2 uv : TEXCOORD0,							\
-			out float4 oPosition : POSITION,					\
-			out float2 oUv : TEXCOORD0)							\
-			{													\
-				float4 tfrmdPos = mul(worldTransform, float4(inPos.xy, 0, 1));	\
-																\
-				float tfrmdX = -1.0f + ((tfrmdPos.x - 0.5f) * invViewportWidth);			\
-				float tfrmdY = 1.0f - ((tfrmdPos.y - 0.5f) * invViewportHeight);			\
-																\
-				oPosition = float4(tfrmdX, tfrmdY, 0, 1);		\
-				oUv = uv;										\
-			}													\
-			";
-
-		String psCode = "																\
-			sampler2D mainTexture;														\
-			float4 tint;																\
-																						\
-			float4 ps_main(float2 uv : TEXCOORD0) : COLOR0								\
-			{																			\
-				float4 color = float4(tint.rgb, tex2D(mainTexture, uv).r * tint.a);		\
-				return color;															\
-			}";
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "hlsl", GPT_VERTEX_PROGRAM, GPP_VS_3_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "ps_main", "hlsl", GPT_FRAGMENT_PROGRAM, GPP_PS_3_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mSpriteTextShader = Shader::create("TextSpriteShader");
-
-		mSpriteTextShader->addParameter("worldTransform", "worldTransform", GPDT_MATRIX_4X4);
-		mSpriteTextShader->addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
-		mSpriteTextShader->addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
-		mSpriteTextShader->addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
-		mSpriteTextShader->addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
-		mSpriteTextShader->addParameter("tint", "tint", GPDT_FLOAT4);
-
-		TechniquePtr newTechnique = mSpriteTextShader->addTechnique("D3D9RenderSystem", RendererManager::getCoreRendererName()); 
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-		desc.renderTargetDesc[0].renderTargetWriteMask = 0x7; // Don't write to alpha
-
-		HBlendState blendState = BlendState::create(desc);
-		newPass->setBlendState(blendState);
-
-		DEPTH_STENCIL_STATE_DESC depthStateDesc;
-		depthStateDesc.depthReadEnable = false;
-		depthStateDesc.depthWriteEnable = false;
-
-		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
-		newPass->setDepthStencilState(depthState);
-	}
-
-	void D3D9BuiltinMaterialFactory::initSpriteImageShader()
-	{
-		String vsCode = "										\
-						float invViewportWidth;								\
-						float invViewportHeight;							\
-						float4x4 worldTransform;							\
-						\
-						void vs_main(										\
-						in float3 inPos : POSITION,							\
-						in float2 uv : TEXCOORD0,							\
-						out float4 oPosition : POSITION,					\
-						out float2 oUv : TEXCOORD0)							\
-						{													\
-						float4 tfrmdPos = mul(worldTransform, float4(inPos.xy, 0, 1));	\
-						\
-						float tfrmdX = -1.0f + ((tfrmdPos.x - 0.5f) * invViewportWidth);			\
-						float tfrmdY = 1.0f - ((tfrmdPos.y - 0.5f) * invViewportHeight);			\
-						\
-						oPosition = float4(tfrmdX, tfrmdY, 0, 1);		\
-						oUv = uv;										\
-						}													\
-						";
-
-		String psCode = "												\
-						sampler2D mainTexture;							\
-						float4 tint;									\
-																		\
-						float4 ps_main(float2 uv : TEXCOORD0) : COLOR0	\
-						{												\
-						float4 color = tex2D(mainTexture, uv);			\
-						return color * tint;							\
-						}";
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "hlsl", GPT_VERTEX_PROGRAM, GPP_VS_2_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "ps_main", "hlsl", GPT_FRAGMENT_PROGRAM, GPP_PS_2_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mSpriteImageShader = Shader::create("ImageSpriteShader");
-
-		mSpriteImageShader->addParameter("worldTransform", "worldTransform", GPDT_MATRIX_4X4);
-		mSpriteImageShader->addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
-		mSpriteImageShader->addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
-		mSpriteImageShader->addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
-		mSpriteImageShader->addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
-		mSpriteImageShader->addParameter("tint", "tint", GPDT_FLOAT4);
-
-		TechniquePtr newTechnique = mSpriteImageShader->addTechnique("D3D9RenderSystem", RendererManager::getCoreRendererName()); 
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-		desc.renderTargetDesc[0].renderTargetWriteMask = 0x7; // Don't write to alpha
-
-		HBlendState blendState = BlendState::create(desc);
-		newPass->setBlendState(blendState);
-
-		DEPTH_STENCIL_STATE_DESC depthStateDesc;
-		depthStateDesc.depthReadEnable = false;
-		depthStateDesc.depthWriteEnable = false;
-
-		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
-		newPass->setDepthStencilState(depthState);
-	}
-
-	void D3D9BuiltinMaterialFactory::initDebugDraw2DClipSpaceShader()
-	{
-		String vsCode = "										\
-						void vs_main(							\
-						in float2 inPos : POSITION,				\
-						in float4 inColor : COLOR0,				\
-						out float4 oPosition : POSITION,		\
-						out float4 oColor : COLOR0)				\
-						{										\
-						oPosition = float4(inPos.xy, 0, 1);		\
-						oColor = inColor;						\
-						}										\
-						";
-
-		String psCode = "												\
-						float4 ps_main(float4 color : COLOR0) : COLOR0	\
-						{												\
-						return color;									\
-						}";
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "hlsl", GPT_VERTEX_PROGRAM, GPP_VS_2_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "ps_main", "hlsl", GPT_FRAGMENT_PROGRAM, GPP_PS_2_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mDebugDraw2DClipSpaceShader = Shader::create("DebugDraw2DClipSpaceShader");
-
-		TechniquePtr newTechnique = mDebugDraw2DClipSpaceShader->addTechnique("D3D9RenderSystem", RendererManager::getCoreRendererName()); 
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-
-		HBlendState blendState = BlendState::create(desc);
-		newPass->setBlendState(blendState);
-
-		DEPTH_STENCIL_STATE_DESC depthStateDesc;
-		depthStateDesc.depthReadEnable = false;
-		depthStateDesc.depthWriteEnable = false;
-
-		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
-		newPass->setDepthStencilState(depthState);
-	}
-
-	void D3D9BuiltinMaterialFactory::initDebugDraw2DScreenSpaceShader()
-	{
-		String vsCode = "										\
-						float invViewportWidth;					\
-						float invViewportHeight;				\
-																\
-						void vs_main(							\
-						in float2 inPos : POSITION,				\
-						in float4 inColor : COLOR0,				\
-						out float4 oPosition : POSITION,		\
-						out float4 oColor : COLOR0)				\
-						{										\
-						float tfrmdX = -1.0f + ((inPos.x - 0.5f) * invViewportWidth);			\
-						float tfrmdY = 1.0f - ((inPos.y - 0.5f) * invViewportHeight);			\
-																\
-						oPosition = float4(tfrmdX, tfrmdY, 0, 1);		\
-						oColor = inColor;						\
-						}										\
-						";
-
-		String psCode = "												\
-						float4 ps_main(float4 color : COLOR0) : COLOR0	\
-						{												\
-						return color;									\
-						}";
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "hlsl", GPT_VERTEX_PROGRAM, GPP_VS_2_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "ps_main", "hlsl", GPT_FRAGMENT_PROGRAM, GPP_PS_2_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mDebugDraw2DScreenSpaceShader = Shader::create("DebugDraw2DScreenSpaceShader");
-
-		mDebugDraw2DScreenSpaceShader->addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
-		mDebugDraw2DScreenSpaceShader->addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
-
-		TechniquePtr newTechnique = mDebugDraw2DScreenSpaceShader->addTechnique("D3D9RenderSystem", RendererManager::getCoreRendererName()); 
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-
-		HBlendState blendState = BlendState::create(desc);
-		newPass->setBlendState(blendState);
-
-		DEPTH_STENCIL_STATE_DESC depthStateDesc;
-		depthStateDesc.depthReadEnable = false;
-		depthStateDesc.depthWriteEnable = false;
-
-		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
-		newPass->setDepthStencilState(depthState);
-	}
-
-	void D3D9BuiltinMaterialFactory::initDebugDraw3DShader()
-	{
-		String vsCode = "float4x4 matViewProj;						\
-																\
-						void vs_main(							\
-						in float3 inPos : POSITION,				\
-						in float4 inColor : COLOR0,				\
-						out float4 oPosition : POSITION,		\
-						out float4 oColor : COLOR0)				\
-						{										\
-						oPosition = mul(matViewProj, float4(inPos.xyz, 1));		\
-						oColor = inColor;						\
-						}										\
-						";
-
-		String psCode = "												\
-						float4 ps_main(float4 color : COLOR0) : COLOR0	\
-						{												\
-						return color;									\
-						}";
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "hlsl", GPT_VERTEX_PROGRAM, GPP_VS_2_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "ps_main", "hlsl", GPT_FRAGMENT_PROGRAM, GPP_PS_2_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mDebugDraw3DShader = Shader::create("DebugDraw3DShader");
-
-		mDebugDraw3DShader->addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
-
-		TechniquePtr newTechnique = mDebugDraw3DShader->addTechnique("D3D9RenderSystem", RendererManager::getCoreRendererName()); 
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-
-		HBlendState blendState = BlendState::create(desc);
-		newPass->setBlendState(blendState);
-	}
-
-	void D3D9BuiltinMaterialFactory::initDockDropOverlayShader()
-	{
-		String vsCode = "										\
-						float invViewportWidth;					\
-						float invViewportHeight;				\
-						\
-						float4 tintColor;						\
-						float4 highlightColor;					\
-						float4 highlightActive;					\
-						\
-						void vs_main(							\
-						in float2 inPos : POSITION,				\
-						in float4 inColor : COLOR0,				\
-						out float4 oPosition : POSITION,		\
-						out float4 oColor : COLOR0)				\
-						{										\
-						float tfrmdX = -1.0f + ((inPos.x - 0.5f) * invViewportWidth);			\
-						float tfrmdY = 1.0f - ((inPos.y - 0.5f) * invViewportHeight);			\
-						\
-						oPosition = float4(tfrmdX, tfrmdY, 0, 1);				\
-																				\
-						float4 highlight = highlightActive * inColor;			\
-						float highlightSum = highlight.x + highlight.y +		\
-						highlight.z + highlight.a;								\
-																				\
-						oColor = (1.0f - highlightSum) * tintColor +			\
-						highlightSum * highlightColor;							\
-						}														\
-						";
-
-		String psCode = "												\
-						float4 ps_main(float4 color : COLOR0) : COLOR0	\
-						{												\
-						return color;									\
-						}";
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "hlsl", GPT_VERTEX_PROGRAM, GPP_VS_2_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "ps_main", "hlsl", GPT_FRAGMENT_PROGRAM, GPP_PS_2_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mDockDropOverlayShader = Shader::create("DockDropOverlayShader");
-
-		mDockDropOverlayShader->addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
-		mDockDropOverlayShader->addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
-
-		mDockDropOverlayShader->addParameter("tintColor", "tintColor", GPDT_FLOAT4);
-		mDockDropOverlayShader->addParameter("highlightColor", "highlightColor", GPDT_FLOAT4);
-		mDockDropOverlayShader->addParameter("highlightActive", "highlightActive", GPDT_FLOAT4);
-
-		TechniquePtr newTechnique = mDockDropOverlayShader->addTechnique("D3D9RenderSystem", RendererManager::getCoreRendererName()); 
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-
-		HBlendState blendState = BlendState::create(desc);
-		newPass->setBlendState(blendState);
-
-		DEPTH_STENCIL_STATE_DESC depthStateDesc;
-		depthStateDesc.depthReadEnable = false;
-		depthStateDesc.depthWriteEnable = false;
-
-		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
-		newPass->setDepthStencilState(depthState);
-	}
-
-	void D3D9BuiltinMaterialFactory::initDummyShader()
-	{
-		String vsCode = "float4x4 matWorldViewProj;			\
-															\
-						 void vs_main(						\
-						 in float3 inPos : POSITION,		\
-						 out float4 oPosition : POSITION)	\
-						 {									\
-							 oPosition = mul(matWorldViewProj, float4(inPos.xyz, 1));	\
-						 }";
-
-		String psCode = "float4 ps_main() : COLOR0					\
-						 {											\
-						 	return float4(0.5f, 0.5f, 0.5f, 0.5f);	\
-						 }";
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "hlsl", GPT_VERTEX_PROGRAM, GPP_VS_2_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "ps_main", "hlsl", GPT_FRAGMENT_PROGRAM, GPP_PS_2_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mDummyShader = Shader::create("DummyShader");
-
-		mDummyShader->addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4);
-
-		TechniquePtr newTechnique = mDummyShader->addTechnique("D3D9RenderSystem", RendererManager::getCoreRendererName());
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-	}
-}

+ 12 - 12
BansheeEngine/Source/BsDrawHelper2D.cpp

@@ -9,14 +9,14 @@
 #include "BsRenderQueue.h"
 #include "BsCamera.h"
 #include "BsCoreThreadAccessor.h"
-#include "BsBuiltinMaterialManager.h"
+#include "BsBuiltinResources.h"
 #include "BsVertexDataDesc.h"
 
 namespace BansheeEngine
 {
 	DrawHelper2D::DrawHelper2D()
 	{
-		mMaterial2DClipSpace = BuiltinMaterialManager::instance().createDebugDraw2DClipSpaceMaterial();
+		mMaterial2DClipSpace = BuiltinResources::instance().createDebugDraw2DClipSpaceMaterial();
 
 		mVertexDesc = bs_shared_ptr<VertexDataDesc>();
 		mVertexDesc->addVertElem(VET_FLOAT2, VES_POSITION);
@@ -47,7 +47,7 @@ namespace BansheeEngine
 
 	void DrawHelper2D::line_AA(const Vector2& a, const Vector2& b, float width, float borderWidth, const Color& color, const MeshDataPtr& meshData, UINT32 vertexOffset, UINT32 indexOffset)
 	{
-		DrawHelperTemplate<Vector2>::line_AA(a, b, width, borderWidth, color, meshData, vertexOffset, indexOffset);
+		DrawHelperTemplate<Vector2>::line_AA(a, b, Vector2::ZERO, width, borderWidth, color, meshData, vertexOffset, indexOffset);
 	}
 
 	void DrawHelper2D::lineList_Pixel(const Vector<Vector2>& linePoints, const Color& color, const MeshDataPtr& meshData, UINT32 vertexOffset, UINT32 indexOffset)
@@ -57,7 +57,7 @@ namespace BansheeEngine
 
 	void DrawHelper2D::lineList_AA(const Vector<Vector2>& linePoints, float width, float borderWidth, const Color& color, const MeshDataPtr& meshData, UINT32 vertexOffset, UINT32 indexOffset)
 	{
-		DrawHelperTemplate<Vector2>::lineList_AA(linePoints, width, borderWidth, color, meshData, vertexOffset, indexOffset);
+		DrawHelperTemplate<Vector2>::lineList_AA(linePoints, Vector2::ZERO, width, borderWidth, color, meshData, vertexOffset, indexOffset);
 	}
 
 	/************************************************************************/
@@ -110,7 +110,7 @@ namespace BansheeEngine
 		else
 		{
 			dbgCmd.type = DebugDrawType::ScreenSpace;
-			dbgCmd.matInfo2DScreenSpace = BuiltinMaterialManager::instance().createDebugDraw2DScreenSpaceMaterial();
+			dbgCmd.matInfo2DScreenSpace = BuiltinResources::instance().createDebugDraw2DScreenSpaceMaterial();
 		}
 	}
 
@@ -149,7 +149,7 @@ namespace BansheeEngine
 		else
 		{
 			dbgCmd.type = DebugDrawType::ScreenSpace;
-			dbgCmd.matInfo2DScreenSpace = BuiltinMaterialManager::instance().createDebugDraw2DScreenSpaceMaterial();
+			dbgCmd.matInfo2DScreenSpace = BuiltinResources::instance().createDebugDraw2DScreenSpaceMaterial();
 		}
 	}
 
@@ -188,7 +188,7 @@ namespace BansheeEngine
 		else
 		{
 			dbgCmd.type = DebugDrawType::ScreenSpace;
-			dbgCmd.matInfo2DScreenSpace = BuiltinMaterialManager::instance().createDebugDraw2DScreenSpaceMaterial();
+			dbgCmd.matInfo2DScreenSpace = BuiltinResources::instance().createDebugDraw2DScreenSpaceMaterial();
 		}
 	}
 
@@ -233,7 +233,7 @@ namespace BansheeEngine
 		else
 		{
 			dbgCmd.type = DebugDrawType::ScreenSpace;
-			dbgCmd.matInfo2DScreenSpace = BuiltinMaterialManager::instance().createDebugDraw2DScreenSpaceMaterial();
+			dbgCmd.matInfo2DScreenSpace = BuiltinResources::instance().createDebugDraw2DScreenSpaceMaterial();
 		}
 	}
 
@@ -277,11 +277,11 @@ namespace BansheeEngine
 		else
 		{
 			dbgCmd.type = DebugDrawType::ScreenSpace;
-			dbgCmd.matInfo2DScreenSpace = BuiltinMaterialManager::instance().createDebugDraw2DScreenSpaceMaterial();
+			dbgCmd.matInfo2DScreenSpace = BuiltinResources::instance().createDebugDraw2DScreenSpaceMaterial();
 		}
 	}
 
-	void DrawHelper2D::line_AA(const Vector2& a, const Vector2& b, float width, float borderWidth, const Color& color, UINT8* outVertices, UINT8* outColors, 
+	void DrawHelper2D::line_AA(const Vector2& a, const Vector2& b, const Vector2& up, float width, float borderWidth, const Color& color, UINT8* outVertices, UINT8* outColors,
 		UINT32 vertexOffset, UINT32 vertexStride, UINT32* outIndices, UINT32 indexOffset)
 	{
 		Vector2 dir = b - a;
@@ -309,10 +309,10 @@ namespace BansheeEngine
 		points[2] = v2;
 		points[3] = v3;
 
-		polygon_AA(points, borderWidth, color, outVertices, outColors, vertexOffset, vertexStride, outIndices, indexOffset);
+		polygon_AA(points, up, borderWidth, color, outVertices, outColors, vertexOffset, vertexStride, outIndices, indexOffset);
 	}
 
-	void DrawHelper2D::polygon_AA(const Vector<Vector2>& points, float borderWidth, const Color& color, UINT8* outVertices, UINT8* outColors, 
+	void DrawHelper2D::polygon_AA(const Vector<Vector2>& points, const Vector2& up, float borderWidth, const Color& color, UINT8* outVertices, UINT8* outColors,
 		UINT32 vertexOffset, UINT32 vertexStride, UINT32* outIndices, UINT32 indexOffset)
 	{
 		UINT32 numCoords = (UINT32)points.size();

+ 122 - 18
BansheeEngine/Source/BsDrawHelper3D.cpp

@@ -9,7 +9,7 @@
 #include "BsRenderQueue.h"
 #include "BsException.h"
 #include "BsCamera.h"
-#include "BsBuiltinMaterialManager.h"
+#include "BsBuiltinResources.h"
 #include "BsVertexDataDesc.h"
 
 namespace BansheeEngine
@@ -37,9 +37,10 @@ namespace BansheeEngine
 		DrawHelperTemplate<Vector3>::line_Pixel(a, b, color, meshData, vertexOffset, indexOffset);
 	}
 
-	void DrawHelper3D::line_AA(const Vector3& a, const Vector3& b, float width, float borderWidth, const Color& color, const MeshDataPtr& meshData, UINT32 vertexOffset, UINT32 indexOffset)
+	void DrawHelper3D::line_AA(const Vector3& a, const Vector3& b, const Vector3& up, float width, float borderWidth, 
+		const Color& color, const MeshDataPtr& meshData, UINT32 vertexOffset, UINT32 indexOffset)
 	{
-		DrawHelperTemplate<Vector3>::line_AA(a, b, width, borderWidth, color, meshData, vertexOffset, indexOffset);
+		DrawHelperTemplate<Vector3>::line_AA(a, b, up, width, borderWidth, color, meshData, vertexOffset, indexOffset);
 	}
 
 	void DrawHelper3D::lineList_Pixel(const Vector<Vector3>& linePoints, const Color& color, const MeshDataPtr& meshData, UINT32 vertexOffset, UINT32 indexOffset)
@@ -47,9 +48,10 @@ namespace BansheeEngine
 		DrawHelperTemplate<Vector3>::lineList_Pixel(linePoints, color, meshData, vertexOffset, indexOffset);
 	}
 
-	void DrawHelper3D::lineList_AA(const Vector<Vector3>& linePoints, float width, float borderWidth, const Color& color, const MeshDataPtr& meshData, UINT32 vertexOffset, UINT32 indexOffset)
+	void DrawHelper3D::lineList_AA(const Vector<Vector3>& linePoints, const Vector3& up, float width, float borderWidth, 
+		const Color& color, const MeshDataPtr& meshData, UINT32 vertexOffset, UINT32 indexOffset)
 	{
-		DrawHelperTemplate<Vector3>::lineList_AA(linePoints, width, borderWidth, color, meshData, vertexOffset, indexOffset);
+		DrawHelperTemplate<Vector3>::lineList_AA(linePoints, up, width, borderWidth, color, meshData, vertexOffset, indexOffset);
 	}
 
 	/************************************************************************/
@@ -77,10 +79,10 @@ namespace BansheeEngine
 
 		dbgCmd.mesh = mesh;
 		dbgCmd.type = DebugDrawType::WorldSpace;
-		dbgCmd.matInfo3D = BuiltinMaterialManager::instance().createDebugDraw3DMaterial();
+		dbgCmd.matInfo3D = BuiltinResources::instance().createDebugDraw3DMaterial();
 	}
 
-	void DrawHelper3D::drawLine_AA(const HCamera& camera, const Vector3& a, const Vector3& b, float width, float borderWidth, const Color& color, float timeout)
+	void DrawHelper3D::drawLine_AA(const HCamera& camera, const Vector3& a, const Vector3& b, const Vector3& up, float width, float borderWidth, const Color& color, float timeout)
 	{
 		const Viewport* viewport = camera->getViewport().get();
 
@@ -92,7 +94,7 @@ namespace BansheeEngine
 
 		MeshDataPtr meshData = bs_shared_ptr<MeshData, ScratchAlloc>(8, 30, mVertexDesc);
 
-		line_AA(a, b, width, borderWidth, color, meshData, 0, 0);
+		line_AA(a, b, up, width, borderWidth, color, meshData, 0, 0);
 
 		UINT8* positionData = meshData->getElementData(VES_POSITION);
 		dbgCmd.worldCenter = calcCenter(positionData, meshData->getNumVertices(), mVertexDesc->getVertexStride());
@@ -101,7 +103,7 @@ namespace BansheeEngine
 
 		dbgCmd.mesh = mesh;
 		dbgCmd.type = DebugDrawType::WorldSpace;
-		dbgCmd.matInfo3D = BuiltinMaterialManager::instance().createDebugDraw3DMaterial();
+		dbgCmd.matInfo3D = BuiltinResources::instance().createDebugDraw3DMaterial();
 	}
 
 	void DrawHelper3D::drawLineList_Pixel(const HCamera& camera, const Vector<Vector3>& linePoints, const Color& color, float timeout)
@@ -126,10 +128,10 @@ namespace BansheeEngine
 
 		dbgCmd.mesh = mesh;
 		dbgCmd.type = DebugDrawType::WorldSpace;
-		dbgCmd.matInfo3D = BuiltinMaterialManager::instance().createDebugDraw3DMaterial();
+		dbgCmd.matInfo3D = BuiltinResources::instance().createDebugDraw3DMaterial();
 	}
 
-	void DrawHelper3D::drawLineList_AA(const HCamera& camera, const Vector<Vector3>& linePoints, float width, float borderWidth, 
+	void DrawHelper3D::drawLineList_AA(const HCamera& camera, const Vector<Vector3>& linePoints, const Vector3& up, float width, float borderWidth,
 		const Color& color, float timeout)
 	{
 		const Viewport* viewport = camera->getViewport().get();
@@ -142,7 +144,7 @@ namespace BansheeEngine
 
 		MeshDataPtr meshData = bs_shared_ptr<MeshData, ScratchAlloc>((UINT32)(linePoints.size() * 4), (UINT32)(linePoints.size() * 15), mVertexDesc);
 
-		lineList_AA(linePoints, width, borderWidth, color, meshData, 0, 0);	
+		lineList_AA(linePoints, up, width, borderWidth, color, meshData, 0, 0);	
 
 		UINT8* positionData = meshData->getElementData(VES_POSITION);
 		dbgCmd.worldCenter = calcCenter(positionData, meshData->getNumVertices(), mVertexDesc->getVertexStride());
@@ -151,7 +153,7 @@ namespace BansheeEngine
 
 		dbgCmd.mesh = mesh;
 		dbgCmd.type = DebugDrawType::WorldSpace;
-		dbgCmd.matInfo3D = BuiltinMaterialManager::instance().createDebugDraw3DMaterial();
+		dbgCmd.matInfo3D = BuiltinResources::instance().createDebugDraw3DMaterial();
 	}
 
 	void DrawHelper3D::drawAABox(const HCamera& camera, const AABox& box, const Color& color, float timeout)
@@ -186,7 +188,7 @@ namespace BansheeEngine
 
 		dbgCmd.mesh = mesh;
 		dbgCmd.type = DebugDrawType::WorldSpace;
-		dbgCmd.matInfo3D = BuiltinMaterialManager::instance().createDebugDraw3DMaterial();
+		dbgCmd.matInfo3D = BuiltinResources::instance().createDebugDraw3DMaterial();
 	}
 
 	void DrawHelper3D::aabox(const AABox& box, UINT8* outVertices, UINT32 vertexOffset, UINT32 vertexStride, UINT32* outIndices, UINT32 indexOffset)
@@ -299,15 +301,117 @@ namespace BansheeEngine
 		return center;
 	}
 
-	void DrawHelper3D::line_AA(const Vector3& a, const Vector3& b, float width, float borderWidth, const Color& color, UINT8* outVertices, UINT8* outColors, 
+	void DrawHelper3D::line_AA(const Vector3& a, const Vector3& b, const Vector3& up, float width, float borderWidth, const Color& color, UINT8* outVertices, UINT8* outColors,
 		UINT32 vertexOffset, UINT32 vertexStride, UINT32* outIndices, UINT32 indexOffset)
 	{
-		BS_EXCEPT(NotImplementedException, "3D AA line drawing not implemented.");
+		Vector3 dir = b - a;
+		dir.normalize();
+
+		Vector3 right = dir.cross(up);
+		right.normalize();
+
+		Vector<Vector3> points(4);
+
+		float r = width * 0.5f;
+		dir = dir * r;
+		right = right * r;
+
+		Vector3 v0 = a - dir - right;
+		Vector3 v1 = a - dir + right;
+		Vector3 v2 = b + dir + right;
+		Vector3 v3 = b + dir - right;
+
+		points[0] = v0;
+		points[1] = v1;
+		points[2] = v2;
+		points[3] = v3;
+
+		polygon_AA(points, up, borderWidth, color, outVertices, outColors, vertexOffset, vertexStride, outIndices, indexOffset);
 	}
 
-	void DrawHelper3D::polygon_AA(const Vector<Vector3>& points, float borderWidth, const Color& color, UINT8* outVertices, UINT8* outColors, 
+	void DrawHelper3D::polygon_AA(const Vector<Vector3>& points, const Vector3& up, float borderWidth, const Color& color, UINT8* outVertices, UINT8* outColors,
 		UINT32 vertexOffset, UINT32 vertexStride, UINT32* outIndices, UINT32 indexOffset)
 	{
-		BS_EXCEPT(NotImplementedException, "3D AA polygon drawing not implemented.");
+		UINT32 numCoords = (UINT32)points.size();
+
+		outVertices += vertexOffset * vertexStride;
+		Vector<Vector3> tempNormals(numCoords);
+
+		for (UINT32 i = 0, j = numCoords - 1; i < numCoords; j = i++)
+		{
+			const Vector3& v0 = points[j];
+			const Vector3& v1 = points[i];
+
+			Vector3 dir = v1 - v0;
+			Vector3 right = dir.cross(up);
+			right.normalize();
+
+			tempNormals[j] = right;
+
+			// Also start populating the vertex array
+			Vector3* vertices = (Vector3*)outVertices;
+			*vertices = v1;
+
+			UINT32* colors = (UINT32*)outColors;
+			*colors = color.getAsRGBA();
+
+			outVertices += vertexStride;
+			outColors += vertexStride;
+		}
+
+		Color transparentColor = color;
+		transparentColor.a = 0.0f;
+
+		for (UINT32 i = 0, j = numCoords - 1; i < numCoords; j = i++)
+		{
+			const Vector3& n0 = tempNormals[j];
+			const Vector3& n1 = tempNormals[i];
+
+			Vector3 avgNrm = (n0 + n1) * 0.5f;
+			float magSqrd = avgNrm.squaredLength();
+
+			if (magSqrd > 0.000001f)
+			{
+				float scale = 1.0f / magSqrd;
+				if (scale > 10.0f)
+					scale = 10.0f;
+
+				avgNrm = avgNrm * scale;
+			}
+
+			Vector3 tempCoord = points[i] + avgNrm * borderWidth;
+
+			// Move it to the vertex array
+			Vector3* vertices = (Vector3*)outVertices;
+			*vertices = tempCoord;
+
+			UINT32* colors = (UINT32*)outColors;
+			*colors = transparentColor.getAsRGBA();
+
+			outVertices += vertexStride;
+			outColors += vertexStride;
+		}
+
+		// Populate index buffer
+		outIndices += indexOffset;
+
+		UINT32 idxCnt = 0;
+		for (UINT32 i = 0, j = numCoords - 1; i < numCoords; j = i++)
+		{
+			outIndices[idxCnt++] = i;
+			outIndices[idxCnt++] = j;
+			outIndices[idxCnt++] = numCoords + j;
+
+			outIndices[idxCnt++] = numCoords + j;
+			outIndices[idxCnt++] = numCoords + i;
+			outIndices[idxCnt++] = i;
+		}
+
+		for (UINT32 i = 2; i < numCoords; ++i)
+		{
+			outIndices[idxCnt++] = 0;
+			outIndices[idxCnt++] = i - 1;
+			outIndices[idxCnt++] = i;
+		}
 	}
 }

+ 4 - 1
BansheeEngine/Source/BsDrawHelperTemplate.cpp

@@ -8,10 +8,13 @@
 #include "BsCoreApplication.h"
 #include "BsDrawList.h"
 #include "BsCamera.h"
-#include "BsBuiltinMaterialManager.h"
+#include "BsBuiltinResources.h"
 
 namespace BansheeEngine
 {
+	const UINT32 DrawHelperTemplateBase::NUM_VERTICES_AA_LINE = 8;
+	const UINT32 DrawHelperTemplateBase::NUM_INDICES_AA_LINE = 30;
+
 	void DrawHelperTemplateBase::render(const HCamera& camera, DrawList& drawList)
 	{
 		const Viewport* viewport = camera->getViewport().get();

+ 0 - 520
BansheeEngine/Source/BsGLBuiltinMaterialFactory.cpp

@@ -1,520 +0,0 @@
-#include "BsGLBuiltinMaterialFactory.h"
-#include "BsShader.h"
-#include "BsTechnique.h"
-#include "BsPass.h"
-#include "BsMaterial.h"
-#include "BsGpuProgram.h"
-#include "BsBlendState.h"
-#include "BsDepthStencilState.h"
-#include "BsRendererManager.h"
-
-namespace BansheeEngine
-{
-	void GLBuiltinMaterialFactory::startUp()
-	{
-		initSpriteTextShader();
-		initSpriteImageShader();
-		initDebugDraw2DClipSpaceShader();
-		initDebugDraw2DScreenSpaceShader();
-		initDebugDraw3DShader();
-		initDockDropOverlayShader();
-		initDummyShader();
-
-		SAMPLER_STATE_DESC ssDesc;
-		ssDesc.magFilter = FO_POINT;
-		ssDesc.minFilter = FO_POINT;
-		ssDesc.mipFilter = FO_POINT;
-
-		mGUISamplerState = SamplerState::create(ssDesc);
-	}
-
-	void GLBuiltinMaterialFactory::shutDown()
-	{
-		mSpriteTextShader = nullptr;
-		mSpriteImageShader = nullptr;
-		mDebugDraw2DClipSpaceShader = nullptr;
-		mDebugDraw2DScreenSpaceShader = nullptr;
-		mDebugDraw3DShader = nullptr;
-		mDockDropOverlayShader = nullptr;
-		mDummyShader = nullptr;
-	}
-
-	const String& GLBuiltinMaterialFactory::getSupportedRenderSystem() const
-	{
-		static String renderSystem = "BansheeGLRenderSystem";
-
-		return renderSystem;
-	}
-
-	HMaterial GLBuiltinMaterialFactory::createSpriteTextMaterial() const
-	{
-		HMaterial newMaterial = Material::create(mSpriteTextShader);
-		newMaterial->setSamplerState("mainTexSamp", mGUISamplerState);
-
-		return newMaterial;
-	}
-
-	HMaterial GLBuiltinMaterialFactory::createSpriteImageMaterial() const
-	{
-		HMaterial newMaterial = Material::create(mSpriteImageShader);
-		newMaterial->setSamplerState("mainTexSamp", mGUISamplerState);
-
-		return newMaterial;
-	}
-
-	HMaterial GLBuiltinMaterialFactory::createDebugDraw2DClipSpaceMaterial() const
-	{
-		return Material::create(mDebugDraw2DClipSpaceShader);
-	}
-
-	HMaterial GLBuiltinMaterialFactory::createDebugDraw2DScreenSpaceMaterial() const
-	{
-		return Material::create(mDebugDraw2DScreenSpaceShader);
-	}
-
-	HMaterial GLBuiltinMaterialFactory::createDebugDraw3DMaterial() const
-	{
-		return Material::create(mDebugDraw3DShader);
-	}
-
-	HMaterial GLBuiltinMaterialFactory::createDockDropOverlayMaterial() const
-	{
-		return Material::create(mDockDropOverlayShader);
-	}
-
-	HMaterial GLBuiltinMaterialFactory::createDummyMaterial() const
-	{
-		return Material::create(mDummyShader);
-	}
-
-	void GLBuiltinMaterialFactory::initSpriteTextShader()
-	{
-		String vsCode = "#version 400\n							\
-						\
-						uniform float invViewportWidth;			\
-						uniform float invViewportHeight;		\
-						uniform mat4 worldTransform;			\
-						\
-						in vec3 bs_position;					\
-						in vec2 bs_texcoord0;					\
-						out vec2 texcoord0;						\
-						void main()							\
-						{																	\
-						vec4 tfrmdPos = worldTransform * vec4(bs_position.xy, 0, 1);		\
-						\
-						float tfrmdX = -1.0f + (tfrmdPos.x * invViewportWidth);				\
-						float tfrmdY = 1.0f - (tfrmdPos.y * invViewportHeight);				\
-						\
-						gl_Position = vec4(tfrmdX, tfrmdY, 0, 1);							\
-						texcoord0 = bs_texcoord0;											\
-						}																	\
-						";
-
-		String psCode = "#version 400\n										\
-																			\
-						uniform sampler2D mainTexture;						\
-						uniform vec4 tint;									\
-						in vec2 texcoord0;									\
-						out vec4 fragColor;									\
-																			\
-						void main()											\
-						{													\
-						vec4 color = vec4(tint.rgb, texture2D(mainTexture, texcoord0.st).r * tint.a);	\
-						fragColor = color;									\
-						}";
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "main", "glsl", GPT_VERTEX_PROGRAM, GPP_VS_4_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "main", "glsl", GPT_FRAGMENT_PROGRAM, GPP_PS_4_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mSpriteTextShader = Shader::create("TextSpriteShader");
-
-		mSpriteTextShader->addParameter("worldTransform", "worldTransform", GPDT_MATRIX_4X4);
-		mSpriteTextShader->addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
-		mSpriteTextShader->addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
-		mSpriteTextShader->addParameter("tint", "tint", GPDT_FLOAT4);
-		mSpriteTextShader->addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
-		mSpriteTextShader->addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
-
-		TechniquePtr newTechnique = mSpriteTextShader->addTechnique("GLRenderSystem", RendererManager::getCoreRendererName()); 
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-		desc.renderTargetDesc[0].renderTargetWriteMask = 0x7; // Don't write to alpha
-
-		HBlendState blendState = BlendState::create(desc);
-		newPass->setBlendState(blendState);
-
-		DEPTH_STENCIL_STATE_DESC depthStateDesc;
-		depthStateDesc.depthReadEnable = false;
-		depthStateDesc.depthWriteEnable = false;
-
-		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
-		newPass->setDepthStencilState(depthState);
-	}
-
-	void GLBuiltinMaterialFactory::initSpriteImageShader()
-	{
-		String vsCode = "#version 400\n							\
-						\
-						uniform float invViewportWidth;			\
-						uniform float invViewportHeight;		\
-						uniform mat4 worldTransform;			\
-						\
-						in vec3 bs_position;					\
-						in vec2 bs_texcoord0;					\
-						out vec2 texcoord0;						\
-						void main()							\
-						{																	\
-						vec4 tfrmdPos = worldTransform * vec4(bs_position.xy, 0, 1);		\
-						\
-						float tfrmdX = -1.0f + (tfrmdPos.x * invViewportWidth);				\
-						float tfrmdY = 1.0f - (tfrmdPos.y * invViewportHeight);				\
-						\
-						gl_Position = vec4(tfrmdX, tfrmdY, 0, 1);							\
-						texcoord0 = bs_texcoord0;											\
-						}																	\
-						";
-
-		String psCode = "#version 400\n										\
-						\
-						uniform sampler2D mainTexture;						\
-						uniform vec4 tint;									\
-						in vec2 texcoord0;									\
-						out vec4 fragColor;									\
-						\
-						void main()											\
-						{													\
-						vec4 color = texture2D(mainTexture, texcoord0.st);	\
-						fragColor = color * tint;							\
-						}";
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "main", "glsl", GPT_VERTEX_PROGRAM, GPP_VS_4_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "main", "glsl", GPT_FRAGMENT_PROGRAM, GPP_PS_4_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mSpriteImageShader = Shader::create("ImageSpriteShader");
-
-		mSpriteImageShader->addParameter("worldTransform", "worldTransform", GPDT_MATRIX_4X4);
-		mSpriteImageShader->addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
-		mSpriteImageShader->addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
-		mSpriteImageShader->addParameter("tint", "tint", GPDT_FLOAT4);
-		mSpriteImageShader->addParameter("mainTexSamp", "mainTexture", GPOT_SAMPLER2D);
-		mSpriteImageShader->addParameter("mainTexture", "mainTexture", GPOT_TEXTURE2D);
-
-		TechniquePtr newTechnique = mSpriteImageShader->addTechnique("GLRenderSystem", RendererManager::getCoreRendererName()); 
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-		desc.renderTargetDesc[0].renderTargetWriteMask = 0x7; // Don't write to alpha
-
-		HBlendState blendState = BlendState::create(desc);
-		newPass->setBlendState(blendState);
-
-		DEPTH_STENCIL_STATE_DESC depthStateDesc;
-		depthStateDesc.depthReadEnable = false;
-		depthStateDesc.depthWriteEnable = false;
-
-		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
-		newPass->setDepthStencilState(depthState);
-	}
-
-	void GLBuiltinMaterialFactory::initDebugDraw2DClipSpaceShader()
-	{
-		String vsCode = "#version 400\n								\
-																	\
-						in vec2 bs_position;						\
-						in vec4 bs_color0;							\
-						out vec4 color0;							\
-																	\
-						void main()									\
-						{											\
-						gl_Position = vec4(bs_position.xy, 0, 1);	\
-						color0 = bs_color0;							\
-						}";
-
-		String psCode = "#version 400\n						\
-															\
-						in vec4 color0;						\
-						out vec4 fragColor;					\
-															\
-						void main()							\
-						{									\
-						fragColor = color0;					\
-						}";
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "glsl", GPT_VERTEX_PROGRAM, GPP_VS_4_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "ps_main", "glsl", GPT_FRAGMENT_PROGRAM, GPP_PS_4_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mDebugDraw2DClipSpaceShader = Shader::create("DebugDraw2DClipSpaceShader");
-
-		TechniquePtr newTechnique = mDebugDraw2DClipSpaceShader->addTechnique("GLRenderSystem", RendererManager::getCoreRendererName()); 
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-
-		HBlendState blendState = BlendState::create(desc);
-		newPass->setBlendState(blendState);
-
-		DEPTH_STENCIL_STATE_DESC depthStateDesc;
-		depthStateDesc.depthReadEnable = false;
-		depthStateDesc.depthWriteEnable = false;
-
-		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
-		newPass->setDepthStencilState(depthState);
-	}
-
-	void GLBuiltinMaterialFactory::initDebugDraw2DScreenSpaceShader()
-	{
-		String vsCode = "#version 400\n								\
-																	\
-						uniform float invViewportWidth;				\
-						uniform float invViewportHeight;			\
-																	\
-						in vec2 bs_position;						\
-						in vec4 bs_color0;							\
-						out vec4 color0;							\
-																	\
-						void main()									\
-						{											\
-						float tfrmdX = -1.0f + (bs_position.x * invViewportWidth);				\
-						float tfrmdY = 1.0f - (bs_position.y * invViewportHeight);				\
-																	\
-						gl_Position = vec4(tfrmdX, tfrmdY, 0, 1);	\
-						color0 = bs_color0;							\
-						}";
-
-		String psCode = "#version 400\n						\
-															\
-						in vec4 color0;						\
-						out vec4 fragColor;					\
-															\
-						void main()							\
-						{									\
-						fragColor = color0;					\
-						}";
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "glsl", GPT_VERTEX_PROGRAM, GPP_VS_4_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "ps_main", "glsl", GPT_FRAGMENT_PROGRAM, GPP_PS_4_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mDebugDraw2DScreenSpaceShader = Shader::create("DebugDraw2DScreenSpaceShader");
-
-		mDebugDraw2DScreenSpaceShader->addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
-		mDebugDraw2DScreenSpaceShader->addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
-
-		TechniquePtr newTechnique = mDebugDraw2DScreenSpaceShader->addTechnique("GLRenderSystem", RendererManager::getCoreRendererName()); 
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-
-		HBlendState blendState = BlendState::create(desc);
-		newPass->setBlendState(blendState);
-
-		DEPTH_STENCIL_STATE_DESC depthStateDesc;
-		depthStateDesc.depthReadEnable = false;
-		depthStateDesc.depthWriteEnable = false;
-
-		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
-		newPass->setDepthStencilState(depthState);
-	}
-
-	void GLBuiltinMaterialFactory::initDebugDraw3DShader()
-	{
-		String vsCode = "#version 400\n								\
-																	\
-						uniform mat4 matViewProj;						\
-																	\
-						in vec3 bs_position;						\
-						in vec4 bs_color0;							\
-						out vec4 color0;							\
-																	\
-						void main()									\
-						{											\
-						gl_Position = matViewProj * vec4(bs_position.xyz, 1);		\
-						color0 = bs_color0;							\
-						}";
-
-		String psCode = "#version 400\n						\
-															\
-						in vec4 color0;						\
-						out vec4 fragColor;					\
-															\
-						void main()							\
-						{									\
-						fragColor = color0;					\
-						}";
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "glsl", GPT_VERTEX_PROGRAM, GPP_VS_4_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "ps_main", "glsl", GPT_FRAGMENT_PROGRAM, GPP_PS_4_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mDebugDraw3DShader = Shader::create("DebugDraw3DShader");
-
-		mDebugDraw3DShader->addParameter("matViewProj", "matViewProj", GPDT_MATRIX_4X4);
-
-		TechniquePtr newTechnique = mDebugDraw3DShader->addTechnique("GLRenderSystem", RendererManager::getCoreRendererName()); 
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-
-		HBlendState blendState = BlendState::create(desc);
-		newPass->setBlendState(blendState);
-	}
-
-	void GLBuiltinMaterialFactory::initDockDropOverlayShader()
-	{
-		String vsCode = "#version 400\n								\
-						\
-						uniform float invViewportWidth;				\
-						uniform float invViewportHeight;			\
-						\
-						uniform vec4 tintColor;						\
-						uniform vec4 highlightColor;				\
-						uniform vec4 highlightActive;				\
-						\
-						in vec2 bs_position;						\
-						in vec4 bs_color0;							\
-						out vec4 color0;							\
-						\
-						void main()									\
-						{											\
-						float tfrmdX = -1.0f + (bs_position.x * invViewportWidth);				\
-						float tfrmdY = 1.0f - (bs_position.y * invViewportHeight);				\
-						\
-						gl_Position = vec4(tfrmdX, tfrmdY, 0, 1);	\
-						\
-						vec4 highlight = highlightActive * bs_color0;			\
-						float highlightSum = highlight.x + highlight.y +		\
-						highlight.z + highlight.w;								\
-						\
-						color0 = (1.0f - highlightSum) * tintColor +			\
-						highlightSum * highlightColor;							\
-						}";
-
-		String psCode = "#version 400\n						\
-						\
-						in vec4 color0;						\
-						out vec4 fragColor;					\
-						\
-						void main()							\
-						{									\
-						fragColor = color0;					\
-						}";
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "glsl", GPT_VERTEX_PROGRAM, GPP_VS_4_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "ps_main", "glsl", GPT_FRAGMENT_PROGRAM, GPP_PS_4_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mDockDropOverlayShader = Shader::create("DockDropOverlayShader");
-
-		mDockDropOverlayShader->addParameter("invViewportWidth", "invViewportWidth", GPDT_FLOAT1);
-		mDockDropOverlayShader->addParameter("invViewportHeight", "invViewportHeight", GPDT_FLOAT1);
-
-		mDockDropOverlayShader->addParameter("tintColor", "tintColor", GPDT_FLOAT4);
-		mDockDropOverlayShader->addParameter("highlightColor", "highlightColor", GPDT_FLOAT4);
-		mDockDropOverlayShader->addParameter("highlightActive", "highlightActive", GPDT_FLOAT4);
-
-		TechniquePtr newTechnique = mDockDropOverlayShader->addTechnique("GLRenderSystem", RendererManager::getCoreRendererName()); 
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-
-		BLEND_STATE_DESC desc;
-		desc.renderTargetDesc[0].blendEnable = true;
-		desc.renderTargetDesc[0].srcBlend = BF_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].dstBlend = BF_INV_SOURCE_ALPHA;
-		desc.renderTargetDesc[0].blendOp = BO_ADD;
-
-		HBlendState blendState = BlendState::create(desc);
-		newPass->setBlendState(blendState);
-
-		DEPTH_STENCIL_STATE_DESC depthStateDesc;
-		depthStateDesc.depthReadEnable = false;
-		depthStateDesc.depthWriteEnable = false;
-
-		HDepthStencilState depthState = DepthStencilState::create(depthStateDesc);
-		newPass->setDepthStencilState(depthState);
-	}
-
-void GLBuiltinMaterialFactory::initDummyShader()
-	{
-		String vsCode = "#version 400\n								\
-																	\
-						uniform mat4 matWorldViewProj;				\
-																	\
-						in vec3 bs_position;						\
-																	\
-						void main()									\
-						{											\
-							gl_Position = matWorldViewProj * vec4(bs_position.xyz, 1);		\
-						}";
-
-		String psCode = "#version 400\n						\
-															\
-						out vec4 fragColor;					\
-															\
-						void main()							\
-						{									\
-							fragColor = vec4(0.5f, 0.5f, 0.5f, 0.5f); \
-						}";
-
-		HGpuProgram vsProgram = GpuProgram::create(vsCode, "vs_main", "glsl", GPT_VERTEX_PROGRAM, GPP_VS_4_0);
-		HGpuProgram psProgram = GpuProgram::create(psCode, "ps_main", "glsl", GPT_FRAGMENT_PROGRAM, GPP_PS_4_0);
-
-		vsProgram.synchronize();
-		psProgram.synchronize();
-
-		mDummyShader = Shader::create("DummyShader");
-
-		mDummyShader->addParameter("matWorldViewProj", "matWorldViewProj", GPDT_MATRIX_4X4);
-
-		TechniquePtr newTechnique = mDummyShader->addTechnique("GLRenderSystem", RendererManager::getCoreRendererName());
-		PassPtr newPass = newTechnique->addPass();
-		newPass->setVertexProgram(vsProgram);
-		newPass->setFragmentProgram(psProgram);
-	}
-}

+ 15 - 3
BansheeEngine/Source/BsGUIMaterialManager.cpp

@@ -1,11 +1,21 @@
 #include "BsGUIMaterialManager.h"
 #include "BsMaterial.h"
+#include "BsSamplerState.h"
 #include "BsDebug.h"
-#include "BsBuiltinMaterialManager.h"
+#include "BsBuiltinResources.h"
 #include "BsColor.h"
 
 namespace BansheeEngine
 {
+	GUIMaterialManager::GUIMaterialManager()
+	{
+		SAMPLER_STATE_DESC ssDesc;
+		ssDesc.magFilter = FO_POINT;
+		ssDesc.minFilter = FO_POINT;
+		ssDesc.mipFilter = FO_POINT;

+		mGUISamplerState = SamplerState::create(ssDesc);
+	}
+
 	const GUIMaterialInfo& GUIMaterialManager::requestTextMaterial(const HTexture& texture, const Color& tint) const
 	{
 		Vector4 vecColor(tint.r, tint.g, tint.b, tint.a);
@@ -17,8 +27,9 @@ namespace BansheeEngine
 		mTextMaterials.push_back(GUIMaterial());
 
 		GUIMaterial& guiMat = mTextMaterials[mTextMaterials.size() - 1];
-		guiMat.handle = BuiltinMaterialManager::instance().createSpriteTextMaterial();
+		guiMat.handle = BuiltinResources::instance().createSpriteTextMaterial();
 
+		guiMat.handle.mainTexSampler.set(mGUISamplerState);
 		guiMat.handle.mainTexture.set(texture);
 		guiMat.handle.tint.set(vecColor);
 		guiMat.refCount = 1;		
@@ -37,8 +48,9 @@ namespace BansheeEngine
 		mImageMaterials.push_back(GUIMaterial());
 
 		GUIMaterial& guiMat = mImageMaterials[mImageMaterials.size() - 1];
-		guiMat.handle = BuiltinMaterialManager::instance().createSpriteImageMaterial();
+		guiMat.handle = BuiltinResources::instance().createSpriteImageMaterial();
 
+		guiMat.handle.mainTexSampler.set(mGUISamplerState);
 		guiMat.handle.mainTexture.set(texture);
 		guiMat.handle.tint.set(vecColor);
 		guiMat.refCount = 1;		

+ 3 - 3
BansheeEngine/Source/BsGUITexture.cpp

@@ -123,7 +123,7 @@ namespace BansheeEngine
 
 		float optimalWidth = 0.0f;
 		float optimalHeight = 0.0f;
-		if(mActiveTexture != nullptr && mActiveTexture.isLoaded())
+		if (SpriteTexture::checkIsLoaded(mActiveTexture))
 		{
 			mDesc.texture = mActiveTexture.getInternalPtr();
 			optimalWidth = (float)mDesc.texture->getTexture()->getWidth();
@@ -193,7 +193,7 @@ namespace BansheeEngine
 			optimalSize.x = _getLayoutOptions().width;
 		else
 		{
-			if(mActiveTexture != nullptr && mActiveTexture.isLoaded())
+			if (SpriteTexture::checkIsLoaded(mActiveTexture))
 				optimalSize.x = mActiveTexture->getTexture()->getWidth();
 			else
 				optimalSize.x = _getLayoutOptions().maxWidth;
@@ -203,7 +203,7 @@ namespace BansheeEngine
 			optimalSize.y = _getLayoutOptions().height;
 		else
 		{
-			if(mActiveTexture != nullptr && mActiveTexture.isLoaded())
+			if (SpriteTexture::checkIsLoaded(mActiveTexture))
 				optimalSize.y = mActiveTexture->getTexture()->getHeight();
 			else
 				optimalSize.y = _getLayoutOptions().maxHeight;

+ 2 - 2
BansheeEngine/Source/BsRenderable.cpp

@@ -1,7 +1,7 @@
 #include "BsRenderable.h"
 #include "BsRenderableRTTI.h"
 #include "BsSceneObject.h"
-#include "BsBuiltinMaterialManager.h"
+#include "BsBuiltinResources.h"
 #include "BsMesh.h"
 #include "BsMaterial.h"
 #include "BsRenderQueue.h"
@@ -146,7 +146,7 @@ namespace BansheeEngine
 				material = mMaterialData[0].material;
 
 			if (material == nullptr || !material.isLoaded())
-				material = BuiltinMaterialManager::instance().createDummyMaterial();
+				material = BuiltinResources::instance().createDummyMaterial();
 
 			if (material->_isCoreDirty(MaterialDirtyFlag::Proxy))
 			{

+ 53 - 2
BansheeGLRenderSystem/Source/GLSL/src/BsGLSLGpuProgram.cpp

@@ -113,9 +113,60 @@ namespace BansheeEngine
 		// Add preprocessor extras and main source
 		if (!mSource.empty())
 		{
-			const char *source = mSource.c_str();
-			mGLHandle = glCreateShaderProgramv(shaderType, 1, &source);
+			Vector<GLchar*> lines;
+
+			UINT32 lineLength = 0;
+			for (UINT32 i = 0; i < mSource.size(); i++)
+			{
+				if (mSource[i] == '\n' || mSource[i] == '\r')
+				{
+					if (lineLength > 0)
+					{
+						assert(sizeof(mSource[i]) == sizeof(GLchar));
+
+						bool isDefine = mSource[i - lineLength] == '#';
+
+						GLchar* lineData = (GLchar*)stackAlloc(sizeof(GLchar) * (lineLength + 1 + (isDefine ? 1 : 0)));
+						memcpy(lineData, &mSource[i - lineLength], sizeof(GLchar) * lineLength);
+
+						if (isDefine) // Defines require a newline as well as a null terminator, otherwise it doesn't compile properly
+						{
+							lineData[lineLength] = '\n';
+							lineData[lineLength + 1] = '\0';
+						}
+						else
+							lineData[lineLength] = '\0';
+
+						lines.push_back(lineData);
+						lineLength = 0;
+					}
+				}
+				else
+				{
+					lineLength++;
+				}
+			}
+
+			if (lineLength > 0)
+			{
+				UINT32 end = (UINT32)mSource.size() - 1;
+				assert(sizeof(mSource[end]) == sizeof(GLchar));
+
+				GLchar* lineData = (GLchar*)stackAlloc(sizeof(GLchar) * (lineLength + 1));
+				memcpy(lineData, &mSource[mSource.size() - lineLength], sizeof(GLchar) * lineLength);
+				lineData[lineLength] = '\0';
+
+				lines.push_back(lineData);
+				lineLength = 0;
+			}
+
+			mGLHandle = glCreateShaderProgramv(shaderType, (GLsizei)lines.size(), (const GLchar**)lines.data());
 			
+			for (auto iter = lines.rbegin(); iter != lines.rend(); ++iter)
+			{
+				stackDeallocLast(*iter);
+			}
+
 			mCompileError = "";
 			mIsCompiled = !checkForGLSLError(mGLHandle, mCompileError);
 		}

+ 1 - 1
BansheeUtility/Include/BsFileSystem.h

@@ -37,7 +37,7 @@ namespace BansheeEngine
 		 * @brief	Deletes a file or a folder at the specified path.
 		 *
 		 * @param	fullPath   	Full path to a file or a folder..
-		 * @param	recursively	(optional) If true, non-empty folders will have their contents
+		 * @param	recursively	(optional) If true, folders will have their contents
 		 * 						deleted as well. Otherwise an exception will be
 		 * 						thrown for non-empty folders.
 		 */

+ 32 - 0
BansheeUtility/Include/BsRTTIType.h

@@ -51,6 +51,12 @@ namespace BansheeEngine
 		 */
 		virtual RTTITypeBase* getBaseClass() = 0;
 
+		/**
+		 * @brief	Returns true if current RTTI class is derived from "base".
+		 * 			(Or if it is the same type as base)
+		 */
+		virtual bool isDerivedFrom(RTTITypeBase* base) = 0;
+
 		/**
 		 * @brief	Internal method. Called by the RTTI system when a class is first found in
 		 *			order to form child/parent class hierarchy.
@@ -584,6 +590,32 @@ namespace BansheeEngine
 			return GetRTTIType<BaseType>()();
 		}
 
+		/**
+		 * @copydoc	RTTITypeBase::isDerivedFrom
+		 */
+		bool RTTITypeBase::isDerivedFrom(RTTITypeBase* base)
+		{
+			assert(base != nullptr);
+
+			Stack<RTTITypeBase*> todo;
+			todo.push(base);
+
+			while (!todo.empty())
+			{
+				RTTITypeBase* currentType = todo.top();
+				todo.pop();
+
+				if (currentType->getRTTIId() == getRTTIId())
+					return true;
+
+				Vector<RTTITypeBase*>& derivedClasses = currentType->getDerivedClasses();
+				for (auto iter = derivedClasses.begin(); iter != derivedClasses.end(); ++iter)
+					todo.push(*iter);
+			}
+
+			return false;
+		}
+
 		/**
 		 * @copydoc	RTTITypeBase::_registerDerivedClass
 		 */

+ 1 - 19
BansheeUtility/Source/BsIReflectable.cpp

@@ -59,25 +59,7 @@ namespace BansheeEngine
 
 	bool IReflectable::isDerivedFrom(RTTITypeBase* base)
 	{
-		assert(base != nullptr);
-
-		Stack<RTTITypeBase*> todo;
-		todo.push(base);
-
-		while (!todo.empty())
-		{
-			RTTITypeBase* currentType = todo.top();
-			todo.pop();
-
-			if(currentType->getRTTIId() == getRTTI()->getRTTIId())
-				return true;
-
-			Vector<RTTITypeBase*>& derivedClasses = currentType->getDerivedClasses();
-			for(auto iter = derivedClasses.begin(); iter != derivedClasses.end(); ++iter)
-				todo.push(*iter);
-		}
-
-		return false;
+		return getRTTI()->isDerivedFrom(base);
 	}
 
 	UINT32 IReflectable::getTypeId() const

+ 1 - 1
BansheeUtility/Source/Win32/BsFileSystem.cpp

@@ -394,7 +394,7 @@ namespace BansheeEngine
 				{
 					Path fullPath = dirPath;
 					if ((findData.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) != 0)
-						directories.push_back(fullPath.append(tempName));
+						directories.push_back(fullPath.append(tempName + L"/"));
 					else
 						files.push_back(fullPath.append(tempName));
 				}

+ 17 - 17
SBansheeEditor/Source/BsGUIGameObjectField.cpp

@@ -15,7 +15,7 @@
 #include "BsSceneObject.h"
 #include "BsManagedComponent.h"
 #include "BsMonoManager.h"
-#include "BsEditorGUI.h"
+#include "BsBuiltinEditorResources.h"
 
 using namespace std::placeholders;
 
@@ -31,12 +31,12 @@ namespace BansheeEngine
 
 		if(withLabel)
 		{
-			mLabel = GUILabel::create(labelContent, GUIOptions(GUIOption::fixedWidth(labelWidth)), getSubStyleName(EditorGUI::ObjectFieldLabelStyleName));
+			mLabel = GUILabel::create(labelContent, GUIOptions(GUIOption::fixedWidth(labelWidth)), getSubStyleName(BuiltinEditorResources::ObjectFieldLabelStyleName));
 			mLayout->addElement(mLabel);
 		}
 
-		mDropButton = GUIDropButton::create((UINT32)DragAndDropType::SceneObject, GUIOptions(GUIOption::flexibleWidth()), getSubStyleName(EditorGUI::ObjectFieldDropBtnStyleName));
-		mClearButton = GUIButton::create(HString(L""), getSubStyleName(EditorGUI::ObjectFieldClearBtnStyleName));
+		mDropButton = GUIDropButton::create((UINT32)DragAndDropType::SceneObject, GUIOptions(GUIOption::flexibleWidth()), getSubStyleName(BuiltinEditorResources::ObjectFieldDropBtnStyleName));
+		mClearButton = GUIButton::create(HString(L""), getSubStyleName(BuiltinEditorResources::ObjectFieldClearBtnStyleName));
 		mClearButton->onClick.connect(std::bind(&GUIGameObjectField::onClearButtonClicked, this));
 
 		mLayout->addElement(mDropButton);
@@ -55,7 +55,7 @@ namespace BansheeEngine
 	{
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
-			curStyle = &EditorGUI::ObjectFieldStyleName;
+			curStyle = &BuiltinEditorResources::ObjectFieldStyleName;
 
 		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), typeNamespace, type, labelContent, labelWidth, *curStyle,
 			GUILayoutOptions::create(layoutOptions), true);
@@ -66,7 +66,7 @@ namespace BansheeEngine
 	{
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
-			curStyle = &EditorGUI::ObjectFieldStyleName;
+			curStyle = &BuiltinEditorResources::ObjectFieldStyleName;
 
 		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), typeNamespace, type, labelContent, DEFAULT_LABEL_WIDTH, *curStyle,
 			GUILayoutOptions::create(layoutOptions), true);
@@ -77,7 +77,7 @@ namespace BansheeEngine
 	{
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
-			curStyle = &EditorGUI::ObjectFieldStyleName;
+			curStyle = &BuiltinEditorResources::ObjectFieldStyleName;
 
 		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(labelText), labelWidth, *curStyle,
 			GUILayoutOptions::create(layoutOptions), true);
@@ -88,7 +88,7 @@ namespace BansheeEngine
 	{
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
-			curStyle = &EditorGUI::ObjectFieldStyleName;
+			curStyle = &BuiltinEditorResources::ObjectFieldStyleName;
 
 		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(labelText), DEFAULT_LABEL_WIDTH, *curStyle,
 			GUILayoutOptions::create(layoutOptions), true);
@@ -98,7 +98,7 @@ namespace BansheeEngine
 	{
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
-			curStyle = &EditorGUI::ObjectFieldStyleName;
+			curStyle = &BuiltinEditorResources::ObjectFieldStyleName;
 
 		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(), 0, *curStyle,
 			GUILayoutOptions::create(layoutOptions), false);
@@ -109,7 +109,7 @@ namespace BansheeEngine
 	{
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
-			curStyle = &EditorGUI::ObjectFieldStyleName;
+			curStyle = &BuiltinEditorResources::ObjectFieldStyleName;
 
 		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), typeNamespace, type, labelContent, labelWidth, *curStyle,
 			GUILayoutOptions::create(), true);
@@ -120,7 +120,7 @@ namespace BansheeEngine
 	{
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
-			curStyle = &EditorGUI::ObjectFieldStyleName;
+			curStyle = &BuiltinEditorResources::ObjectFieldStyleName;
 
 		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), typeNamespace, type, labelContent, DEFAULT_LABEL_WIDTH, *curStyle,
 			GUILayoutOptions::create(), true);
@@ -131,7 +131,7 @@ namespace BansheeEngine
 	{
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
-			curStyle = &EditorGUI::ObjectFieldStyleName;
+			curStyle = &BuiltinEditorResources::ObjectFieldStyleName;
 
 		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(labelText), labelWidth, *curStyle,
 			GUILayoutOptions::create(), true);
@@ -142,7 +142,7 @@ namespace BansheeEngine
 	{
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
-			curStyle = &EditorGUI::ObjectFieldStyleName;
+			curStyle = &BuiltinEditorResources::ObjectFieldStyleName;
 
 		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(labelText), DEFAULT_LABEL_WIDTH, *curStyle,
 			GUILayoutOptions::create(), true);
@@ -152,7 +152,7 @@ namespace BansheeEngine
 	{
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
-			curStyle = &EditorGUI::ObjectFieldStyleName;
+			curStyle = &BuiltinEditorResources::ObjectFieldStyleName;
 
 		return bs_new<GUIGameObjectField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(), 0, *curStyle,
 			GUILayoutOptions::create(), false);
@@ -240,10 +240,10 @@ namespace BansheeEngine
 	void GUIGameObjectField::styleUpdated()
 	{
 		if (mLabel != nullptr)
-			mLabel->setStyle(getSubStyleName(EditorGUI::ObjectFieldLabelStyleName));
+			mLabel->setStyle(getSubStyleName(BuiltinEditorResources::ObjectFieldLabelStyleName));
 
-		mDropButton->setStyle(getSubStyleName(EditorGUI::ObjectFieldDropBtnStyleName));
-		mClearButton->setStyle(getSubStyleName(EditorGUI::ObjectFieldClearBtnStyleName));
+		mDropButton->setStyle(getSubStyleName(BuiltinEditorResources::ObjectFieldDropBtnStyleName));
+		mClearButton->setStyle(getSubStyleName(BuiltinEditorResources::ObjectFieldClearBtnStyleName));
 	}
 
 	void GUIGameObjectField::onClearButtonClicked()

+ 17 - 17
SBansheeEditor/Source/BsGUIResourceField.cpp

@@ -17,7 +17,7 @@
 #include "BsProjectLibrary.h"
 #include "BsProjectResourceMeta.h"
 #include "BsManagedResourceMetaData.h"
-#include "BsEditorGUI.h"
+#include "BsBuiltinEditorResources.h"
 
 using namespace std::placeholders;
 
@@ -33,12 +33,12 @@ namespace BansheeEngine
 
 		if (withLabel)
 		{
-			mLabel = GUILabel::create(labelContent, GUIOptions(GUIOption::fixedWidth(labelWidth)), getSubStyleName(EditorGUI::ObjectFieldLabelStyleName));
+			mLabel = GUILabel::create(labelContent, GUIOptions(GUIOption::fixedWidth(labelWidth)), getSubStyleName(BuiltinEditorResources::ObjectFieldLabelStyleName));
 			mLayout->addElement(mLabel);
 		}
 
-		mDropButton = GUIDropButton::create((UINT32)DragAndDropType::Resources, GUIOptions(GUIOption::flexibleWidth()), getSubStyleName(EditorGUI::ObjectFieldDropBtnStyleName));
-		mClearButton = GUIButton::create(HString(L""), getSubStyleName(EditorGUI::ObjectFieldClearBtnStyleName));
+		mDropButton = GUIDropButton::create((UINT32)DragAndDropType::Resources, GUIOptions(GUIOption::flexibleWidth()), getSubStyleName(BuiltinEditorResources::ObjectFieldDropBtnStyleName));
+		mClearButton = GUIButton::create(HString(L""), getSubStyleName(BuiltinEditorResources::ObjectFieldClearBtnStyleName));
 		mClearButton->onClick.connect(std::bind(&GUIResourceField::onClearButtonClicked, this));
 
 		mLayout->addElement(mDropButton);
@@ -57,7 +57,7 @@ namespace BansheeEngine
 	{
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
-			curStyle = &EditorGUI::ObjectFieldStyleName;
+			curStyle = &BuiltinEditorResources::ObjectFieldStyleName;
 
 		return bs_new<GUIResourceField>(PrivatelyConstruct(), typeNamespace, type, labelContent, labelWidth, *curStyle,
 			GUILayoutOptions::create(layoutOptions), true);
@@ -68,7 +68,7 @@ namespace BansheeEngine
 	{
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
-			curStyle = &EditorGUI::ObjectFieldStyleName;
+			curStyle = &BuiltinEditorResources::ObjectFieldStyleName;
 
 		return bs_new<GUIResourceField>(PrivatelyConstruct(), typeNamespace, type, labelContent, DEFAULT_LABEL_WIDTH, *curStyle,
 			GUILayoutOptions::create(layoutOptions), true);
@@ -79,7 +79,7 @@ namespace BansheeEngine
 	{
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
-			curStyle = &EditorGUI::ObjectFieldStyleName;
+			curStyle = &BuiltinEditorResources::ObjectFieldStyleName;
 
 		return bs_new<GUIResourceField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(labelText), labelWidth, *curStyle,
 			GUILayoutOptions::create(layoutOptions), true);
@@ -90,7 +90,7 @@ namespace BansheeEngine
 	{
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
-			curStyle = &EditorGUI::ObjectFieldStyleName;
+			curStyle = &BuiltinEditorResources::ObjectFieldStyleName;
 
 		return bs_new<GUIResourceField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(labelText), DEFAULT_LABEL_WIDTH, *curStyle,
 			GUILayoutOptions::create(layoutOptions), true);
@@ -100,7 +100,7 @@ namespace BansheeEngine
 	{
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
-			curStyle = &EditorGUI::ObjectFieldStyleName;
+			curStyle = &BuiltinEditorResources::ObjectFieldStyleName;
 
 		return bs_new<GUIResourceField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(), 0, *curStyle,
 			GUILayoutOptions::create(layoutOptions), false);
@@ -111,7 +111,7 @@ namespace BansheeEngine
 	{
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
-			curStyle = &EditorGUI::ObjectFieldStyleName;
+			curStyle = &BuiltinEditorResources::ObjectFieldStyleName;
 
 		return bs_new<GUIResourceField>(PrivatelyConstruct(), typeNamespace, type, labelContent, labelWidth, *curStyle,
 			GUILayoutOptions::create(), true);
@@ -122,7 +122,7 @@ namespace BansheeEngine
 	{
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
-			curStyle = &EditorGUI::ObjectFieldStyleName;
+			curStyle = &BuiltinEditorResources::ObjectFieldStyleName;
 
 		return bs_new<GUIResourceField>(PrivatelyConstruct(), typeNamespace, type, labelContent, DEFAULT_LABEL_WIDTH, *curStyle,
 			GUILayoutOptions::create(), true);
@@ -133,7 +133,7 @@ namespace BansheeEngine
 	{
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
-			curStyle = &EditorGUI::ObjectFieldStyleName;
+			curStyle = &BuiltinEditorResources::ObjectFieldStyleName;
 
 		return bs_new<GUIResourceField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(labelText), labelWidth, *curStyle,
 			GUILayoutOptions::create(), true);
@@ -144,7 +144,7 @@ namespace BansheeEngine
 	{
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
-			curStyle = &EditorGUI::ObjectFieldStyleName;
+			curStyle = &BuiltinEditorResources::ObjectFieldStyleName;
 
 		return bs_new<GUIResourceField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(labelText), DEFAULT_LABEL_WIDTH, *curStyle,
 			GUILayoutOptions::create(), true);
@@ -154,7 +154,7 @@ namespace BansheeEngine
 	{
 		const String* curStyle = &style;
 		if (*curStyle == StringUtil::BLANK)
-			curStyle = &EditorGUI::ObjectFieldStyleName;
+			curStyle = &BuiltinEditorResources::ObjectFieldStyleName;
 
 		return bs_new<GUIResourceField>(PrivatelyConstruct(), typeNamespace, type, GUIContent(), 0, *curStyle,
 			GUILayoutOptions::create(), false);
@@ -264,10 +264,10 @@ namespace BansheeEngine
 	void GUIResourceField::styleUpdated()
 	{
 		if (mLabel != nullptr)
-			mLabel->setStyle(getSubStyleName(EditorGUI::ObjectFieldLabelStyleName));
+			mLabel->setStyle(getSubStyleName(BuiltinEditorResources::ObjectFieldLabelStyleName));
 
-		mDropButton->setStyle(getSubStyleName(EditorGUI::ObjectFieldDropBtnStyleName));
-		mClearButton->setStyle(getSubStyleName(EditorGUI::ObjectFieldClearBtnStyleName));
+		mDropButton->setStyle(getSubStyleName(BuiltinEditorResources::ObjectFieldDropBtnStyleName));
+		mClearButton->setStyle(getSubStyleName(BuiltinEditorResources::ObjectFieldClearBtnStyleName));
 	}
 
 	void GUIResourceField::onClearButtonClicked()

+ 24 - 18
SceneView.txt

@@ -1,7 +1,29 @@
 
+TODO:
+ - Core thread gets stuck on shutdown when OpenGL is used...Somewhere in kernel
+
 Weekend:
+ - Set up grid material and hook it up to renderer (+ actually instantiate it in EditorApplication)
+ - Figure out how to load scene grid material in EditorResources
+   - Figure out in general how to deal with built-in resources
+   - e.g. meshes, textures and shaders. I need to import them then at runtime I should just load the engine version directly
+     - When in debug mode probably always reimport as a form of unit testing
+	 - Have two separate folders Resources/EditorRaw and Resources/Editor (similar for Engine)
+	 - Store a BuiltinResources asset which contains last import dates of the files
+	 - When EditorResources get started up check that file and check if EditorRaw version of the resource exists
+	   - If it does and is newer when import it and save it to Editor folder
+	 - Rename BuiltinResources to EngineResources?
+	 - Merge GUI resources in Editor/EngineResources?
+	   - Editor/EngineGUI can then just reference them when creating GUI styles
+   - Fix up all GUI builtin resources to use this approach 
+ - Rename EditorGUI to EditorBuildiNResources
+ - You can create a resource handle to invalid resource type. Add a security feature to prevent that, at least in debug mode?
+ - When unloading unused resources I should do it recursively so it unloads any new ones that might have been released during the first unload
+ - Ensure that resource handles only have a single mData (and fix Resources::unloadAllUnused)
+ - Add Scene grid shaders
+ - Move dock overlay from engine to editor builtin resources
+
  - Grid
- - RenderTarget refactor
  - Think about picking implementation and possibly Handles implementation
 
 TODO - Think about:
@@ -88,20 +110,4 @@ Need to allow the user to specify custom gizmos.
  - That method can then call above methods
  - Additionally in the attribute you can specify when is the gizmo displayed: Active, Selected, NotSelected, SelectedOrChild
  - And an option if gizmo can be picked or not
- - These methods will somehow automatically be registered with the GizmoSetups
-
------------------------------------------------------------------------
-RenderTarget (and in turn, Viewport) make data available to sim thread, even though that data can be arbitrarily modified from the core thread
-
-TODO:
- - Core thread gets stuck on shutdown when OpenGL is used...Somewhere in kernel
- - getProperties on non-core should just make a copy of core for now to check if everything works
- - Remove the debug stuff in RenderTarget when done testing
-
-
-Whenever a core object gets changed it should notify a RenderTargetManager, which will on beginning of every frame update
-non-core version with valid data.
- - Make sure core dirty properties are updated before render window manager events are triggered
-
-Viewport should return a ViewportProxy for use on core thread (instead of a clone as it has now)
- - The proxy will reference the *Core version of render target
+ - These methods will somehow automatically be registered with the GizmoSetups