Browse Source

Editor: Debug render targets window

Panagiotis Christopoulos Charitos 2 months ago
parent
commit
132bc7b549
50 changed files with 472 additions and 249 deletions
  1. 1 11
      AnKi/Core/App.cpp
  2. 0 5
      AnKi/Core/App.h
  3. 128 1
      AnKi/Editor/EditorUi.cpp
  4. 19 8
      AnKi/Editor/EditorUi.h
  5. 1 1
      AnKi/Importer/GltfImporter.cpp
  6. 12 0
      AnKi/Renderer/Bloom.h
  7. 18 13
      AnKi/Renderer/FinalComposite.cpp
  8. 2 2
      AnKi/Renderer/FinalComposite.h
  9. 21 5
      AnKi/Renderer/GBuffer.cpp
  10. 5 4
      AnKi/Renderer/GBuffer.h
  11. 2 1
      AnKi/Renderer/HistoryLength.h
  12. 2 1
      AnKi/Renderer/IndirectDiffuse.h
  13. 3 2
      AnKi/Renderer/IndirectDiffuseClipmaps.h
  14. 0 11
      AnKi/Renderer/LightShading.cpp
  15. 6 5
      AnKi/Renderer/LightShading.h
  16. 1 1
      AnKi/Renderer/MotionBlur.h
  17. 3 6
      AnKi/Renderer/MotionVectors.h
  18. 2 1
      AnKi/Renderer/Reflections.h
  19. 18 5
      AnKi/Renderer/Renderer.cpp
  20. 16 2
      AnKi/Renderer/Renderer.h
  21. 1 1
      AnKi/Renderer/RendererObject.h
  22. 1 1
      AnKi/Renderer/RtMaterialFetchDbg.h
  23. 0 6
      AnKi/Renderer/RtShadows.cpp
  24. 5 2
      AnKi/Renderer/RtShadows.h
  25. 1 1
      AnKi/Renderer/ShadowmapsResolve.h
  26. 1 1
      AnKi/Renderer/Sky.h
  27. 3 2
      AnKi/Renderer/Ssao.h
  28. 0 16
      AnKi/Renderer/VrsSriGeneration.cpp
  29. 12 1
      AnKi/Renderer/VrsSriGeneration.h
  30. 2 0
      AnKi/Resource/ResourceFilesystem.cpp
  31. 1 1
      AnKi/Resource/ResourceFilesystem.h
  32. 1 1
      AnKi/Scene/Components/BodyComponent.cpp
  33. 1 1
      AnKi/Scene/Components/MaterialComponent.cpp
  34. 5 0
      AnKi/Scene/Components/MeshComponent.cpp
  35. 9 2
      AnKi/Scene/Components/MeshComponent.h
  36. 6 1
      AnKi/Scene/Components/SkinComponent.cpp
  37. 8 1
      AnKi/Scene/Components/SkinComponent.h
  38. 41 35
      AnKi/Script/Scene.cpp
  39. 1 1
      AnKi/Script/Scene.xml
  40. 16 0
      AnKi/Shaders/Include/MiscRendererTypes.h
  41. 7 0
      AnKi/Shaders/PackFunctions.hlsl
  42. 0 20
      AnKi/Shaders/VisualizeGBufferNormal.ankiprog
  43. 0 20
      AnKi/Shaders/VisualizeHdrRenderTarget.ankiprog
  44. 52 7
      AnKi/Shaders/VisualizeRenderTarget.ankiprog
  45. 7 21
      AnKi/Window/NativeWindow.h
  46. 26 14
      AnKi/Window/NativeWindowSdl.cpp
  47. 1 1
      AnKi/Window/NativeWindowSdl.h
  48. 1 1
      Samples/SkeletalAnimation/Assets/Scene.lua
  49. 1 1
      Samples/Sponza/Assets/Scene.lua
  50. 2 5
      Tools/Editor/EditorMain.cpp

+ 1 - 11
AnKi/Core/App.cpp

@@ -216,18 +216,8 @@ Error App::init()
 	//
 	// Window
 	//
-	NativeWindowInitInfo nwinit;
-	nwinit.m_width = g_cvarWindowWidth;
-	nwinit.m_height = g_cvarWindowHeight;
-	nwinit.m_depthBits = 0;
-	nwinit.m_stencilBits = 0;
-	nwinit.m_fullscreenDesktopRez = g_cvarWindowFullscreen > 0;
-	nwinit.m_exclusiveFullscreen = g_cvarWindowFullscreen == 2;
-	nwinit.m_targetFps = g_cvarCoreTargetFps;
-	nwinit.m_borderless = g_cvarWindowBorderless;
-	nwinit.m_maximized = g_cvarWindowMaximized;
 	NativeWindow::allocateSingleton();
-	ANKI_CHECK(NativeWindow::getSingleton().init(nwinit));
+	ANKI_CHECK(NativeWindow::getSingleton().init(g_cvarCoreTargetFps, "AnKi"));
 
 	//
 	// Input

+ 0 - 5
AnKi/Core/App.h

@@ -14,11 +14,6 @@
 
 namespace anki {
 
-ANKI_CVAR(NumericCVar<U32>, Window, Width, 1920, 16, 16 * 1024, "Width")
-ANKI_CVAR(NumericCVar<U32>, Window, Height, 1080, 16, 16 * 1024, "Height")
-ANKI_CVAR(NumericCVar<U32>, Window, Fullscreen, 1, 0, 2, "0: windowed, 1: borderless fullscreen, 2: exclusive fullscreen")
-ANKI_CVAR(BoolCVar, Window, Maximized, false, "Maximize")
-ANKI_CVAR(BoolCVar, Window, Borderless, false, "Borderless")
 ANKI_CVAR(NumericCVar<U32>, Core, TargetFps, 60u, 1u, kMaxU32, "Target FPS")
 ANKI_CVAR(NumericCVar<U32>, Core, JobThreadCount, clamp(getCpuCoresCount() / 2u, 2u, 16u), 2u, 1024u, "Number of job thread")
 ANKI_CVAR(NumericCVar<U32>, Core, DisplayStats, 0, 0, 2, "Display stats, 0: None, 1: Simple, 2: Detailed")

+ 128 - 1
AnKi/Editor/EditorUi.cpp

@@ -10,6 +10,7 @@
 #include <AnKi/Script/ScriptManager.h>
 #include <AnKi/Window/Input.h>
 #include <AnKi/Util/Filesystem.h>
+#include <AnKi/Renderer/Renderer.h>
 #include <filesystem>
 #include <ThirdParty/ImGui/Extra/IconsMaterialDesignIcons.h> // See all icons in https://pictogrammers.com/library/mdi/
 
@@ -176,14 +177,16 @@ void EditorUi::draw(UiCanvas& canvas)
 	sceneNodePropertiesWindow();
 	consoleWindow();
 	assetsWindow();
-
 	cVarsWindow();
+	debugRtsWindow();
 
 	ImGui::End();
 
 	ImGui::PopStyleVar();
 	ImGui::PopFont();
 
+	m_mouseHoveredOverAnyWindow = ImGui::IsWindowHovered(ImGuiHoveredFlags_AnyWindow);
+
 	m_canvas = nullptr;
 }
 
@@ -227,6 +230,11 @@ void EditorUi::mainMenu()
 				m_showCVarEditorWindow = true;
 			}
 
+			if(ImGui::MenuItem(ICON_MDI_APPLICATION_OUTLINE " Debug Render Targets"))
+			{
+				m_showDebugRtsWindow = true;
+			}
+
 			ImGui::EndMenu();
 		}
 
@@ -534,12 +542,14 @@ void EditorUi::sceneNodePropertiesWindow()
 
 						if(ImGui::Button(ICON_MDI_MINUS_BOX))
 						{
+							ANKI_LOGW("TODO");
 						}
 						ImGui::SetItemTooltip("Delete Component");
 						ImGui::SameLine();
 
 						if(ImGui::Button(ICON_MDI_EYE))
 						{
+							ANKI_LOGW("TODO");
 						}
 						ImGui::SetItemTooltip("Disable component");
 					}
@@ -556,6 +566,12 @@ void EditorUi::sceneNodePropertiesWindow()
 					case SceneComponentType::kMaterial:
 						materialComponent(static_cast<MaterialComponent&>(comp));
 						break;
+					case SceneComponentType::kMesh:
+						meshComponent(static_cast<MeshComponent&>(comp));
+						break;
+					case SceneComponentType::kSkin:
+						skinComponent(static_cast<SkinComponent&>(comp));
+						break;
 					default:
 						ImGui::Text("TODO");
 					}
@@ -694,6 +710,78 @@ void EditorUi::materialComponent(MaterialComponent& comp)
 	}
 }
 
+void EditorUi::meshComponent(MeshComponent& comp)
+{
+	// Locate button
+	{
+		ImGui::BeginDisabled(!comp.hasMeshResource());
+		if(ImGui::Button(comp.hasMeshResource() ? ICON_MDI_MAP_MARKER : ICON_MDI_ALERT_CIRCLE "##MeshCompBtn"))
+		{
+			ANKI_LOGW("TODO");
+		}
+		ImGui::SetItemTooltip("Locate");
+		ImGui::EndDisabled();
+		ImGui::SameLine();
+	}
+
+	// Filename
+	{
+		ImGui::SetNextItemWidth(-1.0f);
+
+		Char buff[kMaxTextInputLen] = "";
+		if(comp.hasMeshResource())
+		{
+			std::strncpy(buff, comp.getMeshFilename().cstr(), sizeof(buff));
+		}
+
+		if(ImGui::InputTextWithHint("##MeshCompFname", ".ankimesh Filename", buff, sizeof(buff)))
+		{
+			comp.setMeshFilename(buff);
+		}
+
+		if(comp.hasMeshResource())
+		{
+			ImGui::SetItemTooltip("%s", comp.getMeshFilename().cstr());
+		}
+	}
+}
+
+void EditorUi::skinComponent(SkinComponent& comp)
+{
+	// Locate button
+	{
+		ImGui::BeginDisabled(!comp.hasSkeletonResource());
+		if(ImGui::Button(comp.hasSkeletonResource() ? ICON_MDI_MAP_MARKER : ICON_MDI_ALERT_CIRCLE "##SkinCompBtn"))
+		{
+			ANKI_LOGW("TODO");
+		}
+		ImGui::SetItemTooltip("Locate");
+		ImGui::EndDisabled();
+		ImGui::SameLine();
+	}
+
+	// Filename
+	{
+		ImGui::SetNextItemWidth(-1.0f);
+
+		Char buff[kMaxTextInputLen] = "";
+		if(comp.hasSkeletonResource())
+		{
+			std::strncpy(buff, comp.getSkeletonFilename().cstr(), sizeof(buff));
+		}
+
+		if(ImGui::InputTextWithHint("##SkelCompFname", ".ankiskel Filename", buff, sizeof(buff)))
+		{
+			comp.setSkeletonFilename(buff);
+		}
+
+		if(comp.hasSkeletonResource())
+		{
+			ImGui::SetItemTooltip("%s", comp.getSkeletonFilename().cstr());
+		}
+	}
+}
+
 void EditorUi::cVarsWindow()
 {
 	if(!m_showCVarEditorWindow)
@@ -823,6 +911,45 @@ void EditorUi::cVarsWindow()
 	ImGui::End();
 }
 
+void EditorUi::debugRtsWindow()
+{
+	if(!m_showDebugRtsWindow)
+	{
+		return;
+	}
+
+	if(ImGui::GetFrameCount() > 1)
+	{
+		// Viewport is one frame delay so do that when frame >1
+		const Vec2 viewportSize = ImGui::GetMainViewport()->WorkSize;
+		const Vec2 viewportPos = ImGui::GetMainViewport()->WorkPos;
+		const Vec2 initialSize = Vec2(450.0f, m_canvas->getSizef().y() * 0.4f);
+		ImGui::SetNextWindowSize(initialSize, ImGuiCond_FirstUseEver);
+		ImGui::SetNextWindowPos(ImGui::GetMainViewport()->GetCenter(), ImGuiCond_Once, Vec2(0.5f));
+	}
+
+	if(ImGui::Begin("Debug Render Targets", &m_showDebugRtsWindow, 0))
+	{
+		const Bool refresh = ImGui::Checkbox("Disable tonemapping", &m_debugRtsWindow.m_disableTonemapping);
+		ImGui::TextUnformatted("");
+		ImGui::Separator();
+
+		if(ImGui::BeginChild("Content", Vec2(-1.0f, -1.0f)))
+		{
+			Renderer::getSingleton().iterateDebugRenderTargetNames([&](CString name) {
+				Bool isActive = (name == Renderer::getSingleton().getCurrentDebugRenderTarget());
+				if(ImGui::Checkbox(name.cstr(), &isActive) || (isActive && refresh))
+				{
+					Renderer::getSingleton().setCurrentDebugRenderTarget(isActive ? name : "", m_debugRtsWindow.m_disableTonemapping);
+				}
+				return FunctorContinue::kContinue;
+			});
+		}
+		ImGui::EndChild();
+	}
+	ImGui::End();
+}
+
 void EditorUi::consoleWindow()
 {
 	if(!m_showConsoleWindow)

+ 19 - 8
AnKi/Editor/EditorUi.h

@@ -17,8 +17,8 @@ namespace anki {
 
 // Forward
 class SceneNode;
-class ScriptComponent;
-class MaterialComponent;
+#define ANKI_DEFINE_SCENE_COMPONENT(class_, weight, icon) class class_##Component;
+#include <AnKi/Scene/Components/SceneComponentClasses.def.h>
 
 /// @addtogroup editor
 /// @{
@@ -33,6 +33,8 @@ public:
 
 	Bool m_quit = false;
 
+	Bool m_mouseHoveredOverAnyWindow = false; ///< Mouse is over one of the editor windows.
+
 	void draw(UiCanvas& canvas);
 
 private:
@@ -84,6 +86,7 @@ private:
 	Bool m_showSceneNodePropsWindow = true;
 	Bool m_showSceneHierarcyWindow = true;
 	Bool m_showAssetsWindow = true;
+	Bool m_showDebugRtsWindow = false;
 
 	ImageResourcePtr m_materialIcon;
 	ImageResourcePtr m_meshIcon;
@@ -140,19 +143,27 @@ private:
 		I32 m_cellSize = 8; ///< Icon size
 	} m_assetsWindow;
 
+	class
+	{
+	public:
+		Bool m_disableTonemapping = false;
+	} m_debugRtsWindow;
+
 	void mainMenu();
 
+	// Windows
 	void sceneHierarchyWindow();
-	void sceneNode(SceneNode& node);
-
 	void sceneNodePropertiesWindow();
-	void scriptComponent(ScriptComponent& comp);
-	void materialComponent(MaterialComponent& comp);
-
 	void cVarsWindow();
 	void consoleWindow();
-
 	void assetsWindow();
+	void debugRtsWindow();
+
+	void sceneNode(SceneNode& node);
+	void scriptComponent(ScriptComponent& comp);
+	void materialComponent(MaterialComponent& comp);
+	void meshComponent(MeshComponent& comp);
+	void skinComponent(SkinComponent& comp);
 	void dirTree(const AssetPath& path);
 
 	// Widget/UI utils

+ 1 - 1
AnKi/Importer/GltfImporter.cpp

@@ -1139,7 +1139,7 @@ Error GltfImporter::writeMeshMaterialNode(const cgltf_node& node, const Importer
 
 	if(node.skin)
 	{
-		ANKI_CHECK(m_sceneFile.writeTextf("node:newSkinComponent():loadSkeletonResource(\"%s%s\")\n", m_rpath.cstr(),
+		ANKI_CHECK(m_sceneFile.writeTextf("node:newSkinComponent():setSkeletonFilename(\"%s%s\")\n", m_rpath.cstr(),
 										  computeSkeletonResourceFilename(*node.skin).cstr()));
 	}
 

+ 12 - 0
AnKi/Renderer/Bloom.h

@@ -21,6 +21,11 @@ ANKI_CVAR2(NumericCVar<U32>, Render, Bloom, UpscaleDivisor, 4, 1, 1024, "Defines
 class Bloom : public RendererObject
 {
 public:
+	Bloom()
+	{
+		registerDebugRenderTarget("Bloom");
+	}
+
 	Error init();
 
 	void importRenderTargets(RenderingContext& ctx);
@@ -47,6 +52,13 @@ public:
 		return m_runCtx.m_finalRt;
 	}
 
+	void getDebugRenderTarget([[maybe_unused]] CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
+							  [[maybe_unused]] Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets>& drawStyles) const override
+	{
+		handles[0] = m_runCtx.m_finalRt;
+		drawStyles[0] = DebugRenderTargetDrawStyle::kTonemap;
+	}
+
 private:
 	ShaderProgramResourcePtr m_prog;
 	ShaderProgramPtr m_downscaleGrProg;

+ 18 - 13
AnKi/Renderer/FinalComposite.cpp

@@ -48,8 +48,7 @@ Error FinalComposite::initInternal()
 									 m_prog, m_grProgs[dbg]));
 	}
 
-	ANKI_CHECK(loadShaderProgram("ShaderBinaries/VisualizeRenderTarget.ankiprogbin", m_defaultVisualizeRenderTargetProg,
-								 m_defaultVisualizeRenderTargetGrProg));
+	ANKI_CHECK(loadShaderProgram("ShaderBinaries/VisualizeRenderTarget.ankiprogbin", m_visualizeRenderTargetProg, m_visualizeRenderTargetGrProg));
 
 	if(getRenderer().getSwapchainResolution() != getRenderer().getPostProcessResolution())
 	{
@@ -119,8 +118,8 @@ void FinalComposite::populateRenderGraph(RenderingContext& ctx)
 	pass.newTextureDependency(getRenderer().getBloom().getBloomRt(), TextureUsageBit::kSrvPixel);
 
 	Array<RenderTargetHandle, kMaxDebugRenderTargets> dbgRts;
-	ShaderProgramPtr debugProgram;
-	const Bool hasDebugRt = getRenderer().getCurrentDebugRenderTarget(dbgRts, debugProgram);
+	Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets> drawStyles;
+	const Bool hasDebugRt = getRenderer().getCurrentDebugRenderTarget(dbgRts, drawStyles);
 	if(hasDebugRt)
 	{
 		for(const RenderTargetHandle& handle : dbgRts)
@@ -141,17 +140,13 @@ void FinalComposite::populateRenderGraph(RenderingContext& ctx)
 		const Bool dbgEnabled = g_cvarRenderDbgScene || g_cvarRenderDbgPhysics;
 
 		Array<RenderTargetHandle, kMaxDebugRenderTargets> dbgRts;
-		ShaderProgramPtr optionalDebugProgram;
-		const Bool hasDebugRt = getRenderer().getCurrentDebugRenderTarget(dbgRts, optionalDebugProgram);
+		Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets> drawStyles;
+		const Bool hasDebugRt = getRenderer().getCurrentDebugRenderTarget(dbgRts, drawStyles);
 
 		// Bind program
-		if(hasDebugRt && optionalDebugProgram.isCreated())
+		if(hasDebugRt)
 		{
-			cmdb.bindShaderProgram(optionalDebugProgram.get());
-		}
-		else if(hasDebugRt)
-		{
-			cmdb.bindShaderProgram(m_defaultVisualizeRenderTargetGrProg.get());
+			cmdb.bindShaderProgram(m_visualizeRenderTargetGrProg.get());
 		}
 		else
 		{
@@ -198,13 +193,23 @@ void FinalComposite::populateRenderGraph(RenderingContext& ctx)
 			cmdb.bindSampler(0, 0, getRenderer().getSamplers().m_nearestNearestClamp.get());
 
 			U32 count = 0;
+			UVec4 consts;
 			for(const RenderTargetHandle& handle : dbgRts)
 			{
 				if(handle.isValid())
 				{
-					rgraphCtx.bindSrv(count++, 0, handle);
+					consts[count] = U32(drawStyles[count]);
+					rgraphCtx.bindSrv(count, 0, handle);
+				}
+				else
+				{
+					cmdb.bindSrv(count, 0, TextureView(getDummyGpuResources().m_texture2DSrv.get(), TextureSubresourceDesc::all()));
 				}
+
+				++count;
 			}
+
+			cmdb.setFastConstants(&consts, sizeof(consts));
 		}
 
 		cmdb.setViewport(0, 0, getRenderer().getPostProcessResolution().x(), getRenderer().getPostProcessResolution().y());

+ 2 - 2
AnKi/Renderer/FinalComposite.h

@@ -38,8 +38,8 @@ private:
 	ShaderProgramResourcePtr m_prog;
 	Array<ShaderProgramPtr, 2> m_grProgs; ///< [Debug on or off]
 
-	ShaderProgramResourcePtr m_defaultVisualizeRenderTargetProg;
-	ShaderProgramPtr m_defaultVisualizeRenderTargetGrProg;
+	ShaderProgramResourcePtr m_visualizeRenderTargetProg;
+	ShaderProgramPtr m_visualizeRenderTargetGrProg;
 
 	RenderTargetDesc m_rtDesc;
 

+ 21 - 5
AnKi/Renderer/GBuffer.cpp

@@ -56,7 +56,6 @@ Error GBuffer::init()
 		m_hzbRt = getRenderer().createAndClearRenderTarget(texinit, TextureUsageBit::kSrvCompute, clear);
 	}
 
-	ANKI_CHECK(loadShaderProgram("ShaderBinaries/VisualizeGBufferNormal.ankiprogbin", m_visNormalProg, m_visNormalGrProg));
 	ANKI_CHECK(
 		loadShaderProgram("ShaderBinaries/GBufferVisualizeProbe.ankiprogbin", {{"PROBE_TYPE", 0}}, m_visualizeProbeProg, m_visualizeGiProbeGrProg));
 	ANKI_CHECK(
@@ -271,7 +270,7 @@ void GBuffer::populateRenderGraph(RenderingContext& ctx)
 }
 
 void GBuffer::getDebugRenderTarget(CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
-								   ShaderProgramPtr& optionalShaderProgram) const
+								   Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets>& drawStyles) const
 {
 	if(rtName == "GBufferAlbedo")
 	{
@@ -280,15 +279,32 @@ void GBuffer::getDebugRenderTarget(CString rtName, Array<RenderTargetHandle, kMa
 	else if(rtName == "GBufferNormals")
 	{
 		handles[0] = m_runCtx.m_colorRts[2];
-		optionalShaderProgram = m_visNormalGrProg;
+		drawStyles[0] = DebugRenderTargetDrawStyle::kGBufferNormal;
 	}
 	else if(rtName == "GBufferVelocity")
 	{
 		handles[0] = m_runCtx.m_colorRts[3];
 	}
-	else
+	else if(rtName == "GBufferRoughness")
+	{
+		handles[0] = m_runCtx.m_colorRts[1];
+		drawStyles[0] = DebugRenderTargetDrawStyle::kGBufferRoughness;
+	}
+	else if(rtName == "GBufferMetallic")
+	{
+		handles[0] = m_runCtx.m_colorRts[0];
+		drawStyles[0] = DebugRenderTargetDrawStyle::kGBufferMetallic;
+	}
+	else if(rtName == "GBufferSubsurface")
+	{
+		handles[0] = m_runCtx.m_colorRts[0];
+		drawStyles[0] = DebugRenderTargetDrawStyle::kGBufferSubsurface;
+	}
+	else if(rtName == "GBufferEmission")
 	{
-		ANKI_ASSERT(!"See file");
+		handles[0] = m_runCtx.m_colorRts[1];
+		handles[1] = m_runCtx.m_colorRts[2];
+		drawStyles[0] = DebugRenderTargetDrawStyle::kGBufferEmission;
 	}
 }
 

+ 5 - 4
AnKi/Renderer/GBuffer.h

@@ -26,6 +26,10 @@ public:
 		registerDebugRenderTarget("GBufferNormals");
 		registerDebugRenderTarget("GBufferAlbedo");
 		registerDebugRenderTarget("GBufferVelocity");
+		registerDebugRenderTarget("GBufferRoughness");
+		registerDebugRenderTarget("GBufferMetallic");
+		registerDebugRenderTarget("GBufferSubsurface");
+		registerDebugRenderTarget("GBufferEmission");
 	}
 
 	~GBuffer();
@@ -58,7 +62,7 @@ public:
 	}
 
 	void getDebugRenderTarget(CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
-							  [[maybe_unused]] ShaderProgramPtr& optionalShaderProgram) const override;
+							  Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets>& drawStyles) const override;
 
 	/// Returns a buffer with indices of the visible AABBs. Used in debug drawing.
 	const GpuVisibilityOutput& getVisibilityOutput() const
@@ -71,9 +75,6 @@ private:
 	Array<TexturePtr, 2> m_depthRts;
 	TexturePtr m_hzbRt;
 
-	ShaderProgramResourcePtr m_visNormalProg;
-	ShaderProgramPtr m_visNormalGrProg;
-
 	ShaderProgramResourcePtr m_visualizeProbeProg;
 	ShaderProgramPtr m_visualizeGiProbeGrProg;
 	ShaderProgramPtr m_visualizeReflProbeGrProg;

+ 2 - 1
AnKi/Renderer/HistoryLength.h

@@ -26,9 +26,10 @@ public:
 	void populateRenderGraph(RenderingContext& ctx);
 
 	void getDebugRenderTarget([[maybe_unused]] CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
-							  [[maybe_unused]] ShaderProgramPtr& optionalShaderProgram) const override
+							  [[maybe_unused]] Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets>& drawStyles) const override
 	{
 		handles[0] = m_runCtx.m_rt;
+		drawStyles[0] = DebugRenderTargetDrawStyle::kRedOnly;
 	}
 
 	RenderTargetHandle getRt() const

+ 2 - 1
AnKi/Renderer/IndirectDiffuse.h

@@ -27,9 +27,10 @@ public:
 	void populateRenderGraph(RenderingContext& ctx);
 
 	void getDebugRenderTarget([[maybe_unused]] CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
-							  [[maybe_unused]] ShaderProgramPtr& optionalShaderProgram) const override
+							  [[maybe_unused]] Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets>& drawStyles) const override
 	{
 		handles[0] = m_runCtx.m_rt;
+		drawStyles[0] = DebugRenderTargetDrawStyle::kTonemap;
 	}
 
 	RenderTargetHandle getRt() const

+ 3 - 2
AnKi/Renderer/IndirectDiffuseClipmaps.h

@@ -83,7 +83,7 @@ class IndirectDiffuseClipmaps : public RtMaterialFetchRendererObject
 public:
 	IndirectDiffuseClipmaps()
 	{
-		registerDebugRenderTarget("IndirectDiffuseClipmapsTest");
+		registerDebugRenderTarget("IndirectDiffuseClipmaps");
 	}
 
 	Error init();
@@ -91,9 +91,10 @@ public:
 	void populateRenderGraph(RenderingContext& ctx);
 
 	void getDebugRenderTarget([[maybe_unused]] CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
-							  [[maybe_unused]] ShaderProgramPtr& optionalShaderProgram) const override
+							  [[maybe_unused]] Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets>& drawStyles) const override
 	{
 		handles[0] = m_runCtx.m_handles.m_appliedIrradiance;
+		drawStyles[0] = DebugRenderTargetDrawStyle::kTonemap;
 	}
 
 	const IndirectDiffuseClipmapConstants& getClipmapConsts() const

+ 0 - 11
AnKi/Renderer/LightShading.cpp

@@ -40,9 +40,6 @@ Error LightShading::init()
 		m_lightShading.m_rtDescr = getRenderer().create2DRenderTargetDescription(internalResolution.x(), internalResolution.y(),
 																				 getRenderer().getHdrFormat(), "Light Shading");
 		m_lightShading.m_rtDescr.bake();
-
-		// Debug visualization
-		ANKI_CHECK(loadShaderProgram("ShaderBinaries/VisualizeHdrRenderTarget.ankiprogbin", m_visualizeRtProg, m_visualizeRtGrProg));
 	}
 
 	{
@@ -315,12 +312,4 @@ void LightShading::populateRenderGraph(RenderingContext& ctx)
 	getRenderer().getForwardShading().setDependencies(pass);
 }
 
-void LightShading::getDebugRenderTarget([[maybe_unused]] CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
-										ShaderProgramPtr& optionalShaderProgram) const
-{
-	ANKI_ASSERT(rtName == "LightShading");
-	handles[0] = m_runCtx.m_rt;
-	optionalShaderProgram = m_visualizeRtGrProg;
-}
-
 } // end namespace anki

+ 6 - 5
AnKi/Renderer/LightShading.h

@@ -62,13 +62,14 @@ private:
 		RenderTargetHandle m_rt;
 	} m_runCtx; ///< Run context.
 
-	ShaderProgramResourcePtr m_visualizeRtProg;
-	ShaderProgramPtr m_visualizeRtGrProg;
-
 	void run(const RenderingContext& ctx, RenderPassWorkContext& rgraphCtx);
 
-	void getDebugRenderTarget(CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
-							  ShaderProgramPtr& optionalShaderProgram) const override;
+	void getDebugRenderTarget([[maybe_unused]] CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
+							  [[maybe_unused]] Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets>& drawStyles) const override
+	{
+		handles[0] = m_runCtx.m_rt;
+		drawStyles[0] = DebugRenderTargetDrawStyle::kTonemap;
+	}
 };
 /// @}
 

+ 1 - 1
AnKi/Renderer/MotionBlur.h

@@ -29,7 +29,7 @@ public:
 	void populateRenderGraph(RenderingContext& ctx);
 
 	void getDebugRenderTarget([[maybe_unused]] CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
-							  [[maybe_unused]] ShaderProgramPtr& optionalShaderProgram) const override
+							  [[maybe_unused]] Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets>& drawStyles) const override
 	{
 		ANKI_ASSERT(rtName == "MotionBlur");
 		handles[0] = m_runCtx.m_rt;

+ 3 - 6
AnKi/Renderer/MotionVectors.h

@@ -31,13 +31,10 @@ public:
 		return m_runCtx.m_motionVectorsRtHandle;
 	}
 
-	void getDebugRenderTarget(CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
-							  [[maybe_unused]] ShaderProgramPtr& optionalShaderProgram) const override
+	void getDebugRenderTarget([[maybe_unused]] CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
+							  [[maybe_unused]] Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets>& drawStyles) const override
 	{
-		if(rtName == "MotionVectors")
-		{
-			handles[0] = m_runCtx.m_motionVectorsRtHandle;
-		}
+		handles[0] = m_runCtx.m_motionVectorsRtHandle;
 	}
 
 private:

+ 2 - 1
AnKi/Renderer/Reflections.h

@@ -36,9 +36,10 @@ public:
 	void populateRenderGraph(RenderingContext& ctx);
 
 	void getDebugRenderTarget([[maybe_unused]] CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
-							  [[maybe_unused]] ShaderProgramPtr& optionalShaderProgram) const override
+							  Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets>& drawStyles) const override
 	{
 		handles[0] = m_runCtx.m_rt;
+		drawStyles[0] = DebugRenderTargetDrawStyle::kTonemap;
 	}
 
 	RenderTargetHandle getRt() const

+ 18 - 5
AnKi/Renderer/Renderer.cpp

@@ -641,11 +641,11 @@ void Renderer::registerDebugRenderTarget(RendererObject* obj, CString rtName)
 #if ANKI_ASSERTIONS_ENABLED
 	for(const DebugRtInfo& inf : m_debugRts)
 	{
-		ANKI_ASSERT(inf.m_rtName != rtName && "Choose different name");
+		ANKI_ASSERT(inf.m_rtName != rtName && "Choose a different name");
 	}
 #endif
-
 	ANKI_ASSERT(obj);
+
 	DebugRtInfo inf;
 	inf.m_obj = obj;
 	inf.m_rtName = rtName;
@@ -653,8 +653,12 @@ void Renderer::registerDebugRenderTarget(RendererObject* obj, CString rtName)
 	m_debugRts.emplaceBack(std::move(inf));
 }
 
-Bool Renderer::getCurrentDebugRenderTarget(Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles, ShaderProgramPtr& optionalShaderProgram)
+Bool Renderer::getCurrentDebugRenderTarget(Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
+										   Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets>& drawStyles)
 {
+	handles = {};
+	drawStyles = {};
+
 	if(m_currentDebugRtName.isEmpty()) [[likely]]
 	{
 		return false;
@@ -671,7 +675,14 @@ Bool Renderer::getCurrentDebugRenderTarget(Array<RenderTargetHandle, kMaxDebugRe
 
 	if(obj)
 	{
-		obj->getDebugRenderTarget(m_currentDebugRtName, handles, optionalShaderProgram);
+		obj->getDebugRenderTarget(m_currentDebugRtName, handles, drawStyles);
+		for(DebugRenderTargetDrawStyle& style : drawStyles)
+		{
+			if(m_disableDebugRtTonemapping && style == DebugRenderTargetDrawStyle::kTonemap)
+			{
+				style = DebugRenderTargetDrawStyle::kPassthrough;
+			}
+		}
 		return true;
 	}
 	else
@@ -682,7 +693,7 @@ Bool Renderer::getCurrentDebugRenderTarget(Array<RenderTargetHandle, kMaxDebugRe
 	}
 }
 
-void Renderer::setCurrentDebugRenderTarget(CString rtName)
+void Renderer::setCurrentDebugRenderTarget(CString rtName, Bool disableTonemapping)
 {
 	m_currentDebugRtName.destroy();
 
@@ -690,6 +701,8 @@ void Renderer::setCurrentDebugRenderTarget(CString rtName)
 	{
 		m_currentDebugRtName = rtName;
 	}
+
+	m_disableDebugRtTonemapping = disableTonemapping;
 }
 
 Format Renderer::getHdrFormat() const

+ 16 - 2
AnKi/Renderer/Renderer.h

@@ -171,7 +171,7 @@ public:
 	void registerDebugRenderTarget(RendererObject* obj, CString rtName);
 
 	/// Set the render target you want to show.
-	void setCurrentDebugRenderTarget(CString rtName);
+	void setCurrentDebugRenderTarget(CString rtName, Bool disableTonemapping = false);
 
 	/// Get the render target currently showing.
 	CString getCurrentDebugRenderTarget() const
@@ -180,7 +180,8 @@ public:
 	}
 
 	// Need to call it after the handle is set by the RenderGraph.
-	Bool getCurrentDebugRenderTarget(Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles, ShaderProgramPtr& optionalShaderProgram);
+	Bool getCurrentDebugRenderTarget(Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
+									 Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets>& drawStyles);
 	/// @}
 
 	StackMemoryPool& getFrameMemoryPool()
@@ -202,6 +203,18 @@ public:
 	}
 #endif
 
+	template<typename TFunc>
+	void iterateDebugRenderTargetNames(TFunc func) const
+	{
+		for(const auto& x : m_debugRts)
+		{
+			if(func(x.m_rtName) == FunctorContinue::kStop)
+			{
+				break;
+			}
+		}
+	}
+
 private:
 	class Cleanup
 	{
@@ -244,6 +257,7 @@ private:
 	};
 	RendererDynamicArray<DebugRtInfo> m_debugRts;
 	RendererString m_currentDebugRtName;
+	Bool m_disableDebugRtTonemapping = false;
 
 	ShaderProgramResourcePtr m_blitProg;
 	ShaderProgramPtr m_blitGrProg;

+ 1 - 1
AnKi/Renderer/RendererObject.h

@@ -29,7 +29,7 @@ public:
 	virtual ~RendererObject() = default;
 
 	virtual void getDebugRenderTarget([[maybe_unused]] CString rtName, [[maybe_unused]] Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
-									  [[maybe_unused]] ShaderProgramPtr& optionalShaderProgram) const
+									  [[maybe_unused]] Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets>& drawStyles) const
 	{
 		ANKI_ASSERT(!"Object doesn't support that");
 	}

+ 1 - 1
AnKi/Renderer/RtMaterialFetchDbg.h

@@ -28,7 +28,7 @@ public:
 	void populateRenderGraph(RenderingContext& ctx);
 
 	void getDebugRenderTarget([[maybe_unused]] CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
-							  [[maybe_unused]] ShaderProgramPtr& optionalShaderProgram) const override
+							  [[maybe_unused]] Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets>& drawStyles) const override
 	{
 		handles[0] = m_runCtx.m_rt;
 	}

+ 0 - 6
AnKi/Renderer/RtShadows.cpp

@@ -516,10 +516,4 @@ void RtShadows::runDenoise(const RenderingContext& ctx, RenderPassWorkContext& r
 	dispatchPPCompute(cmdb, 8, 8, getRenderer().getInternalResolution().x() / 2, getRenderer().getInternalResolution().y() / 2);
 }
 
-void RtShadows::getDebugRenderTarget([[maybe_unused]] CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
-									 [[maybe_unused]] ShaderProgramPtr& optionalShaderProgram) const
-{
-	handles[0] = m_runCtx.m_upscaledRt;
-}
-
 } // end namespace anki

+ 5 - 2
AnKi/Renderer/RtShadows.h

@@ -33,8 +33,11 @@ public:
 
 	void populateRenderGraph(RenderingContext& ctx);
 
-	void getDebugRenderTarget(CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
-							  ShaderProgramPtr& optionalShaderProgram) const override;
+	void getDebugRenderTarget([[maybe_unused]] CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
+							  [[maybe_unused]] Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets>& drawStyles) const override
+	{
+		handles[0] = m_runCtx.m_upscaledRt;
+	}
 
 	RenderTargetHandle getRt() const
 	{

+ 1 - 1
AnKi/Renderer/ShadowmapsResolve.h

@@ -30,7 +30,7 @@ public:
 	void populateRenderGraph(RenderingContext& ctx);
 
 	void getDebugRenderTarget([[maybe_unused]] CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
-							  [[maybe_unused]] ShaderProgramPtr& optionalShaderProgram) const override
+							  [[maybe_unused]] Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets>& drawStyles) const override
 	{
 		ANKI_ASSERT(rtName == "ResolvedShadows");
 		handles[0] = m_runCtx.m_rt;

+ 1 - 1
AnKi/Renderer/Sky.h

@@ -28,7 +28,7 @@ public:
 	void populateRenderGraph(RenderingContext& ctx);
 
 	void getDebugRenderTarget([[maybe_unused]] CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
-							  [[maybe_unused]] ShaderProgramPtr& optionalShaderProgram) const override
+							  [[maybe_unused]] Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets>& drawStyles) const override
 	{
 		handles[0] = m_runCtx.m_envMapRt;
 	}

+ 3 - 2
AnKi/Renderer/Ssao.h

@@ -31,6 +31,7 @@ class Ssao : public RendererObject
 public:
 	Ssao()
 	{
+		registerDebugRenderTarget("BentNormals");
 		registerDebugRenderTarget("Ssao");
 	}
 
@@ -39,10 +40,10 @@ public:
 	void populateRenderGraph(RenderingContext& ctx);
 
 	void getDebugRenderTarget([[maybe_unused]] CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
-							  [[maybe_unused]] ShaderProgramPtr& optionalShaderProgram) const override
+							  [[maybe_unused]] Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets>& drawStyles) const override
 	{
-		ANKI_ASSERT(rtName == "Ssao");
 		handles[0] = m_runCtx.m_finalRt;
+		drawStyles[0] = (rtName == "Ssao") ? DebugRenderTargetDrawStyle::kAlphaOnly : DebugRenderTargetDrawStyle::kPassthrough;
 	}
 
 	RenderTargetHandle getRt() const

+ 0 - 16
AnKi/Renderer/VrsSriGeneration.cpp

@@ -63,22 +63,6 @@ Error VrsSriGeneration::init()
 	return Error::kNone;
 }
 
-void VrsSriGeneration::getDebugRenderTarget(CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
-											ShaderProgramPtr& optionalShaderProgram) const
-{
-	if(rtName == "VrsSri")
-	{
-		handles[0] = m_runCtx.m_rt;
-	}
-	else
-	{
-		ANKI_ASSERT(rtName == "VrsSriDownscaled");
-		handles[0] = m_runCtx.m_downscaledRt;
-	}
-
-	optionalShaderProgram = m_visualizeGrProg;
-}
-
 void VrsSriGeneration::importRenderTargets(RenderingContext& ctx)
 {
 	const Bool enableVrs = GrManager::getSingleton().getDeviceCapabilities().m_vrs && g_cvarGrVrs;

+ 12 - 1
AnKi/Renderer/VrsSriGeneration.h

@@ -70,7 +70,18 @@ public:
 	} m_runCtx;
 
 	void getDebugRenderTarget(CString rtName, Array<RenderTargetHandle, kMaxDebugRenderTargets>& handles,
-							  ShaderProgramPtr& optionalShaderProgram) const override;
+							  [[maybe_unused]] Array<DebugRenderTargetDrawStyle, kMaxDebugRenderTargets>& drawStyles) const override
+	{
+		if(rtName == "VrsSri")
+		{
+			handles[0] = m_runCtx.m_rt;
+		}
+		else
+		{
+			ANKI_ASSERT(rtName == "VrsSriDownscaled");
+			handles[0] = m_runCtx.m_downscaledRt;
+		}
+	}
 };
 /// @}
 

+ 2 - 0
AnKi/Resource/ResourceFilesystem.cpp

@@ -263,6 +263,8 @@ Error ResourceFilesystem::init()
 		return Error::kUserData;
 	}
 
+	ANKI_RESOURCE_LOGI("%s value: %s", g_cvarRsrcDataPaths.getName().cstr(), CString(g_cvarRsrcDataPaths).cstr());
+
 	for(const auto& path : paths)
 	{
 		ResourceStringList includedStrings;

+ 1 - 1
AnKi/Resource/ResourceFilesystem.h

@@ -20,7 +20,7 @@ namespace anki {
 ANKI_CVAR(StringCVar, Rsrc, DataPaths, ".",
 		  "The engine loads assets only in from these paths. Separate them with : (it's smart enough to identify drive letters in Windows). After a "
 		  "path you can add an optional | and what follows it is a number of words to include or exclude paths. eg. "
-		  "my_path|include_this,include_that,+exclude_this")
+		  "my_path|include_this,include_that,!exclude_this")
 
 /// Resource filesystem file. An interface that abstracts the resource file.
 class ResourceFile

+ 1 - 1
AnKi/Scene/Components/BodyComponent.cpp

@@ -38,7 +38,7 @@ void BodyComponent::teleportTo(Vec3 position, const Mat3& rotation)
 
 void BodyComponent::update(SceneComponentUpdateInfo& info, Bool& updated)
 {
-	const Bool meshIsValid = m_mesh.m_meshc && m_mesh.m_meshc->isEnabled();
+	const Bool meshIsValid = m_mesh.m_meshc && m_mesh.m_meshc->hasMeshResource();
 	if(m_shapeType == BodyComponentCollisionShapeType::kCount || (m_shapeType == BodyComponentCollisionShapeType::kFromMeshComponent && !meshIsValid))
 	{
 		// It's invalid, return

+ 1 - 1
AnKi/Scene/Components/MaterialComponent.cpp

@@ -129,7 +129,7 @@ void MaterialComponent::update(SceneComponentUpdateInfo& info, Bool& updated)
 	const Bool skinUpdated = m_skinDirty;
 	const Bool submeshUpdated = m_submeshIdxDirty;
 	const Bool hasSkin = m_skinComponent && m_skinComponent->isEnabled();
-	const Bool isValid = m_resource.isCreated() && m_resource->isLoaded() && m_meshComponent && m_meshComponent->isEnabled()
+	const Bool isValid = m_resource.isCreated() && m_resource->isLoaded() && m_meshComponent && m_meshComponent->isValid()
 						 && m_meshComponent->getMeshResource().isLoaded();
 
 	updated = mtlUpdated || meshUpdated || moved || skinUpdated || submeshUpdated;

+ 5 - 0
AnKi/Scene/Components/MeshComponent.cpp

@@ -35,6 +35,11 @@ MeshComponent& MeshComponent::setMeshFilename(CString fname)
 	return *this;
 }
 
+CString MeshComponent::getMeshFilename() const
+{
+	return (m_resource) ? m_resource->getFilename() : "*Error*";
+}
+
 void MeshComponent::update([[maybe_unused]] SceneComponentUpdateInfo& info, Bool& updated)
 {
 	updated = m_resourceDirty;

+ 9 - 2
AnKi/Scene/Components/MeshComponent.h

@@ -27,9 +27,16 @@ public:
 
 	MeshComponent& setMeshFilename(CString fname);
 
-	Bool isEnabled() const
+	Bool hasMeshResource() const
 	{
-		return m_resource.isCreated();
+		return !!m_resource;
+	}
+
+	CString getMeshFilename() const;
+
+	Bool isValid() const
+	{
+		return hasMeshResource();
 	}
 
 	const MeshResource& getMeshResource() const

+ 6 - 1
AnKi/Scene/Components/SkinComponent.cpp

@@ -22,7 +22,7 @@ SkinComponent::~SkinComponent()
 {
 }
 
-SkinComponent& SkinComponent::loadSkeletonResource(CString fname)
+SkinComponent& SkinComponent::setSkeletonFilename(CString fname)
 {
 	SkeletonResourcePtr rsrc;
 	const Error err = ResourceManager::getSingleton().loadResource(fname, rsrc);
@@ -54,6 +54,11 @@ SkinComponent& SkinComponent::loadSkeletonResource(CString fname)
 	return *this;
 }
 
+CString SkinComponent::getSkeletonFilename() const
+{
+	return (m_skeleton) ? m_skeleton->getFilename() : "*Error*";
+}
+
 void SkinComponent::playAnimation(U32 trackIdx, AnimationResourcePtr anim, const AnimationPlayInfo& info)
 {
 	const Second animDuration = anim->getDuration();

+ 8 - 1
AnKi/Scene/Components/SkinComponent.h

@@ -51,7 +51,14 @@ public:
 	~SkinComponent();
 
 	/// Load the skeleton resource.
-	SkinComponent& loadSkeletonResource(CString filename);
+	SkinComponent& setSkeletonFilename(CString filename);
+
+	CString getSkeletonFilename() const;
+
+	Bool hasSkeletonResource() const
+	{
+		return !!m_skeleton;
+	}
 
 	void playAnimation(U32 track, AnimationResourcePtr anim, const AnimationPlayInfo& info);
 

+ 41 - 35
AnKi/Script/Scene.cpp

@@ -40,7 +40,7 @@ static EventManager* getEventManager(lua_State* l)
 
 using WeakArraySceneNodePtr = WeakArray<SceneNode*>;
 
-LuaUserDataTypeInfo luaUserDataTypeInfoLightComponentType = {719535561358076220, "LightComponentType", 0, nullptr, nullptr};
+LuaUserDataTypeInfo luaUserDataTypeInfoLightComponentType = {-3456526791875692793, "LightComponentType", 0, nullptr, nullptr};
 
 template<>
 const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<LightComponentType>()
@@ -75,7 +75,7 @@ static inline void wrapLightComponentType(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoBodyComponentCollisionShapeType = {-6304619620946394365, "BodyComponentCollisionShapeType", 0, nullptr,
+LuaUserDataTypeInfo luaUserDataTypeInfoBodyComponentCollisionShapeType = {-2481956995252598710, "BodyComponentCollisionShapeType", 0, nullptr,
 																		  nullptr};
 
 template<>
@@ -120,7 +120,7 @@ static inline void wrapBodyComponentCollisionShapeType(lua_State* l)
 }
 
 LuaUserDataTypeInfo luaUserDataTypeInfoWeakArraySceneNodePtr = {
-	-5576003085739332971, "WeakArraySceneNodePtr", LuaUserData::computeSizeForGarbageCollected<WeakArraySceneNodePtr>(), nullptr, nullptr};
+	-5105683965807077746, "WeakArraySceneNodePtr", LuaUserData::computeSizeForGarbageCollected<WeakArraySceneNodePtr>(), nullptr, nullptr};
 
 template<>
 const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<WeakArraySceneNodePtr>()
@@ -238,7 +238,7 @@ static inline void wrapWeakArraySceneNodePtr(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoLightComponent = {3873585113943008776, "LightComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoLightComponent = {-1619723790941641410, "LightComponent",
 														 LuaUserData::computeSizeForGarbageCollected<LightComponent>(), nullptr, nullptr};
 
 template<>
@@ -849,7 +849,7 @@ static inline void wrapLightComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoDecalComponent = {6811154422270415588, "DecalComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoDecalComponent = {-5039454701243542060, "DecalComponent",
 														 LuaUserData::computeSizeForGarbageCollected<DecalComponent>(), nullptr, nullptr};
 
 template<>
@@ -971,7 +971,7 @@ static inline void wrapDecalComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoLensFlareComponent = {604038026485804297, "LensFlareComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoLensFlareComponent = {-8198380418068746713, "LensFlareComponent",
 															 LuaUserData::computeSizeForGarbageCollected<LensFlareComponent>(), nullptr, nullptr};
 
 template<>
@@ -1134,7 +1134,7 @@ static inline void wrapLensFlareComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoBodyComponent = {-7063592649961628038, "BodyComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoBodyComponent = {1686832003982752925, "BodyComponent",
 														LuaUserData::computeSizeForGarbageCollected<BodyComponent>(), nullptr, nullptr};
 
 template<>
@@ -1444,7 +1444,7 @@ static inline void wrapBodyComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoTriggerComponent = {-1123327168149663686, "TriggerComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoTriggerComponent = {3243022653427387261, "TriggerComponent",
 														   LuaUserData::computeSizeForGarbageCollected<TriggerComponent>(), nullptr, nullptr};
 
 template<>
@@ -1558,7 +1558,7 @@ static inline void wrapTriggerComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoFogDensityComponent = {346637918581847223, "FogDensityComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoFogDensityComponent = {-6388867116345771249, "FogDensityComponent",
 															  LuaUserData::computeSizeForGarbageCollected<FogDensityComponent>(), nullptr, nullptr};
 
 template<>
@@ -1664,7 +1664,7 @@ static inline void wrapFogDensityComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoCameraComponent = {852899725312716665, "CameraComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoCameraComponent = {-9123171918287668028, "CameraComponent",
 														  LuaUserData::computeSizeForGarbageCollected<CameraComponent>(), nullptr, nullptr};
 
 template<>
@@ -1746,8 +1746,8 @@ static inline void wrapCameraComponent(lua_State* l)
 }
 
 LuaUserDataTypeInfo luaUserDataTypeInfoGlobalIlluminationProbeComponent = {
-	7683081894085046403, "GlobalIlluminationProbeComponent", LuaUserData::computeSizeForGarbageCollected<GlobalIlluminationProbeComponent>(), nullptr,
-	nullptr};
+	-2685775957509103389, "GlobalIlluminationProbeComponent", LuaUserData::computeSizeForGarbageCollected<GlobalIlluminationProbeComponent>(),
+	nullptr, nullptr};
 
 template<>
 const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<GlobalIlluminationProbeComponent>()
@@ -1943,7 +1943,7 @@ static inline void wrapGlobalIlluminationProbeComponent(lua_State* l)
 }
 
 LuaUserDataTypeInfo luaUserDataTypeInfoReflectionProbeComponent = {
-	8310430098927318936, "ReflectionProbeComponent", LuaUserData::computeSizeForGarbageCollected<ReflectionProbeComponent>(), nullptr, nullptr};
+	4010089375456464018, "ReflectionProbeComponent", LuaUserData::computeSizeForGarbageCollected<ReflectionProbeComponent>(), nullptr, nullptr};
 
 template<>
 const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<ReflectionProbeComponent>()
@@ -1959,7 +1959,7 @@ static inline void wrapReflectionProbeComponent(lua_State* l)
 }
 
 LuaUserDataTypeInfo luaUserDataTypeInfoParticleEmitterComponent = {
-	1740612382933529549, "ParticleEmitterComponent", LuaUserData::computeSizeForGarbageCollected<ParticleEmitterComponent>(), nullptr, nullptr};
+	-1558542243117367050, "ParticleEmitterComponent", LuaUserData::computeSizeForGarbageCollected<ParticleEmitterComponent>(), nullptr, nullptr};
 
 template<>
 const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<ParticleEmitterComponent>()
@@ -2021,7 +2021,7 @@ static inline void wrapParticleEmitterComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoMeshComponent = {3466398713081927742, "MeshComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoMeshComponent = {-1595897034300335391, "MeshComponent",
 														LuaUserData::computeSizeForGarbageCollected<MeshComponent>(), nullptr, nullptr};
 
 template<>
@@ -2091,7 +2091,7 @@ static inline void wrapMeshComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoMaterialComponent = {840835603277348057, "MaterialComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoMaterialComponent = {-3502769337275950489, "MaterialComponent",
 															LuaUserData::computeSizeForGarbageCollected<MaterialComponent>(), nullptr, nullptr};
 
 template<>
@@ -2215,7 +2215,7 @@ static inline void wrapMaterialComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoSkinComponent = {-1564186081984009359, "SkinComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoSkinComponent = {7952306814580316146, "SkinComponent",
 														LuaUserData::computeSizeForGarbageCollected<SkinComponent>(), nullptr, nullptr};
 
 template<>
@@ -2224,8 +2224,8 @@ const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<SkinComponent>()
 	return luaUserDataTypeInfoSkinComponent;
 }
 
-/// Pre-wrap method SkinComponent::loadSkeletonResource.
-static inline int pwrapSkinComponentloadSkeletonResource(lua_State* l)
+/// Pre-wrap method SkinComponent::setSkeletonFilename.
+static inline int pwrapSkinComponentsetSkeletonFilename(lua_State* l)
 {
 	[[maybe_unused]] LuaUserData* ud;
 	[[maybe_unused]] void* voidp;
@@ -2252,15 +2252,22 @@ static inline int pwrapSkinComponentloadSkeletonResource(lua_State* l)
 	}
 
 	// Call the method
-	self->loadSkeletonResource(arg0);
+	SkinComponent& ret = self->setSkeletonFilename(arg0);
 
-	return 0;
+	// Push return value
+	voidp = lua_newuserdata(l, sizeof(LuaUserData));
+	ud = static_cast<LuaUserData*>(voidp);
+	luaL_setmetatable(l, "SkinComponent");
+	extern LuaUserDataTypeInfo luaUserDataTypeInfoSkinComponent;
+	ud->initPointed(&luaUserDataTypeInfoSkinComponent, &ret);
+
+	return 1;
 }
 
-/// Wrap method SkinComponent::loadSkeletonResource.
-static int wrapSkinComponentloadSkeletonResource(lua_State* l)
+/// Wrap method SkinComponent::setSkeletonFilename.
+static int wrapSkinComponentsetSkeletonFilename(lua_State* l)
 {
-	int res = pwrapSkinComponentloadSkeletonResource(l);
+	int res = pwrapSkinComponentsetSkeletonFilename(l);
 	if(res >= 0)
 	{
 		return res;
@@ -2274,11 +2281,11 @@ static int wrapSkinComponentloadSkeletonResource(lua_State* l)
 static inline void wrapSkinComponent(lua_State* l)
 {
 	LuaBinder::createClass(l, &luaUserDataTypeInfoSkinComponent);
-	LuaBinder::pushLuaCFuncMethod(l, "loadSkeletonResource", wrapSkinComponentloadSkeletonResource);
+	LuaBinder::pushLuaCFuncMethod(l, "setSkeletonFilename", wrapSkinComponentsetSkeletonFilename);
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoSkyboxComponent = {2242564588996850216, "SkyboxComponent",
+LuaUserDataTypeInfo luaUserDataTypeInfoSkyboxComponent = {-6295607888881293128, "SkyboxComponent",
 														  LuaUserData::computeSizeForGarbageCollected<SkyboxComponent>(), nullptr, nullptr};
 
 template<>
@@ -2769,7 +2776,7 @@ static inline void wrapSkyboxComponent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoSceneNode = {2187633709272075521, "SceneNode", LuaUserData::computeSizeForGarbageCollected<SceneNode>(),
+LuaUserDataTypeInfo luaUserDataTypeInfoSceneNode = {8987550344071655576, "SceneNode", LuaUserData::computeSizeForGarbageCollected<SceneNode>(),
 													nullptr, nullptr};
 
 template<>
@@ -4712,7 +4719,7 @@ static inline void wrapSceneNode(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoSceneGraph = {-4504117787585012859, "SceneGraph", LuaUserData::computeSizeForGarbageCollected<SceneGraph>(),
+LuaUserDataTypeInfo luaUserDataTypeInfoSceneGraph = {-1128652299998428278, "SceneGraph", LuaUserData::computeSizeForGarbageCollected<SceneGraph>(),
 													 nullptr, nullptr};
 
 template<>
@@ -4898,8 +4905,7 @@ static inline void wrapSceneGraph(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoEvent = {-8037780990830956566, "Event", LuaUserData::computeSizeForGarbageCollected<Event>(), nullptr,
-												nullptr};
+LuaUserDataTypeInfo luaUserDataTypeInfoEvent = {7262393731536988307, "Event", LuaUserData::computeSizeForGarbageCollected<Event>(), nullptr, nullptr};
 
 template<>
 const LuaUserDataTypeInfo& LuaUserData::getDataTypeInfoFor<Event>()
@@ -4963,7 +4969,7 @@ static inline void wrapEvent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoLightEvent = {-887179890638014087, "LightEvent", LuaUserData::computeSizeForGarbageCollected<LightEvent>(),
+LuaUserDataTypeInfo luaUserDataTypeInfoLightEvent = {5816769151368279229, "LightEvent", LuaUserData::computeSizeForGarbageCollected<LightEvent>(),
 													 nullptr, nullptr};
 
 template<>
@@ -5082,7 +5088,7 @@ static inline void wrapLightEvent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoScriptEvent = {-3599694744897696875, "ScriptEvent", LuaUserData::computeSizeForGarbageCollected<ScriptEvent>(),
+LuaUserDataTypeInfo luaUserDataTypeInfoScriptEvent = {-6019583226200593985, "ScriptEvent", LuaUserData::computeSizeForGarbageCollected<ScriptEvent>(),
 													  nullptr, nullptr};
 
 template<>
@@ -5098,7 +5104,7 @@ static inline void wrapScriptEvent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoJitterMoveEvent = {216767496191450146, "JitterMoveEvent",
+LuaUserDataTypeInfo luaUserDataTypeInfoJitterMoveEvent = {-2923517370362474757, "JitterMoveEvent",
 														  LuaUserData::computeSizeForGarbageCollected<JitterMoveEvent>(), nullptr, nullptr};
 
 template<>
@@ -5173,7 +5179,7 @@ static inline void wrapJitterMoveEvent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoAnimationEvent = {7826530453645847513, "AnimationEvent",
+LuaUserDataTypeInfo luaUserDataTypeInfoAnimationEvent = {-2689049813794196232, "AnimationEvent",
 														 LuaUserData::computeSizeForGarbageCollected<AnimationEvent>(), nullptr, nullptr};
 
 template<>
@@ -5189,7 +5195,7 @@ static inline void wrapAnimationEvent(lua_State* l)
 	lua_settop(l, 0);
 }
 
-LuaUserDataTypeInfo luaUserDataTypeInfoEventManager = {8340995330108727532, "EventManager",
+LuaUserDataTypeInfo luaUserDataTypeInfoEventManager = {5747718790548721909, "EventManager",
 													   LuaUserData::computeSizeForGarbageCollected<EventManager>(), nullptr, nullptr};
 
 template<>

+ 1 - 1
AnKi/Script/Scene.xml

@@ -304,7 +304,7 @@ using WeakArraySceneNodePtr = WeakArray<SceneNode*>;
 
 		<class name="SkinComponent">
 			<methods>
-				<method name="loadSkeletonResource">
+				<method name="setSkeletonFilename">
 					<args>
 						<arg>CString</arg>
 					</args>

+ 16 - 0
AnKi/Shaders/Include/MiscRendererTypes.h

@@ -260,4 +260,20 @@ struct LodAndRenderableIndex
 	U32 m_lod_2bit_renderableIndex_30bit;
 };
 
+enum class DebugRenderTargetDrawStyle
+{
+	kPassthrough,
+	kTonemap,
+	kGBufferNormal,
+	kGBufferRoughness,
+	kGBufferMetallic,
+	kGBufferSubsurface,
+	kGBufferEmission,
+	kAlphaOnly,
+	kRedOnly,
+
+	kCount,
+	kFirst = 0
+};
+
 ANKI_END_NAMESPACE

+ 7 - 0
AnKi/Shaders/PackFunctions.hlsl

@@ -218,6 +218,13 @@ T unpackRoughnessFromGBuffer(vector<T, 4> rt1)
 	return unpackRoughnessFromGBuffer<T>(rt1, kMinRoughness);
 }
 
+template<typename T>
+vector<T, 2> unpackSubsurfaceAndMetallicFromGBuffer(vector<T, 4> rt0)
+{
+	const vector<T, 2> unpackedSubsurfaceMetallic = unpackUnorm1ToUnorm2(rt0.w);
+	return unpackedSubsurfaceMetallic;
+}
+
 // Read part of the G-buffer
 template<typename T>
 void unpackGBufferNoVelocity(vector<T, 4> rt0, vector<T, 4> rt1, vector<T, 4> rt2, out GbufferInfo<T> g)

+ 0 - 20
AnKi/Shaders/VisualizeGBufferNormal.ankiprog

@@ -1,20 +0,0 @@
-// Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#pragma anki technique vert pixel
-
-#include <AnKi/Shaders/QuadVert.hlsl>
-
-#if ANKI_PIXEL_SHADER
-#	include <AnKi/Shaders/PackFunctions.hlsl>
-
-SamplerState g_nearestAnyClampSampler : register(s0);
-Texture2D g_inTex : register(t0);
-
-Vec3 main(VertOut input) : SV_TARGET0
-{
-	return unpackNormalFromGBuffer(g_inTex.SampleLevel(g_nearestAnyClampSampler, input.m_uv, 0.0)) / 2.0f + 0.5f;
-}
-#endif // ANKI_PIXEL_SHADER

+ 0 - 20
AnKi/Shaders/VisualizeHdrRenderTarget.ankiprog

@@ -1,20 +0,0 @@
-// Copyright (C) 2009-present, Panagiotis Christopoulos Charitos and contributors.
-// All rights reserved.
-// Code licensed under the BSD License.
-// http://www.anki3d.org/LICENSE
-
-#pragma anki technique vert pixel
-
-#include <AnKi/Shaders/QuadVert.hlsl>
-
-#if ANKI_PIXEL_SHADER
-#	include <AnKi/Shaders/TonemappingFunctions.hlsl>
-
-SamplerState g_nearestAnyClampSampler : register(s0);
-Texture2D g_inTex : register(t0);
-
-Vec3 main(VertOut input) : SV_TARGET0
-{
-	return reinhardTonemap(g_inTex.SampleLevel(g_nearestAnyClampSampler, input.m_uv, 0.0).rgb);
-}
-#endif // ANKI_PIXEL_SHADER

+ 52 - 7
AnKi/Shaders/VisualizeRenderTarget.ankiprog

@@ -6,17 +6,62 @@
 #pragma anki technique vert pixel
 
 #include <AnKi/Shaders/QuadVert.hlsl>
-
-#if ANKI_PIXEL_SHADER
-#	include <AnKi/Shaders/Common.hlsl>
+#include <AnKi/Shaders/TonemappingFunctions.hlsl>
+#include <AnKi/Shaders/PackFunctions.hlsl>
+#include <AnKi/Shaders/Include/MiscRendererTypes.h>
 
 SamplerState g_nearestAnyClampSampler : register(s0);
-Texture2D g_inTex : register(t0);
+Texture2D<Vec4> g_inTex : register(t0);
+Texture2D<Vec4> g_inTex2 : register(t1);
+
+struct Consts
+{
+	U32 m_drawStyle;
+	U32 m_padding0;
+	U32 m_padding1;
+	U32 m_padding2;
+};
+ANKI_FAST_CONSTANTS(Consts, g_consts)
 
+#if ANKI_PIXEL_SHADER
 Vec3 main(VertOut input) : SV_TARGET0
 {
-	const Vec4 rgba = g_inTex.SampleLevel(g_nearestAnyClampSampler, input.m_uv, 0.0);
-	// return (input.m_uv.x > 0.5) ? rgba.xyz : rgba.aaa * 1.0;
+	Vec4 rgba = g_inTex.SampleLevel(g_nearestAnyClampSampler, input.m_uv, 0.0);
+
+	switch((DebugRenderTargetDrawStyle)g_consts.m_drawStyle)
+	{
+	case DebugRenderTargetDrawStyle::kTonemap:
+		rgba.xyz = reinhardTonemap(rgba.xyz);
+		break;
+	case DebugRenderTargetDrawStyle::kGBufferNormal:
+		rgba.xyz = unpackNormalFromGBuffer(rgba) / 2.0f + 0.5f;
+		break;
+	case DebugRenderTargetDrawStyle::kGBufferRoughness:
+		rgba.xyz = unpackRoughnessFromGBuffer<F32>(rgba, 0.0).xxx;
+		break;
+	case DebugRenderTargetDrawStyle::kGBufferMetallic:
+		rgba.xyz = unpackSubsurfaceAndMetallicFromGBuffer(rgba).yyy;
+		break;
+	case DebugRenderTargetDrawStyle::kGBufferSubsurface:
+		rgba.xyz = unpackSubsurfaceAndMetallicFromGBuffer(rgba).xxx;
+		break;
+	case DebugRenderTargetDrawStyle::kGBufferEmission:
+	{
+		const Vec4 rt2 = g_inTex2.SampleLevel(g_nearestAnyClampSampler, input.m_uv, 0.0);
+		const Vec4 rt1 = rgba;
+		rgba.xyz = invertReinhardTonemap(Vec3(rt1.z, rt2.x, rt1.w));
+		break;
+	}
+	case DebugRenderTargetDrawStyle::kAlphaOnly:
+		rgba.xyz = rgba.www;
+		break;
+	case DebugRenderTargetDrawStyle::kRedOnly:
+		rgba.xyz = rgba.rrr;
+		break;
+	default:
+		break;
+	}
+
 	return rgba.xyz;
 }
-#endif // ANKI_PIXEL_SHADER
+#endif

+ 7 - 21
AnKi/Window/NativeWindow.h

@@ -8,29 +8,15 @@
 #include <AnKi/Window/Common.h>
 #include <AnKi/Util/Array.h>
 #include <AnKi/Util/String.h>
+#include <AnKi/Util/CVarSet.h>
 
 namespace anki {
 
-/// Window initializer
-class NativeWindowInitInfo
-{
-public:
-	U32 m_width = 1920;
-	U32 m_height = 1080;
-	Array<U32, 4> m_rgbaBits = {8, 8, 8, 0};
-	U32 m_depthBits = 0;
-	U32 m_stencilBits = 0;
-	U32 m_samplesCount = 0;
-	U32 m_targetFps = 0;
-	static constexpr Bool m_doubleBuffer = true;
-	/// Create a fullscreen window with the desktop's resolution
-	Bool m_fullscreenDesktopRez = false;
-	Bool m_exclusiveFullscreen = false;
-	Bool m_borderless = false;
-	Bool m_maximized = false;
-
-	CString m_title = "AnKi";
-};
+ANKI_CVAR(NumericCVar<U32>, Window, Width, 1920, 16, 16 * 1024, "Width")
+ANKI_CVAR(NumericCVar<U32>, Window, Height, 1080, 16, 16 * 1024, "Height")
+ANKI_CVAR(NumericCVar<U32>, Window, Fullscreen, 1, 0, 2, "0: windowed, 1: borderless fullscreen, 2: exclusive fullscreen")
+ANKI_CVAR(BoolCVar, Window, Maximized, false, "Maximize")
+ANKI_CVAR(BoolCVar, Window, Borderless, false, "Borderless")
 
 /// Native window.
 class NativeWindow : public MakeSingletonPtr<NativeWindow>
@@ -39,7 +25,7 @@ class NativeWindow : public MakeSingletonPtr<NativeWindow>
 	friend class MakeSingletonPtr;
 
 public:
-	Error init(const NativeWindowInitInfo& inf);
+	Error init(U32 targetFps, CString title);
 
 	U32 getWidth() const
 	{

+ 26 - 14
AnKi/Window/NativeWindowSdl.cpp

@@ -36,9 +36,9 @@ void MakeSingletonPtr<NativeWindow>::freeSingleton()
 	}
 }
 
-Error NativeWindow::init(const NativeWindowInitInfo& inf)
+Error NativeWindow::init([[maybe_unused]] U32 targetFps, CString title)
 {
-	return static_cast<NativeWindowSdl*>(this)->initSdl(inf);
+	return static_cast<NativeWindowSdl*>(this)->initSdl(title);
 }
 
 void NativeWindow::setWindowTitle(CString title)
@@ -58,7 +58,7 @@ NativeWindowSdl::~NativeWindowSdl()
 	SDL_Quit();
 }
 
-Error NativeWindowSdl::initSdl(const NativeWindowInitInfo& init)
+Error NativeWindowSdl::initSdl(CString title)
 {
 #if ANKI_OS_WINDOWS
 	// Tell windows that the app will handle scaling. Otherwise SDL_GetDesktopDisplayMode will return a resolution that has the scaling applied
@@ -96,19 +96,20 @@ Error NativeWindowSdl::initSdl(const NativeWindowInitInfo& init)
 	flags |= SDL_WINDOW_VULKAN;
 #endif
 
-	if(init.m_borderless)
+	if(g_cvarWindowBorderless)
 	{
 		flags |= SDL_WINDOW_BORDERLESS;
 	}
 
-	if(init.m_maximized)
+	if(g_cvarWindowMaximized)
 	{
 		flags |= SDL_WINDOW_MAXIMIZED | SDL_WINDOW_RESIZABLE;
 	}
 
-	if(init.m_fullscreenDesktopRez)
+	U32 width, height;
+	if(g_cvarWindowFullscreen > 0)
 	{
-		if(init.m_exclusiveFullscreen)
+		if(g_cvarWindowFullscreen == 2)
 		{
 			flags |= SDL_WINDOW_FULLSCREEN;
 		}
@@ -128,16 +129,16 @@ Error NativeWindowSdl::initSdl(const NativeWindowInitInfo& init)
 			return Error::kFunctionFailed;
 		}
 
-		m_width = U32(F32(mode->w) * mode->pixel_density);
-		m_height = U32(F32(mode->h) * mode->pixel_density);
+		width = U32(F32(mode->w) * mode->pixel_density);
+		height = U32(F32(mode->h) * mode->pixel_density);
 	}
 	else
 	{
-		m_width = init.m_width;
-		m_height = init.m_height;
+		width = g_cvarWindowWidth;
+		height = g_cvarWindowHeight;
 	}
 
-	m_sdlWindow = SDL_CreateWindow(&init.m_title[0], m_width, m_height, flags);
+	m_sdlWindow = SDL_CreateWindow(title.cstr(), width, height, flags);
 
 	if(m_sdlWindow == nullptr)
 	{
@@ -150,11 +151,22 @@ Error NativeWindowSdl::initSdl(const NativeWindowInitInfo& init)
 		ANKI_WIND_LOGE("SDL_ShowWindow() failed: %s", SDL_GetError());
 	}
 
-	// Final check
+	// Get the actual width and height
 	{
 		int w, h;
 		SDL_GetWindowSize(m_sdlWindow, &w, &h);
-		ANKI_ASSERT(m_width == U32(w) && m_height == U32(h));
+
+		if(g_cvarWindowMaximized)
+		{
+			m_width = w;
+			m_height = h;
+		}
+		else
+		{
+			m_width = width;
+			m_height = height;
+			ANKI_ASSERT(m_width == U32(w) && m_height == U32(h));
+		}
 	}
 
 	ANKI_WIND_LOGI("SDL window created");

+ 1 - 1
AnKi/Window/NativeWindowSdl.h

@@ -18,7 +18,7 @@ public:
 
 	~NativeWindowSdl();
 
-	Error initSdl(const NativeWindowInitInfo& init);
+	Error initSdl(CString title);
 
 private:
 	static constexpr U32 kInitSubsystems = SDL_INIT_VIDEO | SDL_INIT_JOYSTICK | SDL_INIT_EVENTS | SDL_INIT_GAMEPAD;

+ 1 - 1
Samples/SkeletalAnimation/Assets/Scene.lua

@@ -4,7 +4,7 @@ local events = getEventManager()
 
 node = scene:newSceneNode("droid.001")
 node:newModelComponent():loadModelResource("Assets/Mesh_Robot.001_514ce62fac09d811.ankimdl")
-node:newSkinComponent():loadSkeletonResource("Assets/Armature.002_9ddcea0a08bd9d11.ankiskel")
+node:newSkinComponent():setSkeletonFilename("Assets/Armature.002_9ddcea0a08bd9d11.ankiskel")
 trf = Transform.new()
 trf:setOrigin(Vec3.new(0.000000, 0.000000, 0.000000))
 rot = Mat3.new()

+ 1 - 1
Samples/Sponza/Assets/Scene.lua

@@ -47,7 +47,7 @@ node:newMaterialComponent():setMaterialFilename("Assets/skinFace_37e531adb0394fd
 node:newMaterialComponent():setMaterialFilename("Assets/ChainMail_e54428975578d25.ankimtl"):setSubmeshIndex(2)
 node:newMaterialComponent():setMaterialFilename("Assets/Leather_d5d86863309c9f2b.ankimtl"):setSubmeshIndex(3)
 node:newMaterialComponent():setMaterialFilename("Assets/material_cf698120548b7e7c.ankimtl"):setSubmeshIndex(4)
-node:newSkinComponent():loadSkeletonResource("Assets/Armature_de7b8c5e15ab3f1c.ankiskel")
+node:newSkinComponent():setSkeletonFilename("Assets/Armature_de7b8c5e15ab3f1c.ankiskel")
 trf = Transform.new()
 trf:setOrigin(Vec3.new(-8.969524, 0.000000, 0.000000))
 rot = Mat3.new()

+ 2 - 5
Tools/Editor/EditorMain.cpp

@@ -64,10 +64,7 @@ public:
 
 			if(m_sceneLuaFname)
 			{
-				String dataPaths = CString(g_cvarRsrcDataPaths);
-				dataPaths += ":";
-				dataPaths += CString(g_cvarEditorScene);
-				g_cvarRsrcDataPaths = dataPaths;
+				g_cvarRsrcDataPaths = CString(g_cvarEditorScene);
 			}
 			else
 			{
@@ -110,7 +107,7 @@ public:
 			mousePosOn1stClick = in.getMousePositionNdc();
 		}
 
-		if(in.getMouseButton(MouseButton::kRight) > 0)
+		if(in.getMouseButton(MouseButton::kRight) > 0 && !m_editorUiNode->m_editorUi.m_mouseHoveredOverAnyWindow)
 		{
 			in.hideCursor(true);