Explorar el Código

Getting example project to work again
$ENGINE$ folder now exists even for shaders getting imported outside of editor

BearishSun hace 10 años
padre
commit
3bde7a79ec

+ 2 - 2
BansheeEditor/BansheeEditor.vcxproj

@@ -367,7 +367,7 @@
     <ClInclude Include="Include\BsSelectionRenderer.h" />
     <ClInclude Include="Include\BsSelectionRenderer.h" />
     <ClInclude Include="Include\BsSettings.h" />
     <ClInclude Include="Include\BsSettings.h" />
     <ClInclude Include="Include\BsSettingsRTTI.h" />
     <ClInclude Include="Include\BsSettingsRTTI.h" />
-    <ClInclude Include="Include\BsShaderIncludeHandler.h" />
+    <ClInclude Include="Include\BsEditorShaderIncludeHandler.h" />
     <ClInclude Include="Include\BsUndoRedo.h" />
     <ClInclude Include="Include\BsUndoRedo.h" />
     <ClInclude Include="Include\Win32\BsVSCodeEditor.h" />
     <ClInclude Include="Include\Win32\BsVSCodeEditor.h" />
   </ItemGroup>
   </ItemGroup>
@@ -443,7 +443,7 @@
     <ClCompile Include="Source\BsSelection.cpp" />
     <ClCompile Include="Source\BsSelection.cpp" />
     <ClCompile Include="Source\BsSelectionRenderer.cpp" />
     <ClCompile Include="Source\BsSelectionRenderer.cpp" />
     <ClCompile Include="Source\BsSettings.cpp" />
     <ClCompile Include="Source\BsSettings.cpp" />
-    <ClCompile Include="Source\BsShaderIncludeHandler.cpp" />
+    <ClCompile Include="Source\BsEditorShaderIncludeHandler.cpp" />
     <ClCompile Include="Source\BsUndoRedo.cpp" />
     <ClCompile Include="Source\BsUndoRedo.cpp" />
     <ClCompile Include="Source\BsEditorApplication.cpp" />
     <ClCompile Include="Source\BsEditorApplication.cpp" />
     <ClCompile Include="Source\Win32\BsVSCodeEditor.cpp" />
     <ClCompile Include="Source\Win32\BsVSCodeEditor.cpp" />

+ 6 - 6
BansheeEditor/BansheeEditor.vcxproj.filters

@@ -335,9 +335,6 @@
     <ClInclude Include="Include\BsUndoRedo.h">
     <ClInclude Include="Include\BsUndoRedo.h">
       <Filter>Header Files\UndoRedo</Filter>
       <Filter>Header Files\UndoRedo</Filter>
     </ClInclude>
     </ClInclude>
-    <ClInclude Include="Include\BsShaderIncludeHandler.h">
-      <Filter>Header Files\Library</Filter>
-    </ClInclude>
     <ClInclude Include="Include\BsEditorTestSuite.h">
     <ClInclude Include="Include\BsEditorTestSuite.h">
       <Filter>Header Files\Testing</Filter>
       <Filter>Header Files\Testing</Filter>
     </ClInclude>
     </ClInclude>
@@ -347,6 +344,9 @@
     <ClInclude Include="Include\BsEditorUtility.h">
     <ClInclude Include="Include\BsEditorUtility.h">
       <Filter>Header Files\Utility</Filter>
       <Filter>Header Files\Utility</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="Include\BsEditorShaderIncludeHandler.h">
+      <Filter>Header Files\Library</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\BsEditorCommand.cpp">
     <ClCompile Include="Source\BsEditorCommand.cpp">
@@ -562,9 +562,6 @@
     <ClCompile Include="Source\BsUndoRedo.cpp">
     <ClCompile Include="Source\BsUndoRedo.cpp">
       <Filter>Source Files\UndoRedo</Filter>
       <Filter>Source Files\UndoRedo</Filter>
     </ClCompile>
     </ClCompile>
-    <ClCompile Include="Source\BsShaderIncludeHandler.cpp">
-      <Filter>Source Files\Library</Filter>
-    </ClCompile>
     <ClCompile Include="Source\BsEditorTestSuite.cpp">
     <ClCompile Include="Source\BsEditorTestSuite.cpp">
       <Filter>Source Files\Testing</Filter>
       <Filter>Source Files\Testing</Filter>
     </ClCompile>
     </ClCompile>
@@ -574,5 +571,8 @@
     <ClCompile Include="Source\BsEditorUtility.cpp">
     <ClCompile Include="Source\BsEditorUtility.cpp">
       <Filter>Source Files\Utility</Filter>
       <Filter>Source Files\Utility</Filter>
     </ClCompile>
     </ClCompile>
+    <ClCompile Include="Source\BsEditorShaderIncludeHandler.cpp">
+      <Filter>Source Files\Library</Filter>
+    </ClCompile>
   </ItemGroup>
   </ItemGroup>
 </Project>
 </Project>

+ 4 - 10
BansheeEditor/Include/BsShaderIncludeHandler.h → BansheeEditor/Include/BsEditorShaderIncludeHandler.h

@@ -8,22 +8,16 @@
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
 	/**
 	/**
-	 * @brief	Shader include handler for the editor. It uses project library to find
-	 *			the includes, and supports special keywords for built-in includes that
-	 *			reside outside of the project library.
+	 * Shader include handler for the editor. It uses project library to find the includes, and supports special keywords 
+	 * for built-in includes that reside outside of the project library.
 	 */
 	 */
 	class BS_ED_EXPORT EditorShaderIncludeHandler : public IShaderIncludeHandler
 	class BS_ED_EXPORT EditorShaderIncludeHandler : public IShaderIncludeHandler
 	{
 	{
 	public:
 	public:
-		/**
-		 * @copydoc	IShaderIncludeHandler::findInclude
-		 */
+		/** @copydoc IShaderIncludeHandler::findInclude */
 		virtual HShaderInclude findInclude(const String& name) const override;
 		virtual HShaderInclude findInclude(const String& name) const override;
 
 
-		/**
-		 * @brief	Converts a shader include name or path to a path
-		 *			of the resource containing include data.
-		 */
+		/** Converts a shader include name or path to a path of the resource containing include data. */
 		static Path toResourcePath(const String& name);
 		static Path toResourcePath(const String& name);
 	};
 	};
 }
 }

+ 1 - 1
BansheeEditor/Source/BsEditorApplication.cpp

@@ -16,7 +16,7 @@
 #include "BsCodeEditor.h"
 #include "BsCodeEditor.h"
 #include "BsBuildManager.h"
 #include "BsBuildManager.h"
 #include "BsScriptCodeImporter.h"
 #include "BsScriptCodeImporter.h"
-#include "BsShaderIncludeHandler.h"
+#include "BsEditorShaderIncludeHandler.h"
 #include "BsDropDownWindowManager.h"
 #include "BsDropDownWindowManager.h"
 #include "BsProjectLibrary.h"
 #include "BsProjectLibrary.h"
 #include "BsProjectSettings.h"
 #include "BsProjectSettings.h"

+ 1 - 1
BansheeEditor/Source/BsShaderIncludeHandler.cpp → BansheeEditor/Source/BsEditorShaderIncludeHandler.cpp

@@ -1,6 +1,6 @@
 //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
 //********************************** Banshee Engine (www.banshee3d.com) **************************************************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
-#include "BsShaderIncludeHandler.h"
+#include "BsEditorShaderIncludeHandler.h"
 #include "BsProjectLibrary.h"
 #include "BsProjectLibrary.h"
 #include "BsResources.h"
 #include "BsResources.h"
 #include "BsProjectResourceMeta.h"
 #include "BsProjectResourceMeta.h"

+ 2 - 0
BansheeEngine/BansheeEngine.vcxproj

@@ -287,6 +287,7 @@
     <ClCompile Include="Source\BsLight.cpp" />
     <ClCompile Include="Source\BsLight.cpp" />
     <ClCompile Include="Source\BsGameSettings.cpp" />
     <ClCompile Include="Source\BsGameSettings.cpp" />
     <ClCompile Include="Source\BsPaths.cpp" />
     <ClCompile Include="Source\BsPaths.cpp" />
+    <ClCompile Include="Source\BsEngineShaderIncludeHandler.cpp" />
     <ClInclude Include="Include\BsApplication.h" />
     <ClInclude Include="Include\BsApplication.h" />
     <ClInclude Include="Include\BsCamera.h" />
     <ClInclude Include="Include\BsCamera.h" />
     <ClInclude Include="Include\BsCameraRTTI.h" />
     <ClInclude Include="Include\BsCameraRTTI.h" />
@@ -294,6 +295,7 @@
     <ClInclude Include="Include\BsCursor.h" />
     <ClInclude Include="Include\BsCursor.h" />
     <ClInclude Include="Include\BsDrawHelper.h" />
     <ClInclude Include="Include\BsDrawHelper.h" />
     <ClInclude Include="Include\BsDropDownAreaPlacement.h" />
     <ClInclude Include="Include\BsDropDownAreaPlacement.h" />
+    <ClInclude Include="Include\BsEngineShaderIncludeHandler.h" />
     <ClInclude Include="Include\BsGameSettings.h" />
     <ClInclude Include="Include\BsGameSettings.h" />
     <ClInclude Include="Include\BsGameSettingsRTTI.h" />
     <ClInclude Include="Include\BsGameSettingsRTTI.h" />
     <ClInclude Include="Include\BsGUIDropDownContent.h" />
     <ClInclude Include="Include\BsGUIDropDownContent.h" />

+ 6 - 0
BansheeEngine/BansheeEngine.vcxproj.filters

@@ -401,6 +401,9 @@
     <ClInclude Include="Include\BsRendererUtility.h">
     <ClInclude Include="Include\BsRendererUtility.h">
       <Filter>Header Files\Renderer</Filter>
       <Filter>Header Files\Renderer</Filter>
     </ClInclude>
     </ClInclude>
+    <ClInclude Include="Include\BsEngineShaderIncludeHandler.h">
+      <Filter>Header Files\Resources</Filter>
+    </ClInclude>
   </ItemGroup>
   </ItemGroup>
   <ItemGroup>
   <ItemGroup>
     <ClCompile Include="Source\BsGUIElement.cpp">
     <ClCompile Include="Source\BsGUIElement.cpp">
@@ -670,5 +673,8 @@
     <ClCompile Include="Source\BsRendererUtility.cpp">
     <ClCompile Include="Source\BsRendererUtility.cpp">
       <Filter>Source Files\Renderer</Filter>
       <Filter>Source Files\Renderer</Filter>
     </ClCompile>
     </ClCompile>
+    <ClCompile Include="Source\BsEngineShaderIncludeHandler.cpp">
+      <Filter>Source Files\Resources</Filter>
+    </ClCompile>
   </ItemGroup>
   </ItemGroup>
 </Project>
 </Project>

+ 25 - 59
BansheeEngine/Include/BsApplication.h

@@ -8,9 +8,7 @@
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
-	/**
-	 * @brief	Types of available render systems.
-	 */
+	/**	Types of available render systems. */
 	enum class RenderAPIPlugin
 	enum class RenderAPIPlugin
 	{
 	{
 		DX11,
 		DX11,
@@ -18,17 +16,13 @@ namespace BansheeEngine
 		OpenGL
 		OpenGL
 	};
 	};
 
 
-	/**
-	 * @brief	Types of available renderers.
-	 */
+	/**	Types of available renderers. */
 	enum class RendererPlugin
 	enum class RendererPlugin
 	{
 	{
 		Default
 		Default
 	};
 	};
 
 
-	/**
-	 * @brief	Primary entry point for Banshee engine. Handles startup and shutdown.
-	 */
+	/**	Primary entry point for Banshee engine. Handles startup and shutdown. */
 	class BS_EXPORT Application : public CoreApplication
 	class BS_EXPORT Application : public CoreApplication
 	{
 	{
 	public:
 	public:
@@ -37,93 +31,65 @@ namespace BansheeEngine
 		virtual ~Application();
 		virtual ~Application();
 
 
 		/**
 		/**
-		 * @brief	Starts the Banshee engine.
+		 * Starts the Banshee engine.
 		 * 
 		 * 
-		 * @param	primaryWindowDesc	Description of the primary render window that will be created on startup.
-		 * @param	renderSystem		Render system to use.
-		 * @param	renderer			Renderer to use.
+		 * @param[in]	primaryWindowDesc	Description of the primary render window that will be created on startup.
+		 * @param[in]	renderAPI			Render API plugin to use.
+		 * @param[in]	renderer			Renderer plugin to use.
 		 */
 		 */
 		static void startUp(RENDER_WINDOW_DESC& primaryWindowDesc, RenderAPIPlugin renderAPI, 
 		static void startUp(RENDER_WINDOW_DESC& primaryWindowDesc, RenderAPIPlugin renderAPI, 
 			RendererPlugin renderer = RendererPlugin::Default, const Vector<String>& importers = Vector<String>());
 			RendererPlugin renderer = RendererPlugin::Default, const Vector<String>& importers = Vector<String>());
 
 
-		/**
-		 * @brief	Returns the absolute path to the builtin managed engine assembly file.
-		 */
+		/**	Returns the absolute path to the builtin managed engine assembly file. */
 		Path getEngineAssemblyPath() const;
 		Path getEngineAssemblyPath() const;
 
 
-		/**
-		 * @brief	Returns the absolute path to the game managed assembly file.
-		 */
+		/**	Returns the absolute path to the game managed assembly file. */
 		Path getGameAssemblyPath() const;
 		Path getGameAssemblyPath() const;
 
 
-		/**
-		 * @brief	Returns the absolute path to the folder where script assemblies are located in.
-		 */
+		/**	Returns the absolute path to the folder where script assemblies are located in. */
 		virtual Path getScriptAssemblyFolder() const;
 		virtual Path getScriptAssemblyFolder() const;
 
 
-		/**
-		 * @brief	Returns true if the application is running in an editor, false if standalone.
-		 */
+		/**	Returns true if the application is running in an editor, false if standalone. */
 		virtual bool isEditor() const { return false; }
 		virtual bool isEditor() const { return false; }
 
 
 	protected:
 	protected:
-		/**
-		 * @copydoc	Module::onStartUp
-		 */
+		/** @copydoc Module::onStartUp */
 		virtual void onStartUp() override;
 		virtual void onStartUp() override;
 
 
-		/**
-		 * @copydoc	Module::onShutDown
-		 */
+		/** @copydoc Module::onShutDown */
 		virtual void onShutDown() override;
 		virtual void onShutDown() override;
 
 
-		/**
-		 * @copydoc	CoreApplication::preUpdate.
-		 */
+		/** @copydoc CoreApplication::preUpdate. */
 		virtual void preUpdate() override;
 		virtual void preUpdate() override;
 
 
-		/**
-		 * @copydoc	CoreApplication::postUpdate.
-		 */
+		/** @copydoc CoreApplication::postUpdate. */
 		virtual void postUpdate() override;
 		virtual void postUpdate() override;
 
 
-		/**
-		 * @copydoc	CoreApplication::startUpRenderer.
-		 */
+		/** @copydoc CoreApplication::startUpRenderer. */
 		virtual void startUpRenderer() override;
 		virtual void startUpRenderer() override;
 
 
-		/**
-		 * @brief	Loads the script system and all script libraries.
-		 */
+		/** @copydoc Application::getShaderIncludeHandler */
+		ShaderIncludeHandlerPtr getShaderIncludeHandler() const override;
+
+		/**	Loads the script system and all script libraries. */
 		virtual void loadScriptSystem();
 		virtual void loadScriptSystem();
 
 
-		/**
-		 * @brief	Unloads script libraries and shuts down the script system.
-		 */
+		/**	Unloads script libraries and shuts down the script system. */
 		virtual void unloadScriptSystem();
 		virtual void unloadScriptSystem();
 
 
-		/**
-		 * @brief	Returns the absolute path to the folder where built-in assemblies are located in.
-		 */
+		/**	Returns the absolute path to the folder where built-in assemblies are located in. */
 		virtual Path getBuiltinAssemblyFolder() const;
 		virtual Path getBuiltinAssemblyFolder() const;
 
 
-	protected:
-		/**
-		 * @brief	Translates render system type into library name.
-		 */
+		/**	Translates render system type into library name. */
 		static String getLibNameForRenderAPI(RenderAPIPlugin plugin);
 		static String getLibNameForRenderAPI(RenderAPIPlugin plugin);
 
 
-		/**
-		 * @brief	Translates renderer type into library name.
-		 */
+		/**	Translates renderer type into library name. */
 		static String getLibNameForRenderer(RendererPlugin plugin);
 		static String getLibNameForRenderer(RendererPlugin plugin);
 
 
 		DynLib* mMonoPlugin;
 		DynLib* mMonoPlugin;
 		DynLib* mSBansheeEnginePlugin;
 		DynLib* mSBansheeEnginePlugin;
 	};
 	};
 
 
-	/**
-	 * @copydoc	Application
-	 */
+	/** Easy way to access Application. */
 	BS_EXPORT Application& gApplication();
 	BS_EXPORT Application& gApplication();
 }
 }

+ 23 - 0
BansheeEngine/Include/BsEngineShaderIncludeHandler.h

@@ -0,0 +1,23 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#pragma once
+
+#include "BsPrerequisites.h"
+#include "BsShaderManager.h"
+
+namespace BansheeEngine
+{
+	/**
+	 * Shader include handler for the engine. It loads includes relative to the application working directory and supports
+	 * special $ENGINE$ folder for built-in includes.
+	 */
+	class BS_EXPORT EngineShaderIncludeHandler : public IShaderIncludeHandler
+	{
+	public:
+		/** @copydoc IShaderIncludeHandler::findInclude */
+		virtual HShaderInclude findInclude(const String& name) const override;
+
+		/** Converts a shader include name or path to a path of the resource containing include data. */
+		static Path toResourcePath(const String& name);
+	};
+}

+ 24 - 0
BansheeEngine/Include/BsProfilerOverlay.h

@@ -250,6 +250,30 @@ namespace BansheeEngine
 		GUILayout* mGPULayoutSamples = nullptr;
 		GUILayout* mGPULayoutSamples = nullptr;
 		GUILayout* mGPULayoutSampleContents = nullptr;
 		GUILayout* mGPULayoutSampleContents = nullptr;
 
 
+		GUILabel* mGPUFrameNumLbl;
+		GUILabel* mGPUTimeLbl;
+		GUILabel* mGPUDrawCallsLbl;
+		GUILabel* mGPURenTargetChangesLbl;
+		GUILabel* mGPUPresentsLbl;
+		GUILabel* mGPUClearsLbl;
+		GUILabel* mGPUVerticesLbl;
+		GUILabel* mGPUPrimitivesLbl;
+		GUILabel* mGPUSamplesLbl;
+		GUILabel* mGPUBlendStateChangesLbl;
+		GUILabel* mGPURasterStateChangesLbl;
+		GUILabel* mGPUDepthStencilStateChangesLbl;
+
+		GUILabel* mGPUObjectsCreatedLbl;
+		GUILabel* mGPUObjectsDestroyedLbl;
+		GUILabel* mGPUResourceWritesLbl;
+		GUILabel* mGPUResourceReadsLbl;
+		GUILabel* mGPUTextureBindsLbl;
+		GUILabel* mGPUSamplerBindsLbl;
+		GUILabel* mGPUVertexBufferBindsLbl;
+		GUILabel* mGPUIndexBufferBindsLbl;
+		GUILabel* mGPUGPUProgramBufferBindsLbl;
+		GUILabel* mGPUGPUProgramBindsLbl;
+
 		HString mGPUFrameNumStr;
 		HString mGPUFrameNumStr;
 		HString mGPUTimeStr;
 		HString mGPUTimeStr;
 		HString mGPUDrawCallsStr;
 		HString mGPUDrawCallsStr;

+ 6 - 2
BansheeEngine/Source/BsApplication.cpp

@@ -2,8 +2,6 @@
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 //**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
 #include "BsApplication.h"
 #include "BsApplication.h"
 #include "BsGUIManager.h"
 #include "BsGUIManager.h"
-#include "BsShapeMeshes2D.h"
-#include "BsShapeMeshes3D.h"
 #include "BsBuiltinResources.h"
 #include "BsBuiltinResources.h"
 #include "BsScriptManager.h"
 #include "BsScriptManager.h"
 #include "BsProfilingManager.h"
 #include "BsProfilingManager.h"
@@ -20,6 +18,7 @@
 #include "BsRendererManager.h"
 #include "BsRendererManager.h"
 #include "BsRendererMaterialManager.h"
 #include "BsRendererMaterialManager.h"
 #include "BsPlatform.h"
 #include "BsPlatform.h"
+#include "BsEngineShaderIncludeHandler.h"
 
 
 namespace BansheeEngine
 namespace BansheeEngine
 {
 {
@@ -181,6 +180,11 @@ namespace BansheeEngine
 		return getBuiltinAssemblyFolder();
 		return getBuiltinAssemblyFolder();
 	}
 	}
 
 
+	ShaderIncludeHandlerPtr Application::getShaderIncludeHandler() const
+	{
+		return bs_shared_ptr_new<EngineShaderIncludeHandler>();
+	}
+
 	String Application::getLibNameForRenderAPI(RenderAPIPlugin plugin)
 	String Application::getLibNameForRenderAPI(RenderAPIPlugin plugin)
 	{
 	{
 		static String DX11Name = "BansheeD3D11RenderAPI";
 		static String DX11Name = "BansheeD3D11RenderAPI";

+ 48 - 0
BansheeEngine/Source/BsEngineShaderIncludeHandler.cpp

@@ -0,0 +1,48 @@
+//********************************** Banshee Engine (www.banshee3d.com) **************************************************//
+//**************** Copyright (c) 2016 Marko Pintera ([email protected]). All rights reserved. **********************//
+#include "BsEngineShaderIncludeHandler.h"
+#include "BsResources.h"
+#include "BsBuiltinResources.h"
+#include "BsImporter.h"
+
+namespace BansheeEngine
+{
+	HShaderInclude EngineShaderIncludeHandler::findInclude(const String& name) const
+	{
+		Path path = toResourcePath(name);
+
+		if (path.isEmpty())
+			return HShaderInclude();
+
+		if (name.size() >= 8)
+		{
+			if (name.substr(0, 8) == "$ENGINE$")
+				return static_resource_cast<ShaderInclude>(Resources::instance().load(path));
+		}
+
+		return Importer::instance().import<ShaderInclude>(name);
+	}
+
+	Path EngineShaderIncludeHandler::toResourcePath(const String& name)
+	{
+		if (name.substr(0, 8) == "$ENGINE$")
+		{
+			if (name.size() > 8)
+			{
+				Path fullPath = BuiltinResources::getShaderIncludeFolder();
+				Path includePath = name.substr(9, name.size() - 9);
+
+				fullPath.append(includePath);
+				fullPath.setFilename(includePath.getFilename() + ".asset");
+
+				return fullPath;
+			}
+		}
+		else
+		{
+			return name;
+		}
+
+		return Path::BLANK;
+	}
+}

+ 1 - 1
BansheeEngine/Source/BsGUIDropDownContent.cpp

@@ -107,7 +107,7 @@ namespace BansheeEngine
 		mRangeEnd = end;
 		mRangeEnd = end;
 		
 		
 		UINT32 range = end - start;
 		UINT32 range = end - start;
-		if (mSelectedIdx != UINT_MAX && mSelectedIdx > range)
+		if (mSelectedIdx != UINT_MAX && mSelectedIdx >= range)
 			mSelectedIdx = UINT_MAX;
 			mSelectedIdx = UINT_MAX;
 
 
 		mVisibleElements.clear();
 		mVisibleElements.clear();

+ 70 - 22
BansheeEngine/Source/BsProfilerOverlay.cpp

@@ -472,30 +472,54 @@ namespace BansheeEngine
 		mGPUGPUProgramBufferBindsStr = HEString(L"__ProfOvProgBuffBinds", L"GPU program buffer binds: {0}");
 		mGPUGPUProgramBufferBindsStr = HEString(L"__ProfOvProgBuffBinds", L"GPU program buffer binds: {0}");
 		mGPUGPUProgramBindsStr = HEString(L"__ProfOvProgBinds", L"GPU program binds: {0}");
 		mGPUGPUProgramBindsStr = HEString(L"__ProfOvProgBinds", L"GPU program binds: {0}");
 
 
-		mGPULayoutFrameContentsLeft->addElement(GUILabel::create(mGPUFrameNumStr, GUIOptions(GUIOption::fixedWidth(200))));
-		mGPULayoutFrameContentsLeft->addElement(GUILabel::create(mGPUTimeStr, GUIOptions(GUIOption::fixedWidth(200))));
-		mGPULayoutFrameContentsLeft->addElement(GUILabel::create(mGPUDrawCallsStr, GUIOptions(GUIOption::fixedWidth(200))));
-		mGPULayoutFrameContentsLeft->addElement(GUILabel::create(mGPURenTargetChangesStr, GUIOptions(GUIOption::fixedWidth(200))));
-		mGPULayoutFrameContentsLeft->addElement(GUILabel::create(mGPUPresentsStr, GUIOptions(GUIOption::fixedWidth(200))));
-		mGPULayoutFrameContentsLeft->addElement(GUILabel::create(mGPUClearsStr, GUIOptions(GUIOption::fixedWidth(200))));
-		mGPULayoutFrameContentsLeft->addElement(GUILabel::create(mGPUVerticesStr, GUIOptions(GUIOption::fixedWidth(200))));
-		mGPULayoutFrameContentsLeft->addElement(GUILabel::create(mGPUPrimitivesStr, GUIOptions(GUIOption::fixedWidth(200))));
-		mGPULayoutFrameContentsLeft->addElement(GUILabel::create(mGPUSamplesStr, GUIOptions(GUIOption::fixedWidth(200))));
-		mGPULayoutFrameContentsLeft->addElement(GUILabel::create(mGPUBlendStateChangesStr, GUIOptions(GUIOption::fixedWidth(200))));
-		mGPULayoutFrameContentsLeft->addElement(GUILabel::create(mGPURasterStateChangesStr, GUIOptions(GUIOption::fixedWidth(200))));
-		mGPULayoutFrameContentsLeft->addElement(GUILabel::create(mGPUDepthStencilStateChangesStr, GUIOptions(GUIOption::fixedWidth(200))));
+		mGPUFrameNumLbl = GUILabel::create(mGPUFrameNumStr, GUIOptions(GUIOption::fixedWidth(200)));
+		mGPUTimeLbl = GUILabel::create(mGPUTimeStr, GUIOptions(GUIOption::fixedWidth(200)));
+		mGPUDrawCallsLbl = GUILabel::create(mGPUDrawCallsStr, GUIOptions(GUIOption::fixedWidth(200)));
+		mGPURenTargetChangesLbl = GUILabel::create(mGPURenTargetChangesStr, GUIOptions(GUIOption::fixedWidth(200)));
+		mGPUPresentsLbl = GUILabel::create(mGPUPresentsStr, GUIOptions(GUIOption::fixedWidth(200)));
+		mGPUClearsLbl = GUILabel::create(mGPUClearsStr, GUIOptions(GUIOption::fixedWidth(200)));
+		mGPUVerticesLbl = GUILabel::create(mGPUVerticesStr, GUIOptions(GUIOption::fixedWidth(200)));
+		mGPUPrimitivesLbl = GUILabel::create(mGPUPrimitivesStr, GUIOptions(GUIOption::fixedWidth(200)));
+		mGPUSamplesLbl = GUILabel::create(mGPUSamplesStr, GUIOptions(GUIOption::fixedWidth(200)));
+		mGPUBlendStateChangesLbl = GUILabel::create(mGPUBlendStateChangesStr, GUIOptions(GUIOption::fixedWidth(200)));
+		mGPURasterStateChangesLbl = GUILabel::create(mGPURasterStateChangesStr, GUIOptions(GUIOption::fixedWidth(200)));
+		mGPUDepthStencilStateChangesLbl = GUILabel::create(mGPUDepthStencilStateChangesStr, GUIOptions(GUIOption::fixedWidth(200)));
+
+		mGPUObjectsCreatedLbl = GUILabel::create(mGPUObjectsCreatedStr, GUIOptions(GUIOption::fixedWidth(200)));
+		mGPUObjectsDestroyedLbl = GUILabel::create(mGPUObjectsDestroyedStr, GUIOptions(GUIOption::fixedWidth(200)));
+		mGPUResourceWritesLbl = GUILabel::create(mGPUResourceWritesStr, GUIOptions(GUIOption::fixedWidth(200)));
+		mGPUResourceReadsLbl = GUILabel::create(mGPUResourceReadsStr, GUIOptions(GUIOption::fixedWidth(200)));
+		mGPUTextureBindsLbl = GUILabel::create(mGPUTextureBindsStr, GUIOptions(GUIOption::fixedWidth(200)));
+		mGPUSamplerBindsLbl = GUILabel::create(mGPUSamplerBindsStr, GUIOptions(GUIOption::fixedWidth(200)));
+		mGPUVertexBufferBindsLbl = GUILabel::create(mGPUVertexBufferBindsStr, GUIOptions(GUIOption::fixedWidth(200)));
+		mGPUIndexBufferBindsLbl = GUILabel::create(mGPUIndexBufferBindsStr, GUIOptions(GUIOption::fixedWidth(200)));
+		mGPUGPUProgramBufferBindsLbl = GUILabel::create(mGPUGPUProgramBufferBindsStr, GUIOptions(GUIOption::fixedWidth(200)));
+		mGPUGPUProgramBindsLbl = GUILabel::create(mGPUGPUProgramBindsStr, GUIOptions(GUIOption::fixedWidth(200)));
+
+		mGPULayoutFrameContentsLeft->addElement(mGPUFrameNumLbl);
+		mGPULayoutFrameContentsLeft->addElement(mGPUTimeLbl);
+		mGPULayoutFrameContentsLeft->addElement(mGPUDrawCallsLbl);
+		mGPULayoutFrameContentsLeft->addElement(mGPURenTargetChangesLbl);
+		mGPULayoutFrameContentsLeft->addElement(mGPUPresentsLbl);
+		mGPULayoutFrameContentsLeft->addElement(mGPUClearsLbl);
+		mGPULayoutFrameContentsLeft->addElement(mGPUVerticesLbl);
+		mGPULayoutFrameContentsLeft->addElement(mGPUPrimitivesLbl);
+		mGPULayoutFrameContentsLeft->addElement(mGPUSamplesLbl);
+		mGPULayoutFrameContentsLeft->addElement(mGPUBlendStateChangesLbl);
+		mGPULayoutFrameContentsLeft->addElement(mGPURasterStateChangesLbl);
+		mGPULayoutFrameContentsLeft->addElement(mGPUDepthStencilStateChangesLbl);
 		mGPULayoutFrameContentsLeft->addNewElement<GUIFlexibleSpace>();
 		mGPULayoutFrameContentsLeft->addNewElement<GUIFlexibleSpace>();
 
 
-		mGPULayoutFrameContentsRight->addElement(GUILabel::create(mGPUObjectsCreatedStr, GUIOptions(GUIOption::fixedWidth(200))));
-		mGPULayoutFrameContentsRight->addElement(GUILabel::create(mGPUObjectsDestroyedStr, GUIOptions(GUIOption::fixedWidth(200))));
-		mGPULayoutFrameContentsRight->addElement(GUILabel::create(mGPUResourceWritesStr, GUIOptions(GUIOption::fixedWidth(200))));
-		mGPULayoutFrameContentsRight->addElement(GUILabel::create(mGPUResourceReadsStr, GUIOptions(GUIOption::fixedWidth(200))));
-		mGPULayoutFrameContentsRight->addElement(GUILabel::create(mGPUTextureBindsStr, GUIOptions(GUIOption::fixedWidth(200))));
-		mGPULayoutFrameContentsRight->addElement(GUILabel::create(mGPUSamplerBindsStr, GUIOptions(GUIOption::fixedWidth(200))));
-		mGPULayoutFrameContentsRight->addElement(GUILabel::create(mGPUVertexBufferBindsStr, GUIOptions(GUIOption::fixedWidth(200))));
-		mGPULayoutFrameContentsRight->addElement(GUILabel::create(mGPUIndexBufferBindsStr, GUIOptions(GUIOption::fixedWidth(200))));
-		mGPULayoutFrameContentsRight->addElement(GUILabel::create(mGPUGPUProgramBufferBindsStr, GUIOptions(GUIOption::fixedWidth(200))));
-		mGPULayoutFrameContentsRight->addElement(GUILabel::create(mGPUGPUProgramBindsStr, GUIOptions(GUIOption::fixedWidth(200))));
+		mGPULayoutFrameContentsRight->addElement(mGPUObjectsCreatedLbl);
+		mGPULayoutFrameContentsRight->addElement(mGPUObjectsDestroyedLbl);
+		mGPULayoutFrameContentsRight->addElement(mGPUResourceWritesLbl);
+		mGPULayoutFrameContentsRight->addElement(mGPUResourceReadsLbl);
+		mGPULayoutFrameContentsRight->addElement(mGPUTextureBindsLbl);
+		mGPULayoutFrameContentsRight->addElement(mGPUSamplerBindsLbl);
+		mGPULayoutFrameContentsRight->addElement(mGPUVertexBufferBindsLbl);
+		mGPULayoutFrameContentsRight->addElement(mGPUIndexBufferBindsLbl);
+		mGPULayoutFrameContentsRight->addElement(mGPUGPUProgramBufferBindsLbl);
+		mGPULayoutFrameContentsRight->addElement(mGPUGPUProgramBindsLbl);
 		mGPULayoutFrameContentsRight->addNewElement<GUIFlexibleSpace>();
 		mGPULayoutFrameContentsRight->addNewElement<GUIFlexibleSpace>();
 
 
 		updateCPUSampleAreaSizes();
 		updateCPUSampleAreaSizes();
@@ -735,6 +759,30 @@ namespace BansheeEngine
 		mGPUGPUProgramBufferBindsStr.setParameter(0, toWString(gpuReport.frameSample.numGpuParamBufferBinds));
 		mGPUGPUProgramBufferBindsStr.setParameter(0, toWString(gpuReport.frameSample.numGpuParamBufferBinds));
 		mGPUGPUProgramBindsStr.setParameter(0, toWString(gpuReport.frameSample.numGpuProgramBinds));
 		mGPUGPUProgramBindsStr.setParameter(0, toWString(gpuReport.frameSample.numGpuProgramBinds));
 
 
+		mGPUFrameNumLbl->setContent(mGPUFrameNumStr);
+		mGPUTimeLbl->setContent(mGPUTimeStr);
+		mGPUDrawCallsLbl->setContent(mGPUDrawCallsStr);
+		mGPURenTargetChangesLbl->setContent(mGPURenTargetChangesStr);
+		mGPUPresentsLbl->setContent(mGPUPresentsStr);
+		mGPUClearsLbl->setContent(mGPUClearsStr);
+		mGPUVerticesLbl->setContent(mGPUVerticesStr);
+		mGPUPrimitivesLbl->setContent(mGPUPrimitivesStr);
+		mGPUSamplesLbl->setContent(mGPUSamplesStr);
+		mGPUBlendStateChangesLbl->setContent(mGPUBlendStateChangesStr);
+		mGPURasterStateChangesLbl->setContent(mGPURasterStateChangesStr);
+		mGPUDepthStencilStateChangesLbl->setContent(mGPUDepthStencilStateChangesStr);
+
+		mGPUObjectsCreatedLbl->setContent(mGPUObjectsCreatedStr);
+		mGPUObjectsDestroyedLbl->setContent(mGPUObjectsDestroyedStr);
+		mGPUResourceWritesLbl->setContent(mGPUResourceWritesStr);
+		mGPUResourceReadsLbl->setContent(mGPUResourceReadsStr);
+		mGPUTextureBindsLbl->setContent(mGPUTextureBindsStr);
+		mGPUSamplerBindsLbl->setContent(mGPUSamplerBindsStr);
+		mGPUVertexBufferBindsLbl->setContent(mGPUVertexBufferBindsStr);
+		mGPUIndexBufferBindsLbl->setContent(mGPUIndexBufferBindsStr);
+		mGPUGPUProgramBufferBindsLbl->setContent(mGPUGPUProgramBufferBindsStr);
+		mGPUGPUProgramBindsLbl->setContent(mGPUGPUProgramBindsStr);
+
 		GPUSampleRowFiller sampleRowFiller(mGPUSampleRows, *mGPULayoutSampleContents, *mWidget->_getInternal());
 		GPUSampleRowFiller sampleRowFiller(mGPUSampleRows, *mGPULayoutSampleContents, *mWidget->_getInternal());
 		for (auto& sample : gpuReport.samples)
 		for (auto& sample : gpuReport.samples)
 		{
 		{

+ 19 - 39
ExampleProject/Source/Main.cpp

@@ -34,62 +34,40 @@ namespace BansheeEngine
 	UINT32 windowResWidth = 1280;
 	UINT32 windowResWidth = 1280;
 	UINT32 windowResHeight = 720;
 	UINT32 windowResHeight = 720;
 
 
-	/**
-	 * Imports all of our assets and prepares GameObject that handle the example logic.
-	 */
+	/** Imports all of our assets and prepares GameObject that handle the example logic. */
 	void setUpExample();
 	void setUpExample();
 
 
-	/**
-	 * Import mesh/texture/GPU programs used by the example.
-	 */
+	/** Import mesh/texture/GPU programs used by the example. */
 	void importAssets(HMesh& model, HTexture& texture, HShader& shader);
 	void importAssets(HMesh& model, HTexture& texture, HShader& shader);
 
 
-	/**
-	 * Create a material used by our example model.
-	 */
+	/** Create a material used by our example model. */
 	HMaterial createMaterial(const HTexture& texture, const HShader& shader);
 	HMaterial createMaterial(const HTexture& texture, const HShader& shader);
 
 
-	/**
-	 * Set up example scene objects.
-	 */
+	/** Set up example scene objects. */
 	void setUp3DScene(const HMesh& mesh, const HMaterial& material);
 	void setUp3DScene(const HMesh& mesh, const HMaterial& material);
 
 
-	/**
-	 * Set up example GUI.
-	 */
+	/** Set up example GUI. */
 	void setUpGUI();
 	void setUpGUI();
 
 
-	/**
-	 * Set up input configuration and callbacks.
-	 */
+	/** Set up input configuration and callbacks. */
 	void setUpInput();
 	void setUpInput();
 
 
-	/**
-	 * Toggles the primary window between full-screen and windowed mode.
-	 */
+	/** Toggles the primary window between full-screen and windowed mode. */
 	void toggleFullscreen();
 	void toggleFullscreen();
 
 
-	/**
-	 * Called whenever the main render window is resized.
-	 */
+	/** Called whenever the main render window is resized. */
 	void renderWindowResized();
 	void renderWindowResized();
 
 
-	/**
-	 * Called when the selected video mode changes in the video mode list box.
-	 */
+	/** Called when the selected video mode changes in the video mode list box. */
 	void videoModeChanged(UINT32 idx, bool enabled);
 	void videoModeChanged(UINT32 idx, bool enabled);
 
 
-	/**
-	 * Triggered whenever a virtual button is released.
-	 */
+	/** Triggered whenever a virtual button is released. */
 	void buttonUp(const VirtualButton& button, UINT32 deviceIdx);
 	void buttonUp(const VirtualButton& button, UINT32 deviceIdx);
 }
 }
 
 
 using namespace BansheeEngine;
 using namespace BansheeEngine;
 
 
-/**
- * Main entry point into the application.
- */
+/** Main entry point into the application. */
 int CALLBACK WinMain(
 int CALLBACK WinMain(
 	_In_  HINSTANCE hInstance,
 	_In_  HINSTANCE hInstance,
 	_In_  HINSTANCE hPrevInstance,
 	_In_  HINSTANCE hPrevInstance,
@@ -116,7 +94,7 @@ int CALLBACK WinMain(
 	// along with (or replace) the DX11 ones.
 	// along with (or replace) the DX11 ones.
 	Application::startUp(renderWindowDesc, RenderAPIPlugin::DX11, RendererPlugin::Default, importers);
 	Application::startUp(renderWindowDesc, RenderAPIPlugin::DX11, RendererPlugin::Default, importers);
 
 
-	// Imports all of ours assets and prepares GameObject that handle the example logic.
+	// Imports all of ours assets and prepares GameObjects that handle the example logic.
 	setUpExample();
 	setUpExample();
 	
 	
 	// Runs the main loop that does most of the work. This method will exit when user closes the main
 	// Runs the main loop that does most of the work. This method will exit when user closes the main
@@ -251,6 +229,9 @@ namespace BansheeEngine
 		// Set closest distance that is visible. Anything below that is clipped.
 		// Set closest distance that is visible. Anything below that is clipped.
 		sceneCamera->setNearClipDistance(5);
 		sceneCamera->setNearClipDistance(5);
 
 
+		// Set farthest distance that is visible. Anything above that is clipped.
+		sceneCamera->setFarClipDistance(10000);
+
 		// Set aspect ratio depending on the current resolution
 		// Set aspect ratio depending on the current resolution
 		sceneCamera->setAspectRatio(windowResWidth / (float)windowResHeight);
 		sceneCamera->setAspectRatio(windowResWidth / (float)windowResHeight);
 
 
@@ -353,7 +334,6 @@ namespace BansheeEngine
 
 
 		// Create a GUI panel that is used for displaying resolution and fullscreen options.
 		// Create a GUI panel that is used for displaying resolution and fullscreen options.
 		GUILayout* rightLayout = gui->getPanel()->addNewElement<GUILayoutX>();
 		GUILayout* rightLayout = gui->getPanel()->addNewElement<GUILayoutX>();
-		rightLayout->setPosition(30, 30);
 
 
 		// We want all the GUI elements be right aligned, so we add a flexible space first.
 		// We want all the GUI elements be right aligned, so we add a flexible space first.
 		rightLayout->addNewElement<GUIFlexibleSpace>();
 		rightLayout->addNewElement<GUIFlexibleSpace>();
@@ -361,14 +341,14 @@ namespace BansheeEngine
 		// And we want the elements to be vertically placed, top to bottom
 		// And we want the elements to be vertically placed, top to bottom
 		GUILayout* elemLayout = rightLayout->addNewElement<GUILayoutY>();
 		GUILayout* elemLayout = rightLayout->addNewElement<GUILayoutY>();
 
 
+		// Leave 30 pixels to the right free
+		rightLayout->addNewElement<GUIFixedSpace>(30);
+
 		// Add a button that will trigger a callback when clicked
 		// Add a button that will trigger a callback when clicked
 		toggleFullscreenButton = GUIButton::create(HString(L"Toggle fullscreen"));
 		toggleFullscreenButton = GUIButton::create(HString(L"Toggle fullscreen"));
 		toggleFullscreenButton->onClick.connect(&toggleFullscreen);
 		toggleFullscreenButton->onClick.connect(&toggleFullscreen);
 		elemLayout->addElement(toggleFullscreenButton);
 		elemLayout->addElement(toggleFullscreenButton);
 
 
-		// Leave 30 pixels to the right free
-		rightLayout->addNewElement<GUIFixedSpace>(30);
-
 		// Add a profiler overlay object that is responsible for displaying CPU and GPU profiling GUI
 		// Add a profiler overlay object that is responsible for displaying CPU and GPU profiling GUI
 		profilerOverlay = guiSO->addComponent<ProfilerOverlay>(guiCamera->_getCamera());
 		profilerOverlay = guiSO->addComponent<ProfilerOverlay>(guiCamera->_getCamera());
 
 
@@ -404,7 +384,7 @@ namespace BansheeEngine
 
 
 		// Create the list box
 		// Create the list box
 		GUIListBox* videoModeListBox = GUIListBox::create(videoModeLabels);
 		GUIListBox* videoModeListBox = GUIListBox::create(videoModeLabels);
-		rightLayout->addElement(videoModeListBox);
+		elemLayout->addElement(videoModeListBox);
 
 
 		// Select the default (desktop) video mode
 		// Select the default (desktop) video mode
 		videoModeListBox->selectElement(selectedVideoModeIdx);
 		videoModeListBox->selectElement(selectedVideoModeIdx);