From 9cc6566e0a66654384b56b2d1bde9aa563b0d9a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tur=C3=A1nszki=20J=C3=A1nos?= Date: Fri, 19 Aug 2022 08:43:10 +0200 Subject: [PATCH] Editor updates (#515) * renderer and postprocess windows combined into graphics window * graphics window layout resize * camera resizelayout, replace unordered map in terraingenerator for linux * material userdata * graphics window update --- Editor/CMakeLists.txt | 3 +- Editor/CameraWindow.cpp | 60 +- Editor/CameraWindow.h | 2 + Editor/Editor.cpp | 97 +- Editor/Editor.h | 6 - Editor/Editor_SOURCE.vcxitems | 6 +- Editor/Editor_SOURCE.vcxitems.filters | 6 +- ...{RendererWindow.cpp => GraphicsWindow.cpp} | 1103 ++++++++++++----- Editor/{RendererWindow.h => GraphicsWindow.h} | 104 +- Editor/OptionsWindow.cpp | 68 +- Editor/OptionsWindow.h | 11 +- Editor/PostprocessWindow.cpp | 411 ------ Editor/PostprocessWindow.h | 50 - Editor/TerrainGenerator.h | 5 + Editor/WeatherWindow.cpp | 2 +- WickedEngine/shaders/ShaderInterop_Renderer.h | 3 + WickedEngine/wiECS.h | 1 - WickedEngine/wiGUI.cpp | 35 +- WickedEngine/wiScene.cpp | 1 + WickedEngine/wiScene.h | 3 +- WickedEngine/wiScene_Serializers.cpp | 10 + WickedEngine/wiVersion.cpp | 2 +- 22 files changed, 1030 insertions(+), 959 deletions(-) rename Editor/{RendererWindow.cpp => GraphicsWindow.cpp} (52%) rename Editor/{RendererWindow.h => GraphicsWindow.h} (59%) delete mode 100644 Editor/PostprocessWindow.cpp delete mode 100644 Editor/PostprocessWindow.h diff --git a/Editor/CMakeLists.txt b/Editor/CMakeLists.txt index c5de17ff5..bbfb65d22 100644 --- a/Editor/CMakeLists.txt +++ b/Editor/CMakeLists.txt @@ -21,8 +21,7 @@ set (SOURCE_FILES NameWindow.cpp ObjectWindow.cpp PaintToolWindow.cpp - PostprocessWindow.cpp - RendererWindow.cpp + GraphicsWindow.cpp SoundWindow.cpp SpringWindow.cpp stdafx.cpp diff --git a/Editor/CameraWindow.cpp b/Editor/CameraWindow.cpp index 4d4abf1bf..464e41d87 100644 --- a/Editor/CameraWindow.cpp +++ b/Editor/CameraWindow.cpp @@ -38,7 +38,7 @@ void CameraWindow::Create(EditorComponent* _editor) editor->GetCurrentEditorScene().camera_transform.MatrixTransform(editor->GetCurrentEditorScene().camera.GetInvView()); editor->GetCurrentEditorScene().camera_transform.UpdateTransform(); - SetSize(XMFLOAT2(320, 360)); + SetSize(XMFLOAT2(320, 390)); float x = 140; float y = 0; @@ -264,3 +264,61 @@ void CameraWindow::Update() editor->GetCurrentEditorScene().camera_transform.MatrixTransform(camera.InvView); } } + +void CameraWindow::ResizeLayout() +{ + wi::gui::Window::ResizeLayout(); + const float padding = 4; + const float width = GetWidgetAreaSize().x; + float y = padding; + float jump = 20; + + auto add = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = 155; + const float margin_right = 45; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_right = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_right = 45; + widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_fullwidth = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = padding; + const float margin_right = padding; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + + add(farPlaneSlider); + add(nearPlaneSlider); + add(fovSlider); + add(focalLengthSlider); + add(apertureSizeSlider); + add(apertureShapeXSlider); + add(apertureShapeYSlider); + add(movespeedSlider); + add(rotationspeedSlider); + add(accelerationSlider); + add(resetButton); + add_right(fpsCheckBox); + + y += 20; + + add(proxyButton); + add_right(followCheckBox); + add(followSlider); + +} diff --git a/Editor/CameraWindow.h b/Editor/CameraWindow.h index 2e9baac50..11210605e 100644 --- a/Editor/CameraWindow.h +++ b/Editor/CameraWindow.h @@ -32,5 +32,7 @@ public: wi::gui::Button proxyButton; wi::gui::CheckBox followCheckBox; wi::gui::Slider followSlider; + + void ResizeLayout() override; }; diff --git a/Editor/Editor.cpp b/Editor/Editor.cpp index a3d34ecd5..1a0a0586f 100644 --- a/Editor/Editor.cpp +++ b/Editor/Editor.cpp @@ -76,57 +76,9 @@ void EditorLoadingScreen::Update(float dt) LoadingScreen::Update(dt); } -void EditorComponent::ChangeRenderPath(RENDERPATH path) -{ - switch (path) - { - case EditorComponent::RENDERPATH_DEFAULT: - renderPath = std::make_unique(); - optionsWnd.pathTraceTargetSlider.SetVisible(false); - optionsWnd.pathTraceStatisticsLabel.SetVisible(false); - break; - case EditorComponent::RENDERPATH_PATHTRACING: - renderPath = std::make_unique(); - optionsWnd.pathTraceTargetSlider.SetVisible(true); - optionsWnd.pathTraceStatisticsLabel.SetVisible(true); - break; - default: - assert(0); - break; - } - - if (scenes.empty()) - { - NewScene(); - } - else - { - SetCurrentScene(current_scene); - } - - renderPath->resolutionScale = resolutionScale; - renderPath->setBloomThreshold(3.0f); - - renderPath->Load(); - - // Destroy and recreate renderer and postprocess windows: - - optionsWnd.RemoveWidget(&optionsWnd.rendererWnd); - optionsWnd.rendererWnd = {}; - optionsWnd.rendererWnd.Create(this); - optionsWnd.AddWidget(&optionsWnd.rendererWnd); - - optionsWnd.RemoveWidget(&optionsWnd.postprocessWnd); - optionsWnd.postprocessWnd = {}; - optionsWnd.postprocessWnd.Create(this); - optionsWnd.AddWidget(&optionsWnd.postprocessWnd); - - optionsWnd.themeCombo.SetSelected(optionsWnd.themeCombo.GetSelected()); // destroyed windows need theme set again -} - void EditorComponent::ResizeBuffers() { - optionsWnd.rendererWnd.UpdateSwapChainFormats(&main->swapChain); + optionsWnd.graphicsWnd.UpdateSwapChainFormats(&main->swapChain); init(main->canvas); RenderPath2D::ResizeBuffers(); @@ -738,12 +690,11 @@ void EditorComponent::Update(float dt) inspector_mode = wi::input::Down((wi::input::BUTTON)'I'); // Begin picking: - unsigned int pickMask = optionsWnd.rendererWnd.GetPickType(); Ray pickRay = wi::renderer::GetPickRay((long)currentMouse.x, (long)currentMouse.y, *this, camera); { hovered = wi::scene::PickResult(); - if (pickMask & PICK_LIGHT) + if (has_flag(optionsWnd.filter, OptionsWindow::Filter::Light)) { for (size_t i = 0; i < scene.lights.GetCount(); ++i) { @@ -762,7 +713,7 @@ void EditorComponent::Update(float dt) } } } - if (pickMask & PICK_DECAL) + if (has_flag(optionsWnd.filter, OptionsWindow::Filter::Decal)) { for (size_t i = 0; i < scene.decals.GetCount(); ++i) { @@ -781,7 +732,7 @@ void EditorComponent::Update(float dt) } } } - if (pickMask & PICK_FORCEFIELD) + if (has_flag(optionsWnd.filter, OptionsWindow::Filter::Force)) { for (size_t i = 0; i < scene.forces.GetCount(); ++i) { @@ -800,7 +751,7 @@ void EditorComponent::Update(float dt) } } } - if (pickMask & PICK_EMITTER) + if (has_flag(optionsWnd.filter, OptionsWindow::Filter::Emitter)) { for (size_t i = 0; i < scene.emitters.GetCount(); ++i) { @@ -819,7 +770,7 @@ void EditorComponent::Update(float dt) } } } - if (pickMask & PICK_HAIR) + if (has_flag(optionsWnd.filter, OptionsWindow::Filter::Hairparticle)) { for (size_t i = 0; i < scene.hairs.GetCount(); ++i) { @@ -838,7 +789,7 @@ void EditorComponent::Update(float dt) } } } - if (pickMask & PICK_ENVPROBE) + if (has_flag(optionsWnd.filter, OptionsWindow::Filter::EnvironmentProbe)) { for (size_t i = 0; i < scene.probes.GetCount(); ++i) { @@ -859,7 +810,7 @@ void EditorComponent::Update(float dt) } } } - if (pickMask & PICK_CAMERA) + if (has_flag(optionsWnd.filter, OptionsWindow::Filter::Camera)) { for (size_t i = 0; i < scene.cameras.GetCount(); ++i) { @@ -878,7 +829,7 @@ void EditorComponent::Update(float dt) } } } - if (pickMask & PICK_ARMATURE) + if (has_flag(optionsWnd.filter, OptionsWindow::Filter::Armature)) { for (size_t i = 0; i < scene.armatures.GetCount(); ++i) { @@ -897,7 +848,7 @@ void EditorComponent::Update(float dt) } } } - if (pickMask & PICK_SOUND) + if (has_flag(optionsWnd.filter, OptionsWindow::Filter::Sound)) { for (size_t i = 0; i < scene.sounds.GetCount(); ++i) { @@ -973,7 +924,7 @@ void EditorComponent::Update(float dt) } } - if ((pickMask & PICK_OBJECT) && hovered.entity == INVALID_ENTITY) + if (hovered.entity == INVALID_ENTITY) { // Object picking only when mouse button down, because it can be slow with high polycount if ( @@ -983,7 +934,7 @@ void EditorComponent::Update(float dt) inspector_mode ) { - hovered = wi::scene::Pick(pickRay, pickMask, ~0u, scene); + hovered = wi::scene::Pick(pickRay, ~0u, ~0u, scene); } } } @@ -1136,7 +1087,7 @@ void EditorComponent::Update(float dt) if (wi::input::Press((wi::input::BUTTON)'W')) { wi::renderer::SetWireRender(!wi::renderer::IsWireRender()); - optionsWnd.rendererWnd.wireFrameCheckBox.SetCheck(wi::renderer::IsWireRender()); + optionsWnd.graphicsWnd.wireFrameCheckBox.SetCheck(wi::renderer::IsWireRender()); } // Enable transform tool if (wi::input::Press((wi::input::BUTTON)'T')) @@ -1462,7 +1413,7 @@ void EditorComponent::Update(float dt) wi::RenderPath3D_PathTracing* pathtracer = dynamic_cast(renderPath.get()); if (pathtracer != nullptr) { - pathtracer->setTargetSampleCount((int)optionsWnd.pathTraceTargetSlider.GetValue()); + pathtracer->setTargetSampleCount((int)optionsWnd.graphicsWnd.pathTraceTargetSlider.GetValue()); std::string ss; ss += "Sample count: " + std::to_string(pathtracer->getCurrentSampleCount()) + "\n"; @@ -1478,7 +1429,7 @@ void EditorComponent::Update(float dt) { ss += "Denoiser not available!\nTo find out how to enable the denoiser, visit the documentation."; } - optionsWnd.pathTraceStatisticsLabel.SetText(ss); + optionsWnd.graphicsWnd.pathTraceStatisticsLabel.SetText(ss); } optionsWnd.terragen.Generation_Update(camera); @@ -1743,7 +1694,7 @@ void EditorComponent::Render() const fp.shadowColor = wi::Color::Shadow(); fp.shadow_softness = 1; - if (optionsWnd.rendererWnd.GetPickType() & PICK_LIGHT) + if (has_flag(optionsWnd.filter, OptionsWindow::Filter::Light)) { for (size_t i = 0; i < scene.lights.GetCount(); ++i) { @@ -1787,7 +1738,7 @@ void EditorComponent::Render() const } } - if (optionsWnd.rendererWnd.GetPickType() & PICK_DECAL) + if (has_flag(optionsWnd.filter, OptionsWindow::Filter::Decal)) { for (size_t i = 0; i < scene.decals.GetCount(); ++i) { @@ -1819,7 +1770,7 @@ void EditorComponent::Render() const } } - if (optionsWnd.rendererWnd.GetPickType() & PICK_FORCEFIELD) + if (has_flag(optionsWnd.filter, OptionsWindow::Filter::Force)) { for (size_t i = 0; i < scene.forces.GetCount(); ++i) { @@ -1850,7 +1801,7 @@ void EditorComponent::Render() const } } - if (optionsWnd.rendererWnd.GetPickType() & PICK_CAMERA) + if (has_flag(optionsWnd.filter, OptionsWindow::Filter::Camera)) { for (size_t i = 0; i < scene.cameras.GetCount(); ++i) { @@ -1881,7 +1832,7 @@ void EditorComponent::Render() const } } - if (optionsWnd.rendererWnd.GetPickType() & PICK_ARMATURE) + if (has_flag(optionsWnd.filter, OptionsWindow::Filter::Armature)) { for (size_t i = 0; i < scene.armatures.GetCount(); ++i) { @@ -1912,7 +1863,7 @@ void EditorComponent::Render() const } } - if (optionsWnd.rendererWnd.GetPickType() & PICK_EMITTER) + if (has_flag(optionsWnd.filter, OptionsWindow::Filter::Emitter)) { for (size_t i = 0; i < scene.emitters.GetCount(); ++i) { @@ -1943,7 +1894,7 @@ void EditorComponent::Render() const } } - if (optionsWnd.rendererWnd.GetPickType() & PICK_HAIR) + if (has_flag(optionsWnd.filter, OptionsWindow::Filter::Hairparticle)) { for (size_t i = 0; i < scene.hairs.GetCount(); ++i) { @@ -1974,7 +1925,7 @@ void EditorComponent::Render() const } } - if (optionsWnd.rendererWnd.GetPickType() & PICK_SOUND) + if (has_flag(optionsWnd.filter, OptionsWindow::Filter::Sound)) { for (size_t i = 0; i < scene.sounds.GetCount(); ++i) { @@ -2203,7 +2154,7 @@ void EditorComponent::Render() const } } - if (optionsWnd.rendererWnd.nameDebugCheckBox.GetCheck()) + if (optionsWnd.graphicsWnd.nameDebugCheckBox.GetCheck()) { device->EventBegin("Debug Names", cmd); struct DebugNameEntitySorter diff --git a/Editor/Editor.h b/Editor/Editor.h index d1c7931ae..62be42feb 100644 --- a/Editor/Editor.h +++ b/Editor/Editor.h @@ -35,12 +35,6 @@ public: ComponentsWindow componentsWnd; std::unique_ptr renderPath; - enum RENDERPATH - { - RENDERPATH_DEFAULT, - RENDERPATH_PATHTRACING, - }; - void ChangeRenderPath(RENDERPATH path); const wi::graphics::Texture* GetGUIBlurredBackground() const override { return renderPath->GetGUIBlurredBackground(); } void ResizeBuffers() override; diff --git a/Editor/Editor_SOURCE.vcxitems b/Editor/Editor_SOURCE.vcxitems index 47f3be92f..2cea43ad1 100644 --- a/Editor/Editor_SOURCE.vcxitems +++ b/Editor/Editor_SOURCE.vcxitems @@ -95,8 +95,7 @@ - - + @@ -150,8 +149,7 @@ - - + diff --git a/Editor/Editor_SOURCE.vcxitems.filters b/Editor/Editor_SOURCE.vcxitems.filters index 7c35abe42..c1db4dfcb 100644 --- a/Editor/Editor_SOURCE.vcxitems.filters +++ b/Editor/Editor_SOURCE.vcxitems.filters @@ -19,8 +19,7 @@ - - + @@ -97,8 +96,7 @@ - - + diff --git a/Editor/RendererWindow.cpp b/Editor/GraphicsWindow.cpp similarity index 52% rename from Editor/RendererWindow.cpp rename to Editor/GraphicsWindow.cpp index dcfef672f..66041ec00 100644 --- a/Editor/RendererWindow.cpp +++ b/Editor/GraphicsWindow.cpp @@ -1,18 +1,20 @@ #include "stdafx.h" -#include "RendererWindow.h" +#include "GraphicsWindow.h" #include "Editor.h" #include "shaders/ShaderInterop_DDGI.h" -void RendererWindow::Create(EditorComponent* _editor) +using namespace wi::graphics; + +void GraphicsWindow::Create(EditorComponent* _editor) { editor = _editor; - wi::gui::Window::Create("Renderer", wi::gui::Window::WindowControls::COLLAPSE); + wi::gui::Window::Create("Graphics", wi::gui::Window::WindowControls::COLLAPSE); wi::renderer::SetToDrawDebugEnvProbes(true); wi::renderer::SetToDrawGridHelper(true); wi::renderer::SetToDrawDebugCameras(true); - SetSize(XMFLOAT2(580, 1180)); + SetSize(XMFLOAT2(580, 1750)); float step = 21; float itemheight = 18; @@ -31,13 +33,54 @@ void RendererWindow::Create(EditorComponent* _editor) }); AddWidget(&vsyncCheckBox); - swapchainComboBox.Create("Swapchain format: "); + swapchainComboBox.Create("Display Output: "); swapchainComboBox.SetSize(XMFLOAT2(wid, itemheight)); swapchainComboBox.SetPos(XMFLOAT2(x, y += step)); swapchainComboBox.SetTooltip("Choose between different display output formats.\nIf the display doesn't support the selected format, it will switch back to a reasonable default.\nHDR formats will be only selectable when the current display supports HDR output"); AddWidget(&swapchainComboBox); UpdateSwapChainFormats(&editor->main->swapChain); + resolutionScaleSlider.Create(0.25f, 2.0f, 1.0f, 7.0f, "Resolution Scale: "); + resolutionScaleSlider.SetTooltip("Adjust the internal rendering resolution."); + resolutionScaleSlider.SetSize(XMFLOAT2(wid, itemheight)); + resolutionScaleSlider.SetPos(XMFLOAT2(x, y += step)); + resolutionScaleSlider.OnSlide([=](wi::gui::EventArgs args) { + if (editor->resolutionScale != args.fValue) + { + editor->renderPath->resolutionScale = args.fValue; + editor->resolutionScale = args.fValue; + editor->ResizeBuffers(); + } + }); + AddWidget(&resolutionScaleSlider); + + renderPathComboBox.Create("Render Path: "); + renderPathComboBox.SetSize(XMFLOAT2(wid, itemheight)); + renderPathComboBox.SetPos(XMFLOAT2(x, y += step)); + renderPathComboBox.AddItem("Default", RENDERPATH_DEFAULT); + renderPathComboBox.AddItem("Path Tracing", RENDERPATH_PATHTRACING); + renderPathComboBox.OnSelect([&](wi::gui::EventArgs args) { + ChangeRenderPath((RENDERPATH)args.userdata); + }); + renderPathComboBox.SetEnabled(true); + renderPathComboBox.SetTooltip("Choose a render path...\nPath tracing will use fallback raytracing with non-raytracing GPU, which will be slow.\nChanging render path will reset some graphics settings!"); + AddWidget(&renderPathComboBox); + + pathTraceTargetSlider.Create(1, 2048, 1024, 2047, "Sample count: "); + pathTraceTargetSlider.SetSize(XMFLOAT2(wid, itemheight)); + pathTraceTargetSlider.SetPos(XMFLOAT2(x, y += step)); + pathTraceTargetSlider.SetTooltip("The path tracing will perform this many samples per pixel."); + AddWidget(&pathTraceTargetSlider); + + pathTraceStatisticsLabel.Create("Path tracing statistics"); + pathTraceStatisticsLabel.SetSize(XMFLOAT2(wid, 70)); + pathTraceStatisticsLabel.SetPos(XMFLOAT2(x, y += step)); + AddWidget(&pathTraceStatisticsLabel); + + + renderPathComboBox.SetSelected(RENDERPATH_DEFAULT); + + occlusionCullingCheckBox.Create("Occlusion Culling: "); occlusionCullingCheckBox.SetTooltip("Toggle occlusion culling. This can boost framerate if many objects are occluded in the scene."); occlusionCullingCheckBox.SetScriptTip("SetOcclusionCullingEnabled(bool enabled)"); @@ -49,7 +92,7 @@ void RendererWindow::Create(EditorComponent* _editor) occlusionCullingCheckBox.SetCheck(wi::renderer::GetOcclusionCullingEnabled()); AddWidget(&occlusionCullingCheckBox); - visibilityComputeShadingCheckBox.Create("Visibility CS: "); + visibilityComputeShadingCheckBox.Create("Visibility Compute Shading: "); visibilityComputeShadingCheckBox.SetTooltip("Visibility Compute Shading (experimental)\nThis will shade the scene in compute shaders instead of pixel shaders\nThis has a higher initial performance cost, but it will be faster in high polygon scenes.\nIt is not compatible with MSAA and tessellation."); visibilityComputeShadingCheckBox.SetPos(XMFLOAT2(x, y += step)); visibilityComputeShadingCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); @@ -63,24 +106,8 @@ void RendererWindow::Create(EditorComponent* _editor) editor->renderPath->visibility_shading_in_compute = false; } }); - visibilityComputeShadingCheckBox.SetCheck(editor->renderPath->visibility_shading_in_compute); AddWidget(&visibilityComputeShadingCheckBox); - resolutionScaleSlider.Create(0.25f, 2.0f, 1.0f, 7.0f, "Resolution Scale: "); - resolutionScaleSlider.SetTooltip("Adjust the internal rendering resolution."); - resolutionScaleSlider.SetSize(XMFLOAT2(wid, itemheight)); - resolutionScaleSlider.SetPos(XMFLOAT2(x, y += step)); - resolutionScaleSlider.SetValue(editor->resolutionScale); - resolutionScaleSlider.OnSlide([=](wi::gui::EventArgs args) { - if (editor->resolutionScale != args.fValue) - { - editor->renderPath->resolutionScale = args.fValue; - editor->resolutionScale = args.fValue; - editor->ResizeBuffers(); - } - }); - AddWidget(&resolutionScaleSlider); - GIBoostSlider.Create(1, 10, 1.0f, 1000.0f, "GI Boost: "); GIBoostSlider.SetTooltip("Adjust the strength of GI.\nNote that values other than 1.0 will cause mismatch with path tracing reference!"); GIBoostSlider.SetSize(XMFLOAT2(wid, itemheight)); @@ -320,7 +347,7 @@ void RendererWindow::Create(EditorComponent* _editor) debugLightCullingCheckBox.SetCheck(wi::renderer::GetDebugLightCulling()); AddWidget(&debugLightCullingCheckBox); - tessellationCheckBox.Create("Tessellation Enabled: "); + tessellationCheckBox.Create("Tessellation: "); tessellationCheckBox.SetTooltip("Enable tessellation feature. You also need to specify a tessellation factor for individual objects."); tessellationCheckBox.SetPos(XMFLOAT2(x, y += step)); tessellationCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); @@ -462,31 +489,14 @@ void RendererWindow::Create(EditorComponent* _editor) MSAAComboBox.Create("MSAA: "); MSAAComboBox.SetSize(XMFLOAT2(wid, itemheight)); MSAAComboBox.SetPos(XMFLOAT2(x, y += step)); - MSAAComboBox.AddItem("Off"); - MSAAComboBox.AddItem("2"); - MSAAComboBox.AddItem("4"); - MSAAComboBox.AddItem("8"); + MSAAComboBox.AddItem("Off", 1); + MSAAComboBox.AddItem("2", 2); + MSAAComboBox.AddItem("4", 4); + MSAAComboBox.AddItem("8", 8); MSAAComboBox.OnSelect([=](wi::gui::EventArgs args) { - switch (args.iValue) - { - case 0: - editor->renderPath->setMSAASampleCount(1); - break; - case 1: - editor->renderPath->setMSAASampleCount(2); - break; - case 2: - editor->renderPath->setMSAASampleCount(4); - break; - case 3: - editor->renderPath->setMSAASampleCount(8); - break; - default: - break; - } + editor->renderPath->setMSAASampleCount((uint32_t)args.userdata); editor->ResizeBuffers(); }); - MSAAComboBox.SetSelected(0); MSAAComboBox.SetTooltip("Multisampling Anti Aliasing quality. "); AddWidget(&MSAAComboBox); @@ -558,7 +568,7 @@ void RendererWindow::Create(EditorComponent* _editor) AddWidget(&mipLodBiasSlider); raytraceBounceCountSlider.Create(1, 10, 1, 9, "Raytrace Bounces: "); - raytraceBounceCountSlider.SetTooltip("How many light bounces to compute when doing ray tracing."); + raytraceBounceCountSlider.SetTooltip("How many light bounces to compute when doing these ray tracing effects:\n- Path tracing\n- Lightmap baking"); raytraceBounceCountSlider.SetSize(XMFLOAT2(wid, itemheight)); raytraceBounceCountSlider.SetPos(XMFLOAT2(x, y += step)); raytraceBounceCountSlider.SetValue((float)wi::renderer::GetRaytraceBounceCount()); @@ -568,188 +578,6 @@ void RendererWindow::Create(EditorComponent* _editor) AddWidget(&raytraceBounceCountSlider); - - // Visualizer toggles: - y += step; - - nameDebugCheckBox.Create("Name visualizer: "); - nameDebugCheckBox.SetTooltip("Visualize the entity names in the scene"); - nameDebugCheckBox.SetPos(XMFLOAT2(x, y += step)); - nameDebugCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - AddWidget(&nameDebugCheckBox); - - physicsDebugCheckBox.Create("Physics visualizer: "); - physicsDebugCheckBox.SetTooltip("Visualize the physics world"); - physicsDebugCheckBox.SetPos(XMFLOAT2(x, y += step)); - physicsDebugCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - physicsDebugCheckBox.OnClick([](wi::gui::EventArgs args) { - wi::physics::SetDebugDrawEnabled(args.bValue); - }); - physicsDebugCheckBox.SetCheck(wi::physics::IsDebugDrawEnabled()); - AddWidget(&physicsDebugCheckBox); - - aabbDebugCheckBox.Create("AABB visualizer: "); - aabbDebugCheckBox.SetTooltip("Visualize the scene bounding boxes"); - aabbDebugCheckBox.SetScriptTip("SetDebugPartitionTreeEnabled(bool enabled)"); - aabbDebugCheckBox.SetPos(XMFLOAT2(x, y += step)); - aabbDebugCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - aabbDebugCheckBox.OnClick([](wi::gui::EventArgs args) { - wi::renderer::SetToDrawDebugPartitionTree(args.bValue); - }); - aabbDebugCheckBox.SetCheck(wi::renderer::GetToDrawDebugPartitionTree()); - AddWidget(&aabbDebugCheckBox); - - boneLinesCheckBox.Create("Bone line visualizer: "); - boneLinesCheckBox.SetTooltip("Visualize bones of armatures"); - boneLinesCheckBox.SetScriptTip("SetDebugBonesEnabled(bool enabled)"); - boneLinesCheckBox.SetPos(XMFLOAT2(x, y += step)); - boneLinesCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - boneLinesCheckBox.OnClick([](wi::gui::EventArgs args) { - wi::renderer::SetToDrawDebugBoneLines(args.bValue); - }); - boneLinesCheckBox.SetCheck(wi::renderer::GetToDrawDebugBoneLines()); - AddWidget(&boneLinesCheckBox); - - debugEmittersCheckBox.Create("Emitter visualizer: "); - debugEmittersCheckBox.SetTooltip("Visualize emitters"); - debugEmittersCheckBox.SetScriptTip("SetDebugEmittersEnabled(bool enabled)"); - debugEmittersCheckBox.SetPos(XMFLOAT2(x, y += step)); - debugEmittersCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - debugEmittersCheckBox.OnClick([](wi::gui::EventArgs args) { - wi::renderer::SetToDrawDebugEmitters(args.bValue); - }); - debugEmittersCheckBox.SetCheck(wi::renderer::GetToDrawDebugEmitters()); - AddWidget(&debugEmittersCheckBox); - - debugForceFieldsCheckBox.Create("Force Field visualizer: "); - debugForceFieldsCheckBox.SetTooltip("Visualize force fields"); - debugForceFieldsCheckBox.SetScriptTip("SetDebugForceFieldsEnabled(bool enabled)"); - debugForceFieldsCheckBox.SetPos(XMFLOAT2(x, y += step)); - debugForceFieldsCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - debugForceFieldsCheckBox.OnClick([](wi::gui::EventArgs args) { - wi::renderer::SetToDrawDebugForceFields(args.bValue); - }); - debugForceFieldsCheckBox.SetCheck(wi::renderer::GetToDrawDebugForceFields()); - AddWidget(&debugForceFieldsCheckBox); - - debugRaytraceBVHCheckBox.Create("RT BVH visualizer: "); - debugRaytraceBVHCheckBox.SetTooltip("Visualize scene BVH if raytracing is enabled"); - debugRaytraceBVHCheckBox.SetPos(XMFLOAT2(x, y += step)); - debugRaytraceBVHCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - debugRaytraceBVHCheckBox.OnClick([](wi::gui::EventArgs args) { - wi::renderer::SetRaytraceDebugBVHVisualizerEnabled(args.bValue); - }); - debugRaytraceBVHCheckBox.SetCheck(wi::renderer::GetRaytraceDebugBVHVisualizerEnabled()); - AddWidget(&debugRaytraceBVHCheckBox); - - envProbesCheckBox.Create("Env probe visualizer: "); - envProbesCheckBox.SetTooltip("Toggle visualization of environment probes as reflective spheres"); - envProbesCheckBox.SetPos(XMFLOAT2(x, y += step)); - envProbesCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - envProbesCheckBox.OnClick([](wi::gui::EventArgs args) { - wi::renderer::SetToDrawDebugEnvProbes(args.bValue); - }); - envProbesCheckBox.SetCheck(wi::renderer::GetToDrawDebugEnvProbes()); - AddWidget(&envProbesCheckBox); - - cameraVisCheckBox.Create("Camera visualizer: "); - cameraVisCheckBox.SetTooltip("Toggle visualization of camera proxies in the scene"); - cameraVisCheckBox.SetPos(XMFLOAT2(x, y += step)); - cameraVisCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - cameraVisCheckBox.OnClick([](wi::gui::EventArgs args) { - wi::renderer::SetToDrawDebugCameras(args.bValue); - }); - cameraVisCheckBox.SetCheck(wi::renderer::GetToDrawDebugCameras()); - AddWidget(&cameraVisCheckBox); - - gridHelperCheckBox.Create("Grid helper: "); - gridHelperCheckBox.SetTooltip("Toggle showing of unit visualizer grid in the world origin"); - gridHelperCheckBox.SetPos(XMFLOAT2(x, y += step)); - gridHelperCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - gridHelperCheckBox.OnClick([](wi::gui::EventArgs args) { - wi::renderer::SetToDrawGridHelper(args.bValue); - }); - gridHelperCheckBox.SetCheck(wi::renderer::GetToDrawGridHelper()); - AddWidget(&gridHelperCheckBox); - - - y += step; - - - pickTypeObjectCheckBox.Create("Pick Objects: "); - pickTypeObjectCheckBox.SetTooltip("Enable if you want to pick objects with the pointer"); - pickTypeObjectCheckBox.SetPos(XMFLOAT2(x, y += step)); - pickTypeObjectCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - pickTypeObjectCheckBox.SetCheck(true); - AddWidget(&pickTypeObjectCheckBox); - - pickTypeEnvProbeCheckBox.Create("Pick EnvProbes: "); - pickTypeEnvProbeCheckBox.SetTooltip("Enable if you want to pick environment probes with the pointer"); - pickTypeEnvProbeCheckBox.SetPos(XMFLOAT2(x, y += step)); - pickTypeEnvProbeCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - pickTypeEnvProbeCheckBox.SetCheck(true); - AddWidget(&pickTypeEnvProbeCheckBox); - - pickTypeLightCheckBox.Create("Pick Lights: "); - pickTypeLightCheckBox.SetTooltip("Enable if you want to pick lights with the pointer"); - pickTypeLightCheckBox.SetPos(XMFLOAT2(x, y += step)); - pickTypeLightCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - pickTypeLightCheckBox.SetCheck(true); - AddWidget(&pickTypeLightCheckBox); - - pickTypeDecalCheckBox.Create("Pick Decals: "); - pickTypeDecalCheckBox.SetTooltip("Enable if you want to pick decals with the pointer"); - pickTypeDecalCheckBox.SetPos(XMFLOAT2(x, y += step)); - pickTypeDecalCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - pickTypeDecalCheckBox.SetCheck(true); - AddWidget(&pickTypeDecalCheckBox); - - pickTypeForceFieldCheckBox.Create("Pick Force Fields: "); - pickTypeForceFieldCheckBox.SetTooltip("Enable if you want to pick force fields with the pointer"); - pickTypeForceFieldCheckBox.SetPos(XMFLOAT2(x, y += step)); - pickTypeForceFieldCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - pickTypeForceFieldCheckBox.SetCheck(true); - AddWidget(&pickTypeForceFieldCheckBox); - - pickTypeEmitterCheckBox.Create("Pick Emitters: "); - pickTypeEmitterCheckBox.SetTooltip("Enable if you want to pick emitters with the pointer"); - pickTypeEmitterCheckBox.SetPos(XMFLOAT2(x, y += step)); - pickTypeEmitterCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - pickTypeEmitterCheckBox.SetCheck(true); - AddWidget(&pickTypeEmitterCheckBox); - - pickTypeHairCheckBox.Create("Pick Hairs: "); - pickTypeHairCheckBox.SetTooltip("Enable if you want to pick hairs with the pointer"); - pickTypeHairCheckBox.SetPos(XMFLOAT2(x, y += step)); - pickTypeHairCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - pickTypeHairCheckBox.SetCheck(true); - AddWidget(&pickTypeHairCheckBox); - - pickTypeCameraCheckBox.Create("Pick Cameras: "); - pickTypeCameraCheckBox.SetTooltip("Enable if you want to pick cameras with the pointer"); - pickTypeCameraCheckBox.SetPos(XMFLOAT2(x, y += step)); - pickTypeCameraCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - pickTypeCameraCheckBox.SetCheck(true); - AddWidget(&pickTypeCameraCheckBox); - - pickTypeArmatureCheckBox.Create("Pick Armatures: "); - pickTypeArmatureCheckBox.SetTooltip("Enable if you want to pick armatures with the pointer"); - pickTypeArmatureCheckBox.SetPos(XMFLOAT2(x, y += step)); - pickTypeArmatureCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - pickTypeArmatureCheckBox.SetCheck(true); - AddWidget(&pickTypeArmatureCheckBox); - - pickTypeSoundCheckBox.Create("Pick Sounds: "); - pickTypeSoundCheckBox.SetTooltip("Enable if you want to pick sounds with the pointer"); - pickTypeSoundCheckBox.SetPos(XMFLOAT2(x, y += step)); - pickTypeSoundCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); - pickTypeSoundCheckBox.SetCheck(true); - AddWidget(&pickTypeSoundCheckBox); - - - step++; - - freezeCullingCameraCheckBox.Create("Freeze culling camera: "); freezeCullingCameraCheckBox.SetTooltip("Freeze culling camera update. Scene culling will not be updated with the view"); freezeCullingCameraCheckBox.SetPos(XMFLOAT2(x, y += step)); @@ -784,59 +612,476 @@ void RendererWindow::Create(EditorComponent* _editor) AddWidget(&forceDiffuseLightingCheckBox); + // Old Postprocess window params: + y += step; + x = 110; + float hei = itemheight; + wid = 140; + float mod_wid = 60; + + exposureSlider.Create(0.0f, 3.0f, 1, 10000, "Tonemap Exposure: "); + exposureSlider.SetTooltip("Set the tonemap exposure value"); + exposureSlider.SetScriptTip("RenderPath3D::SetExposure(float value)"); + exposureSlider.SetSize(XMFLOAT2(wid, hei)); + exposureSlider.SetPos(XMFLOAT2(x, y += step)); + exposureSlider.OnSlide([=](wi::gui::EventArgs args) { + editor->renderPath->setExposure(args.fValue); + }); + AddWidget(&exposureSlider); + + lensFlareCheckBox.Create("LensFlare: "); + lensFlareCheckBox.SetTooltip("Toggle visibility of light source flares. Additional setup needed per light for a lensflare to be visible."); + lensFlareCheckBox.SetScriptTip("RenderPath3D::SetLensFlareEnabled(bool value)"); + lensFlareCheckBox.SetSize(XMFLOAT2(hei, hei)); + lensFlareCheckBox.SetPos(XMFLOAT2(x, y += step)); + lensFlareCheckBox.OnClick([=](wi::gui::EventArgs args) { + editor->renderPath->setLensFlareEnabled(args.bValue); + }); + AddWidget(&lensFlareCheckBox); + + lightShaftsCheckBox.Create("LightShafts: "); + lightShaftsCheckBox.SetTooltip("Enable light shaft for directional light sources."); + lightShaftsCheckBox.SetScriptTip("RenderPath3D::SetLightShaftsEnabled(bool value)"); + lightShaftsCheckBox.SetSize(XMFLOAT2(hei, hei)); + lightShaftsCheckBox.SetPos(XMFLOAT2(x, y += step)); + lightShaftsCheckBox.OnClick([=](wi::gui::EventArgs args) { + editor->renderPath->setLightShaftsEnabled(args.bValue); + }); + AddWidget(&lightShaftsCheckBox); + + lightShaftsStrengthStrengthSlider.Create(0, 1, 0.05f, 1000, "Strength: "); + lightShaftsStrengthStrengthSlider.SetTooltip("Set light shaft strength."); + lightShaftsStrengthStrengthSlider.SetSize(XMFLOAT2(mod_wid, hei)); + lightShaftsStrengthStrengthSlider.SetPos(XMFLOAT2(x + 100, y)); + lightShaftsStrengthStrengthSlider.OnSlide([=](wi::gui::EventArgs args) { + editor->renderPath->setLightShaftsStrength(args.fValue); + }); + AddWidget(&lightShaftsStrengthStrengthSlider); + + aoComboBox.Create("AO: "); + aoComboBox.SetTooltip("Choose Ambient Occlusion type. RTAO is only available if hardware supports ray tracing"); + aoComboBox.SetScriptTip("RenderPath3D::SetAO(int value)"); + aoComboBox.SetSize(XMFLOAT2(wid, hei)); + aoComboBox.SetPos(XMFLOAT2(x, y += step)); + aoComboBox.AddItem("Disabled"); + aoComboBox.AddItem("SSAO"); + aoComboBox.AddItem("HBAO"); + aoComboBox.AddItem("MSAO"); + if (wi::graphics::GetDevice()->CheckCapability(GraphicsDeviceCapability::RAYTRACING)) + { + aoComboBox.AddItem("RTAO"); + } + aoComboBox.OnSelect([=](wi::gui::EventArgs args) { + editor->renderPath->setAO((wi::RenderPath3D::AO)args.iValue); + + switch (editor->renderPath->getAO()) + { + case wi::RenderPath3D::AO_SSAO: + aoRangeSlider.SetEnabled(true); + aoRangeSlider.SetValue(2.0f); + aoSampleCountSlider.SetEnabled(true); + aoSampleCountSlider.SetValue(9.0f); + break; + case wi::RenderPath3D::AO_RTAO: + aoRangeSlider.SetEnabled(true); + aoRangeSlider.SetValue(10.0f); + aoSampleCountSlider.SetEnabled(false); + break; + default: + aoRangeSlider.SetEnabled(false); + aoSampleCountSlider.SetEnabled(false); + break; + } + + editor->renderPath->setAORange(aoRangeSlider.GetValue()); + editor->renderPath->setAOSampleCount((uint32_t)aoSampleCountSlider.GetValue()); + }); + AddWidget(&aoComboBox); + + aoPowerSlider.Create(0.25f, 8.0f, 2, 1000, "Power: "); + aoPowerSlider.SetTooltip("Set SSAO Power. Higher values produce darker, more pronounced effect"); + aoPowerSlider.SetSize(XMFLOAT2(mod_wid, hei)); + aoPowerSlider.SetPos(XMFLOAT2(x + 100, y += step)); + aoPowerSlider.OnSlide([=](wi::gui::EventArgs args) { + editor->renderPath->setAOPower(args.fValue); + }); + AddWidget(&aoPowerSlider); + + aoRangeSlider.Create(1.0f, 100.0f, 1, 1000, "Range: "); + aoRangeSlider.SetTooltip("Set AO ray length. Only for SSAO and RTAO"); + aoRangeSlider.SetSize(XMFLOAT2(mod_wid, hei)); + aoRangeSlider.SetPos(XMFLOAT2(x + 100, y += step)); + aoRangeSlider.OnSlide([=](wi::gui::EventArgs args) { + editor->renderPath->setAORange(args.fValue); + }); + AddWidget(&aoRangeSlider); + + aoSampleCountSlider.Create(1, 16, 9, 15, "Sample Count: "); + aoSampleCountSlider.SetTooltip("Set AO ray count. Only for SSAO"); + aoSampleCountSlider.SetSize(XMFLOAT2(mod_wid, hei)); + aoSampleCountSlider.SetPos(XMFLOAT2(x + 100, y += step)); + aoSampleCountSlider.OnSlide([=](wi::gui::EventArgs args) { + editor->renderPath->setAOSampleCount(args.iValue); + }); + AddWidget(&aoSampleCountSlider); + + ssrCheckBox.Create("SSR: "); + ssrCheckBox.SetTooltip("Enable Screen Space Reflections."); + ssrCheckBox.SetScriptTip("RenderPath3D::SetSSREnabled(bool value)"); + ssrCheckBox.SetSize(XMFLOAT2(hei, hei)); + ssrCheckBox.SetPos(XMFLOAT2(x, y += step)); + ssrCheckBox.OnClick([=](wi::gui::EventArgs args) { + editor->renderPath->setSSREnabled(args.bValue); + }); + AddWidget(&ssrCheckBox); + + raytracedReflectionsCheckBox.Create("RT Reflections: "); + raytracedReflectionsCheckBox.SetTooltip("Enable Ray Traced Reflections. Only if GPU supports raytracing."); + raytracedReflectionsCheckBox.SetScriptTip("RenderPath3D::SetRaytracedReflectionsEnabled(bool value)"); + raytracedReflectionsCheckBox.SetSize(XMFLOAT2(hei, hei)); + raytracedReflectionsCheckBox.SetPos(XMFLOAT2(x + 140, y)); + raytracedReflectionsCheckBox.OnClick([=](wi::gui::EventArgs args) { + editor->renderPath->setRaytracedReflectionsEnabled(args.bValue); + }); + AddWidget(&raytracedReflectionsCheckBox); + raytracedReflectionsCheckBox.SetEnabled(wi::graphics::GetDevice()->CheckCapability(GraphicsDeviceCapability::RAYTRACING)); + + screenSpaceShadowsCheckBox.Create("Screen Shadows: "); + screenSpaceShadowsCheckBox.SetTooltip("Enable screen space contact shadows. This can add small shadows details to shadow maps in screen space."); + screenSpaceShadowsCheckBox.SetSize(XMFLOAT2(hei, hei)); + screenSpaceShadowsCheckBox.SetPos(XMFLOAT2(x, y += step)); + screenSpaceShadowsCheckBox.SetCheck(wi::renderer::GetScreenSpaceShadowsEnabled()); + screenSpaceShadowsCheckBox.OnClick([=](wi::gui::EventArgs args) { + wi::renderer::SetScreenSpaceShadowsEnabled(args.bValue); + }); + AddWidget(&screenSpaceShadowsCheckBox); + + screenSpaceShadowsRangeSlider.Create(0.1f, 10.0f, 1, 1000, "Range: "); + screenSpaceShadowsRangeSlider.SetTooltip("Range of contact shadows"); + screenSpaceShadowsRangeSlider.SetSize(XMFLOAT2(mod_wid, hei)); + screenSpaceShadowsRangeSlider.SetPos(XMFLOAT2(x + 100, y)); + screenSpaceShadowsRangeSlider.OnSlide([=](wi::gui::EventArgs args) { + editor->renderPath->setScreenSpaceShadowRange(args.fValue); + }); + AddWidget(&screenSpaceShadowsRangeSlider); + + screenSpaceShadowsStepCountSlider.Create(4, 128, 16, 128 - 4, "Samples: "); + screenSpaceShadowsStepCountSlider.SetTooltip("Sample count of contact shadows. Higher values are better quality but slower."); + screenSpaceShadowsStepCountSlider.SetSize(XMFLOAT2(mod_wid, hei)); + screenSpaceShadowsStepCountSlider.SetPos(XMFLOAT2(x + 100, y += step)); + screenSpaceShadowsStepCountSlider.OnSlide([=](wi::gui::EventArgs args) { + editor->renderPath->setScreenSpaceShadowSampleCount(args.iValue); + }); + AddWidget(&screenSpaceShadowsStepCountSlider); + + eyeAdaptionCheckBox.Create("EyeAdaption: "); + eyeAdaptionCheckBox.SetTooltip("Enable eye adaption for the overall screen luminance"); + eyeAdaptionCheckBox.SetSize(XMFLOAT2(hei, hei)); + eyeAdaptionCheckBox.SetPos(XMFLOAT2(x, y += step)); + eyeAdaptionCheckBox.OnClick([=](wi::gui::EventArgs args) { + editor->renderPath->setEyeAdaptionEnabled(args.bValue); + }); + AddWidget(&eyeAdaptionCheckBox); + + eyeAdaptionKeySlider.Create(0.01f, 0.5f, 0.1f, 10000, "Key: "); + eyeAdaptionKeySlider.SetTooltip("Set the key value for eye adaption."); + eyeAdaptionKeySlider.SetSize(XMFLOAT2(mod_wid, hei)); + eyeAdaptionKeySlider.SetPos(XMFLOAT2(x + 100, y)); + eyeAdaptionKeySlider.OnSlide([=](wi::gui::EventArgs args) { + editor->renderPath->setEyeAdaptionKey(args.fValue); + }); + AddWidget(&eyeAdaptionKeySlider); + + eyeAdaptionRateSlider.Create(0.01f, 4, 0.5f, 10000, "Rate: "); + eyeAdaptionRateSlider.SetTooltip("Set the eye adaption rate (speed of adjustment)"); + eyeAdaptionRateSlider.SetSize(XMFLOAT2(mod_wid, hei)); + eyeAdaptionRateSlider.SetPos(XMFLOAT2(x + 100, y += step)); + eyeAdaptionRateSlider.OnSlide([=](wi::gui::EventArgs args) { + editor->renderPath->setEyeAdaptionRate(args.fValue); + }); + AddWidget(&eyeAdaptionRateSlider); + + motionBlurCheckBox.Create("MotionBlur: "); + motionBlurCheckBox.SetTooltip("Enable motion blur for camera movement and animated meshes."); + motionBlurCheckBox.SetScriptTip("RenderPath3D::SetMotionBlurEnabled(bool value)"); + motionBlurCheckBox.SetSize(XMFLOAT2(hei, hei)); + motionBlurCheckBox.SetPos(XMFLOAT2(x, y += step)); + motionBlurCheckBox.OnClick([=](wi::gui::EventArgs args) { + editor->renderPath->setMotionBlurEnabled(args.bValue); + }); + AddWidget(&motionBlurCheckBox); + + motionBlurStrengthSlider.Create(0.1f, 400, 100, 10000, "Strength: "); + motionBlurStrengthSlider.SetTooltip("Set the camera shutter speed for motion blur (higher value means stronger blur)."); + motionBlurStrengthSlider.SetScriptTip("RenderPath3D::SetMotionBlurStrength(float value)"); + motionBlurStrengthSlider.SetSize(XMFLOAT2(mod_wid, hei)); + motionBlurStrengthSlider.SetPos(XMFLOAT2(x + 100, y)); + motionBlurStrengthSlider.OnSlide([=](wi::gui::EventArgs args) { + editor->renderPath->setMotionBlurStrength(args.fValue); + }); + AddWidget(&motionBlurStrengthSlider); + + depthOfFieldCheckBox.Create("DepthOfField: "); + depthOfFieldCheckBox.SetTooltip("Enable Depth of field effect. Requires additional camera setup: focal length and aperture size."); + depthOfFieldCheckBox.SetScriptTip("RenderPath3D::SetDepthOfFieldEnabled(bool value)"); + depthOfFieldCheckBox.SetSize(XMFLOAT2(hei, hei)); + depthOfFieldCheckBox.SetPos(XMFLOAT2(x, y += step)); + depthOfFieldCheckBox.OnClick([=](wi::gui::EventArgs args) { + editor->renderPath->setDepthOfFieldEnabled(args.bValue); + }); + AddWidget(&depthOfFieldCheckBox); + + depthOfFieldScaleSlider.Create(1.0f, 20, 100, 1000, "Strength: "); + depthOfFieldScaleSlider.SetTooltip("Set depth of field strength. This is used to scale the Camera's ApertureSize setting"); + depthOfFieldScaleSlider.SetScriptTip("RenderPath3D::SetDepthOfFieldStrength(float value)"); + depthOfFieldScaleSlider.SetSize(XMFLOAT2(mod_wid, hei)); + depthOfFieldScaleSlider.SetPos(XMFLOAT2(x + 100, y)); + depthOfFieldScaleSlider.OnSlide([=](wi::gui::EventArgs args) { + editor->renderPath->setDepthOfFieldStrength(args.fValue); + }); + AddWidget(&depthOfFieldScaleSlider); + + bloomCheckBox.Create("Bloom: "); + bloomCheckBox.SetTooltip("Enable bloom. The effect adds color bleeding to the brightest parts of the scene."); + bloomCheckBox.SetScriptTip("RenderPath3D::SetBloomEnabled(bool value)"); + bloomCheckBox.SetSize(XMFLOAT2(hei, hei)); + bloomCheckBox.SetPos(XMFLOAT2(x, y += step)); + bloomCheckBox.OnClick([=](wi::gui::EventArgs args) { + editor->renderPath->setBloomEnabled(args.bValue); + }); + AddWidget(&bloomCheckBox); + + bloomStrengthSlider.Create(0.0f, 10, 1, 1000, "Threshold: "); + bloomStrengthSlider.SetTooltip("Set bloom threshold. The values below this will not glow on the screen."); + bloomStrengthSlider.SetSize(XMFLOAT2(mod_wid, hei)); + bloomStrengthSlider.SetPos(XMFLOAT2(x + 100, y)); + bloomStrengthSlider.OnSlide([=](wi::gui::EventArgs args) { + editor->renderPath->setBloomThreshold(args.fValue); + }); + AddWidget(&bloomStrengthSlider); + + fxaaCheckBox.Create("FXAA: "); + fxaaCheckBox.SetTooltip("Fast Approximate Anti Aliasing. A fast antialiasing method, but can be a bit too blurry."); + fxaaCheckBox.SetScriptTip("RenderPath3D::SetFXAAEnabled(bool value)"); + fxaaCheckBox.SetSize(XMFLOAT2(hei, hei)); + fxaaCheckBox.SetPos(XMFLOAT2(x, y += step)); + fxaaCheckBox.OnClick([=](wi::gui::EventArgs args) { + editor->renderPath->setFXAAEnabled(args.bValue); + }); + AddWidget(&fxaaCheckBox); + + colorGradingCheckBox.Create("Color Grading: "); + colorGradingCheckBox.SetTooltip("Enable color grading of the final render. An additional lookup texture must be set in the Weather!"); + colorGradingCheckBox.SetSize(XMFLOAT2(hei, hei)); + colorGradingCheckBox.SetPos(XMFLOAT2(x, y += step)); + colorGradingCheckBox.OnClick([=](wi::gui::EventArgs args) { + editor->renderPath->setColorGradingEnabled(args.bValue); + }); + AddWidget(&colorGradingCheckBox); + + ditherCheckBox.Create("Dithering: "); + ditherCheckBox.SetTooltip("Toggle the full screen dithering effect. This helps to reduce color banding."); + ditherCheckBox.SetSize(XMFLOAT2(hei, hei)); + ditherCheckBox.SetPos(XMFLOAT2(x, y += step)); + ditherCheckBox.OnClick([=](wi::gui::EventArgs args) { + editor->renderPath->setDitherEnabled(args.bValue); + }); + AddWidget(&ditherCheckBox); + + sharpenFilterCheckBox.Create("Sharpen Filter: "); + sharpenFilterCheckBox.SetTooltip("Toggle sharpening post process of the final image."); + sharpenFilterCheckBox.SetScriptTip("RenderPath3D::SetSharpenFilterEnabled(bool value)"); + sharpenFilterCheckBox.SetSize(XMFLOAT2(hei, hei)); + sharpenFilterCheckBox.SetPos(XMFLOAT2(x, y += step)); + sharpenFilterCheckBox.OnClick([=](wi::gui::EventArgs args) { + editor->renderPath->setSharpenFilterEnabled(args.bValue); + }); + AddWidget(&sharpenFilterCheckBox); + + sharpenFilterAmountSlider.Create(0, 4, 1, 1000, "Amount: "); + sharpenFilterAmountSlider.SetTooltip("Set sharpness filter strength."); + sharpenFilterAmountSlider.SetScriptTip("RenderPath3D::SetSharpenFilterAmount(float value)"); + sharpenFilterAmountSlider.SetSize(XMFLOAT2(mod_wid, hei)); + sharpenFilterAmountSlider.SetPos(XMFLOAT2(x + 100, y)); + sharpenFilterAmountSlider.OnSlide([=](wi::gui::EventArgs args) { + editor->renderPath->setSharpenFilterAmount(args.fValue); + }); + AddWidget(&sharpenFilterAmountSlider); + + outlineCheckBox.Create("Cartoon Outline: "); + outlineCheckBox.SetTooltip("Toggle the full screen cartoon outline effect."); + outlineCheckBox.SetSize(XMFLOAT2(hei, hei)); + outlineCheckBox.SetPos(XMFLOAT2(x, y += step)); + outlineCheckBox.OnClick([=](wi::gui::EventArgs args) { + editor->renderPath->setOutlineEnabled(args.bValue); + }); + AddWidget(&outlineCheckBox); + + outlineThresholdSlider.Create(0, 1, 0.1f, 1000, "Threshold: "); + outlineThresholdSlider.SetTooltip("Outline edge detection threshold. Increase if not enough otlines are detected, decrease if too many outlines are detected."); + outlineThresholdSlider.SetSize(XMFLOAT2(mod_wid, hei)); + outlineThresholdSlider.SetPos(XMFLOAT2(x + 100, y)); + outlineThresholdSlider.OnSlide([=](wi::gui::EventArgs args) { + editor->renderPath->setOutlineThreshold(args.fValue); + }); + AddWidget(&outlineThresholdSlider); + + outlineThicknessSlider.Create(0, 4, 1, 1000, "Thickness: "); + outlineThicknessSlider.SetTooltip("Set outline thickness."); + outlineThicknessSlider.SetSize(XMFLOAT2(mod_wid, hei)); + outlineThicknessSlider.SetPos(XMFLOAT2(x + 100, y += step)); + outlineThicknessSlider.OnSlide([=](wi::gui::EventArgs args) { + editor->renderPath->setOutlineThickness(args.fValue); + }); + AddWidget(&outlineThicknessSlider); + + chromaticaberrationCheckBox.Create("Chromatic Aberration: "); + chromaticaberrationCheckBox.SetTooltip("Toggle the full screen chromatic aberration effect. This simulates lens distortion at screen edges."); + chromaticaberrationCheckBox.SetSize(XMFLOAT2(hei, hei)); + chromaticaberrationCheckBox.SetPos(XMFLOAT2(x, y += step)); + chromaticaberrationCheckBox.OnClick([=](wi::gui::EventArgs args) { + editor->renderPath->setChromaticAberrationEnabled(args.bValue); + }); + AddWidget(&chromaticaberrationCheckBox); + + chromaticaberrationSlider.Create(0, 4, 1.0f, 1000, "Amount: "); + chromaticaberrationSlider.SetTooltip("The lens distortion amount."); + chromaticaberrationSlider.SetSize(XMFLOAT2(mod_wid, hei)); + chromaticaberrationSlider.SetPos(XMFLOAT2(x + 100, y)); + chromaticaberrationSlider.OnSlide([=](wi::gui::EventArgs args) { + editor->renderPath->setChromaticAberrationAmount(args.fValue); + }); + AddWidget(&chromaticaberrationSlider); + + fsrCheckBox.Create("FSR: "); + fsrCheckBox.SetTooltip("FidelityFX FSR Upscaling. Use this only with Temporal AA or MSAA when the resolution scaling is lowered."); + fsrCheckBox.SetSize(XMFLOAT2(hei, hei)); + fsrCheckBox.SetPos(XMFLOAT2(x, y += step)); + fsrCheckBox.OnClick([=](wi::gui::EventArgs args) { + editor->renderPath->setFSREnabled(args.bValue); + }); + AddWidget(&fsrCheckBox); + + fsrSlider.Create(0, 2, 1.0f, 1000, "Sharpness: "); + fsrSlider.SetTooltip("The sharpening amount to apply for FSR upscaling."); + fsrSlider.SetSize(XMFLOAT2(mod_wid, hei)); + fsrSlider.SetPos(XMFLOAT2(x + 100, y)); + fsrSlider.OnSlide([=](wi::gui::EventArgs args) { + editor->renderPath->setFSRSharpness(args.fValue); + }); + AddWidget(&fsrSlider); + + + + // Visualizer toggles: + y += step; + x = 250; + + nameDebugCheckBox.Create("Name visualizer: "); + nameDebugCheckBox.SetTooltip("Visualize the entity names in the scene"); + nameDebugCheckBox.SetPos(XMFLOAT2(x, y += step)); + nameDebugCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); + AddWidget(&nameDebugCheckBox); + + physicsDebugCheckBox.Create("Physics visualizer: "); + physicsDebugCheckBox.SetTooltip("Visualize the physics world"); + physicsDebugCheckBox.SetPos(XMFLOAT2(x, y += step)); + physicsDebugCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); + physicsDebugCheckBox.OnClick([](wi::gui::EventArgs args) { + wi::physics::SetDebugDrawEnabled(args.bValue); + }); + physicsDebugCheckBox.SetCheck(wi::physics::IsDebugDrawEnabled()); + AddWidget(&physicsDebugCheckBox); + + aabbDebugCheckBox.Create("AABB visualizer: "); + aabbDebugCheckBox.SetTooltip("Visualize the scene bounding boxes"); + aabbDebugCheckBox.SetScriptTip("SetDebugPartitionTreeEnabled(bool enabled)"); + aabbDebugCheckBox.SetPos(XMFLOAT2(x, y += step)); + aabbDebugCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); + aabbDebugCheckBox.OnClick([](wi::gui::EventArgs args) { + wi::renderer::SetToDrawDebugPartitionTree(args.bValue); + }); + aabbDebugCheckBox.SetCheck(wi::renderer::GetToDrawDebugPartitionTree()); + AddWidget(&aabbDebugCheckBox); + + boneLinesCheckBox.Create("Bone line visualizer: "); + boneLinesCheckBox.SetTooltip("Visualize bones of armatures"); + boneLinesCheckBox.SetScriptTip("SetDebugBonesEnabled(bool enabled)"); + boneLinesCheckBox.SetPos(XMFLOAT2(x, y += step)); + boneLinesCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); + boneLinesCheckBox.OnClick([](wi::gui::EventArgs args) { + wi::renderer::SetToDrawDebugBoneLines(args.bValue); + }); + boneLinesCheckBox.SetCheck(wi::renderer::GetToDrawDebugBoneLines()); + AddWidget(&boneLinesCheckBox); + + debugEmittersCheckBox.Create("Emitter visualizer: "); + debugEmittersCheckBox.SetTooltip("Visualize emitters"); + debugEmittersCheckBox.SetScriptTip("SetDebugEmittersEnabled(bool enabled)"); + debugEmittersCheckBox.SetPos(XMFLOAT2(x, y += step)); + debugEmittersCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); + debugEmittersCheckBox.OnClick([](wi::gui::EventArgs args) { + wi::renderer::SetToDrawDebugEmitters(args.bValue); + }); + debugEmittersCheckBox.SetCheck(wi::renderer::GetToDrawDebugEmitters()); + AddWidget(&debugEmittersCheckBox); + + debugForceFieldsCheckBox.Create("Force Field visualizer: "); + debugForceFieldsCheckBox.SetTooltip("Visualize force fields"); + debugForceFieldsCheckBox.SetScriptTip("SetDebugForceFieldsEnabled(bool enabled)"); + debugForceFieldsCheckBox.SetPos(XMFLOAT2(x, y += step)); + debugForceFieldsCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); + debugForceFieldsCheckBox.OnClick([](wi::gui::EventArgs args) { + wi::renderer::SetToDrawDebugForceFields(args.bValue); + }); + debugForceFieldsCheckBox.SetCheck(wi::renderer::GetToDrawDebugForceFields()); + AddWidget(&debugForceFieldsCheckBox); + + debugRaytraceBVHCheckBox.Create("RT BVH visualizer: "); + debugRaytraceBVHCheckBox.SetTooltip("Visualize scene BVH if raytracing is enabled"); + debugRaytraceBVHCheckBox.SetPos(XMFLOAT2(x, y += step)); + debugRaytraceBVHCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); + debugRaytraceBVHCheckBox.OnClick([](wi::gui::EventArgs args) { + wi::renderer::SetRaytraceDebugBVHVisualizerEnabled(args.bValue); + }); + debugRaytraceBVHCheckBox.SetCheck(wi::renderer::GetRaytraceDebugBVHVisualizerEnabled()); + AddWidget(&debugRaytraceBVHCheckBox); + + envProbesCheckBox.Create("Env probe visualizer: "); + envProbesCheckBox.SetTooltip("Toggle visualization of environment probes as reflective spheres"); + envProbesCheckBox.SetPos(XMFLOAT2(x, y += step)); + envProbesCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); + envProbesCheckBox.OnClick([](wi::gui::EventArgs args) { + wi::renderer::SetToDrawDebugEnvProbes(args.bValue); + }); + envProbesCheckBox.SetCheck(wi::renderer::GetToDrawDebugEnvProbes()); + AddWidget(&envProbesCheckBox); + + cameraVisCheckBox.Create("Camera visualizer: "); + cameraVisCheckBox.SetTooltip("Toggle visualization of camera proxies in the scene"); + cameraVisCheckBox.SetPos(XMFLOAT2(x, y += step)); + cameraVisCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); + cameraVisCheckBox.OnClick([](wi::gui::EventArgs args) { + wi::renderer::SetToDrawDebugCameras(args.bValue); + }); + cameraVisCheckBox.SetCheck(wi::renderer::GetToDrawDebugCameras()); + AddWidget(&cameraVisCheckBox); + + gridHelperCheckBox.Create("Grid helper: "); + gridHelperCheckBox.SetTooltip("Toggle showing of unit visualizer grid in the world origin"); + gridHelperCheckBox.SetPos(XMFLOAT2(x, y += step)); + gridHelperCheckBox.SetSize(XMFLOAT2(itemheight, itemheight)); + gridHelperCheckBox.OnClick([](wi::gui::EventArgs args) { + wi::renderer::SetToDrawGridHelper(args.bValue); + }); + gridHelperCheckBox.SetCheck(wi::renderer::GetToDrawGridHelper()); + AddWidget(&gridHelperCheckBox); Translate(XMFLOAT3(100, 50, 0)); SetMinimized(true); } -uint32_t RendererWindow::GetPickType() const -{ - uint32_t pickType = PICK_VOID; - if (pickTypeObjectCheckBox.GetCheck()) - { - pickType |= PICK_OBJECT; - } - if (pickTypeEnvProbeCheckBox.GetCheck()) - { - pickType |= PICK_ENVPROBE; - } - if (pickTypeLightCheckBox.GetCheck()) - { - pickType |= PICK_LIGHT; - } - if (pickTypeDecalCheckBox.GetCheck()) - { - pickType |= PICK_DECAL; - } - if (pickTypeForceFieldCheckBox.GetCheck()) - { - pickType |= PICK_FORCEFIELD; - } - if (pickTypeEmitterCheckBox.GetCheck()) - { - pickType |= PICK_EMITTER; - } - if (pickTypeHairCheckBox.GetCheck()) - { - pickType |= PICK_HAIR; - } - if (pickTypeCameraCheckBox.GetCheck()) - { - pickType |= PICK_CAMERA; - } - if (pickTypeArmatureCheckBox.GetCheck()) - { - pickType |= PICK_ARMATURE; - } - if (pickTypeSoundCheckBox.GetCheck()) - { - pickType |= PICK_SOUND; - } - - return pickType; -} - -void RendererWindow::UpdateSwapChainFormats(wi::graphics::SwapChain* swapChain) +void GraphicsWindow::UpdateSwapChainFormats(wi::graphics::SwapChain* swapChain) { swapchainComboBox.OnSelect(nullptr); swapchainComboBox.ClearItems(); @@ -906,7 +1151,7 @@ void RendererWindow::UpdateSwapChainFormats(wi::graphics::SwapChain* swapChain) }); } -void RendererWindow::Update() +void GraphicsWindow::Update() { if (IsCollapsed()) return; @@ -916,4 +1161,308 @@ void RendererWindow::Update() ddgiX.SetValue(std::to_string(scene.ddgi.grid_dimensions.x)); ddgiY.SetValue(std::to_string(scene.ddgi.grid_dimensions.y)); ddgiZ.SetValue(std::to_string(scene.ddgi.grid_dimensions.z)); + + visibilityComputeShadingCheckBox.SetCheck(editor->renderPath->visibility_shading_in_compute); + resolutionScaleSlider.SetValue(editor->resolutionScale); + MSAAComboBox.SetSelectedByUserdataWithoutCallback(editor->renderPath->getMSAASampleCount()); + exposureSlider.SetValue(editor->renderPath->getExposure()); + lensFlareCheckBox.SetCheck(editor->renderPath->getLensFlareEnabled()); + lightShaftsCheckBox.SetCheck(editor->renderPath->getLightShaftsEnabled()); + lightShaftsStrengthStrengthSlider.SetValue(editor->renderPath->getLightShaftsStrength()); + aoComboBox.SetSelectedWithoutCallback(editor->renderPath->getAO()); + aoPowerSlider.SetValue((float)editor->renderPath->getAOPower()); + aoRangeSlider.SetValue((float)editor->renderPath->getAOPower()); + aoSampleCountSlider.SetValue((float)editor->renderPath->getAOPower()); + ssrCheckBox.SetCheck(editor->renderPath->getSSREnabled()); + raytracedReflectionsCheckBox.SetCheck(editor->renderPath->getRaytracedReflectionEnabled()); + screenSpaceShadowsRangeSlider.SetValue((float)editor->renderPath->getScreenSpaceShadowRange()); + screenSpaceShadowsStepCountSlider.SetValue((float)editor->renderPath->getScreenSpaceShadowSampleCount()); + eyeAdaptionCheckBox.SetCheck(editor->renderPath->getEyeAdaptionEnabled()); + eyeAdaptionKeySlider.SetValue(editor->renderPath->getEyeAdaptionKey()); + eyeAdaptionRateSlider.SetValue(editor->renderPath->getEyeAdaptionRate()); + motionBlurCheckBox.SetCheck(editor->renderPath->getMotionBlurEnabled()); + motionBlurStrengthSlider.SetValue(editor->renderPath->getMotionBlurStrength()); + depthOfFieldCheckBox.SetCheck(editor->renderPath->getDepthOfFieldEnabled()); + depthOfFieldScaleSlider.SetValue(editor->renderPath->getDepthOfFieldStrength()); + bloomCheckBox.SetCheck(editor->renderPath->getBloomEnabled()); + bloomStrengthSlider.SetValue(editor->renderPath->getBloomThreshold()); + fxaaCheckBox.SetCheck(editor->renderPath->getFXAAEnabled()); + colorGradingCheckBox.SetCheck(editor->renderPath->getColorGradingEnabled()); + ditherCheckBox.SetCheck(editor->renderPath->getDitherEnabled()); + sharpenFilterCheckBox.SetCheck(editor->renderPath->getSharpenFilterEnabled()); + sharpenFilterAmountSlider.SetValue(editor->renderPath->getSharpenFilterAmount()); + outlineCheckBox.SetCheck(editor->renderPath->getOutlineEnabled()); + outlineThresholdSlider.SetValue(editor->renderPath->getOutlineThreshold()); + outlineThicknessSlider.SetValue(editor->renderPath->getOutlineThickness()); + chromaticaberrationCheckBox.SetCheck(editor->renderPath->getOutlineEnabled()); + chromaticaberrationSlider.SetValue(editor->renderPath->getChromaticAberrationAmount()); + fsrCheckBox.SetCheck(editor->renderPath->getFSREnabled()); + fsrSlider.SetValue(editor->renderPath->getFSRSharpness()); +} + +void GraphicsWindow::ChangeRenderPath(RENDERPATH path) +{ + switch (path) + { + case RENDERPATH_DEFAULT: + editor->renderPath = std::make_unique(); + break; + case RENDERPATH_PATHTRACING: + editor->renderPath = std::make_unique(); + break; + default: + assert(0); + break; + } + + if (editor->scenes.empty()) + { + editor->NewScene(); + } + else + { + editor->SetCurrentScene(editor->current_scene); + } + + editor->renderPath->resolutionScale = editor->resolutionScale; + editor->renderPath->setBloomThreshold(3.0f); + + editor->renderPath->Load(); + editor->ResizeBuffers(); +} + +void GraphicsWindow::ResizeLayout() +{ + wi::gui::Window::ResizeLayout(); + const float padding = 4; + const float width = GetWidgetAreaSize().x; + float y = padding; + float jump = 20; + + auto add = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = 155; + const float margin_right = 45; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_right = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_right = 45; + widget.SetPos(XMFLOAT2(width - margin_right - widget.GetSize().x, y)); + y += widget.GetSize().y; + y += padding; + }; + auto add_fullwidth = [&](wi::gui::Widget& widget) { + if (!widget.IsVisible()) + return; + const float margin_left = padding; + const float margin_right = padding; + widget.SetPos(XMFLOAT2(margin_left, y)); + widget.SetSize(XMFLOAT2(width - margin_left - margin_right, widget.GetScale().y)); + y += widget.GetSize().y; + y += padding; + }; + + RENDERPATH renderpath = (RENDERPATH)renderPathComboBox.GetItemUserData(renderPathComboBox.GetSelected()); + + add_right(vsyncCheckBox); + add(swapchainComboBox); + add(renderPathComboBox); + add(resolutionScaleSlider); + add(speedMultiplierSlider); + add(textureQualityComboBox); + add(mipLodBiasSlider); + + if (renderpath == RENDERPATH_PATHTRACING) + { + shadowTypeComboBox.SetVisible(false); + shadowProps2DComboBox.SetVisible(false); + shadowPropsCubeComboBox.SetVisible(false); + MSAAComboBox.SetVisible(false); + temporalAADebugCheckBox.SetVisible(false); + temporalAACheckBox.SetVisible(false); + variableRateShadingClassificationDebugCheckBox.SetVisible(false); + variableRateShadingClassificationCheckBox.SetVisible(false); + debugLightCullingCheckBox.SetVisible(false); + advancedLightCullingCheckBox.SetVisible(false); + occlusionCullingCheckBox.SetVisible(false); + visibilityComputeShadingCheckBox.SetVisible(false); + tessellationCheckBox.SetVisible(false); + transparentShadowsCheckBox.SetVisible(false); + } + else + { + shadowTypeComboBox.SetVisible(true); + shadowProps2DComboBox.SetVisible(true); + shadowPropsCubeComboBox.SetVisible(true); + MSAAComboBox.SetVisible(true); + temporalAADebugCheckBox.SetVisible(true); + temporalAACheckBox.SetVisible(true); + variableRateShadingClassificationDebugCheckBox.SetVisible(true); + variableRateShadingClassificationCheckBox.SetVisible(true); + debugLightCullingCheckBox.SetVisible(true); + advancedLightCullingCheckBox.SetVisible(true); + occlusionCullingCheckBox.SetVisible(true); + visibilityComputeShadingCheckBox.SetVisible(true); + tessellationCheckBox.SetVisible(true); + transparentShadowsCheckBox.SetVisible(true); + + add(shadowTypeComboBox); + add(shadowProps2DComboBox); + add(shadowPropsCubeComboBox); + add(MSAAComboBox); + add_right(temporalAADebugCheckBox); + temporalAACheckBox.SetPos(XMFLOAT2(temporalAADebugCheckBox.GetPos().x - temporalAACheckBox.GetSize().x - 70, temporalAADebugCheckBox.GetPos().y)); + add_right(variableRateShadingClassificationDebugCheckBox); + variableRateShadingClassificationCheckBox.SetPos(XMFLOAT2(variableRateShadingClassificationDebugCheckBox.GetPos().x - variableRateShadingClassificationCheckBox.GetSize().x - 70, variableRateShadingClassificationDebugCheckBox.GetPos().y)); + add_right(debugLightCullingCheckBox); + advancedLightCullingCheckBox.SetPos(XMFLOAT2(debugLightCullingCheckBox.GetPos().x - advancedLightCullingCheckBox.GetSize().x - 70, debugLightCullingCheckBox.GetPos().y)); + add_right(occlusionCullingCheckBox); + add_right(visibilityComputeShadingCheckBox); + add_right(tessellationCheckBox); + add_right(transparentShadowsCheckBox); + } + + y += jump; + + add(raytraceBounceCountSlider); + + if (renderpath == RENDERPATH_PATHTRACING) + { + pathTraceTargetSlider.SetVisible(true); + pathTraceStatisticsLabel.SetVisible(true); + add(pathTraceTargetSlider); + add_fullwidth(pathTraceStatisticsLabel); + + GIBoostSlider.SetVisible(false); + surfelGIDebugComboBox.SetVisible(false); + surfelGICheckBox.SetVisible(false); + ddgiDebugCheckBox.SetVisible(false); + ddgiCheckBox.SetVisible(false); + ddgiZ.SetVisible(false); + ddgiY.SetVisible(false); + ddgiX.SetVisible(false); + ddgiRayCountSlider.SetVisible(false); + voxelRadianceDebugCheckBox.SetVisible(false); + voxelRadianceCheckBox.SetVisible(false); + voxelRadianceSecondaryBounceCheckBox.SetVisible(false); + voxelRadianceReflectionsCheckBox.SetVisible(false); + voxelRadianceVoxelSizeSlider.SetVisible(false); + voxelRadianceConeTracingSlider.SetVisible(false); + voxelRadianceRayStepSizeSlider.SetVisible(false); + voxelRadianceMaxDistanceSlider.SetVisible(false); + } + else + { + pathTraceTargetSlider.SetVisible(false); + pathTraceStatisticsLabel.SetVisible(false); + + + GIBoostSlider.SetVisible(true); + surfelGIDebugComboBox.SetVisible(true); + surfelGICheckBox.SetVisible(true); + ddgiDebugCheckBox.SetVisible(true); + ddgiCheckBox.SetVisible(true); + ddgiZ.SetVisible(true); + ddgiY.SetVisible(true); + ddgiX.SetVisible(true); + ddgiRayCountSlider.SetVisible(true); + voxelRadianceDebugCheckBox.SetVisible(true); + voxelRadianceCheckBox.SetVisible(true); + voxelRadianceSecondaryBounceCheckBox.SetVisible(true); + voxelRadianceReflectionsCheckBox.SetVisible(true); + voxelRadianceVoxelSizeSlider.SetVisible(true); + voxelRadianceConeTracingSlider.SetVisible(true); + voxelRadianceRayStepSizeSlider.SetVisible(true); + voxelRadianceMaxDistanceSlider.SetVisible(true); + + add(GIBoostSlider); + + y += jump; + + add_right(surfelGIDebugComboBox); + surfelGICheckBox.SetPos(XMFLOAT2(surfelGIDebugComboBox.GetPos().x - surfelGICheckBox.GetSize().x - padding, surfelGIDebugComboBox.GetPos().y)); + + y += jump; + + add_right(ddgiCheckBox); + add_right(ddgiDebugCheckBox); + add_right(ddgiZ); + ddgiY.SetPos(XMFLOAT2(ddgiZ.GetPos().x - ddgiY.GetSize().x - padding, ddgiZ.GetPos().y)); + ddgiX.SetPos(XMFLOAT2(ddgiY.GetPos().x - ddgiX.GetSize().x - padding, ddgiY.GetPos().y)); + add(ddgiRayCountSlider); + + y += jump; + + add_right(voxelRadianceCheckBox); + add_right(voxelRadianceDebugCheckBox); + add_right(voxelRadianceSecondaryBounceCheckBox); + add_right(voxelRadianceReflectionsCheckBox); + add(voxelRadianceVoxelSizeSlider); + add(voxelRadianceConeTracingSlider); + add(voxelRadianceRayStepSizeSlider); + add(voxelRadianceMaxDistanceSlider); + } + + + y += jump; + + add(exposureSlider); + add_right(lensFlareCheckBox); + add_right(lightShaftsStrengthStrengthSlider); + lightShaftsCheckBox.SetPos(XMFLOAT2(lightShaftsStrengthStrengthSlider.GetPos().x - lightShaftsCheckBox.GetSize().x - 80, lightShaftsStrengthStrengthSlider.GetPos().y)); + add(aoComboBox); + add(aoPowerSlider); + add(aoRangeSlider); + add(aoSampleCountSlider); + add_right(ssrCheckBox); + add_right(raytracedReflectionsCheckBox); + add_right(screenSpaceShadowsStepCountSlider); + screenSpaceShadowsCheckBox.SetPos(XMFLOAT2(screenSpaceShadowsStepCountSlider.GetPos().x - screenSpaceShadowsCheckBox.GetSize().x - 80, screenSpaceShadowsStepCountSlider.GetPos().y)); + add_right(screenSpaceShadowsRangeSlider); + add_right(eyeAdaptionKeySlider); + eyeAdaptionCheckBox.SetPos(XMFLOAT2(eyeAdaptionKeySlider.GetPos().x - eyeAdaptionCheckBox.GetSize().x - 80, eyeAdaptionKeySlider.GetPos().y)); + add_right(eyeAdaptionRateSlider); + add_right(motionBlurStrengthSlider); + motionBlurCheckBox.SetPos(XMFLOAT2(motionBlurStrengthSlider.GetPos().x - motionBlurCheckBox.GetSize().x - 80, motionBlurStrengthSlider.GetPos().y)); + add_right(depthOfFieldScaleSlider); + depthOfFieldCheckBox.SetPos(XMFLOAT2(depthOfFieldScaleSlider.GetPos().x - depthOfFieldCheckBox.GetSize().x - 80, depthOfFieldScaleSlider.GetPos().y)); + add_right(bloomStrengthSlider); + bloomCheckBox.SetPos(XMFLOAT2(bloomStrengthSlider.GetPos().x - bloomCheckBox.GetSize().x - 80, bloomStrengthSlider.GetPos().y)); + add_right(fxaaCheckBox); + add_right(colorGradingCheckBox); + add_right(ditherCheckBox); + add_right(sharpenFilterAmountSlider); + sharpenFilterCheckBox.SetPos(XMFLOAT2(sharpenFilterAmountSlider.GetPos().x - sharpenFilterCheckBox.GetSize().x - 80, sharpenFilterAmountSlider.GetPos().y)); + add_right(outlineThresholdSlider); + outlineCheckBox.SetPos(XMFLOAT2(outlineThresholdSlider.GetPos().x - outlineCheckBox.GetSize().x - 80, outlineThresholdSlider.GetPos().y)); + add_right(outlineThicknessSlider); + add_right(chromaticaberrationSlider); + chromaticaberrationCheckBox.SetPos(XMFLOAT2(chromaticaberrationSlider.GetPos().x - chromaticaberrationCheckBox.GetSize().x - 80, chromaticaberrationSlider.GetPos().y)); + add_right(fsrSlider); + fsrCheckBox.SetPos(XMFLOAT2(fsrSlider.GetPos().x - fsrCheckBox.GetSize().x - 80, fsrSlider.GetPos().y)); + + y += jump; + + add_right(freezeCullingCameraCheckBox); + add_right(disableAlbedoMapsCheckBox); + add_right(forceDiffuseLightingCheckBox); + add_right(wireFrameCheckBox); + add_right(nameDebugCheckBox); + add_right(physicsDebugCheckBox); + add_right(aabbDebugCheckBox); + add_right(boneLinesCheckBox); + add_right(debugEmittersCheckBox); + add_right(debugForceFieldsCheckBox); + add_right(debugRaytraceBVHCheckBox); + add_right(envProbesCheckBox); + add_right(gridHelperCheckBox); + add_right(cameraVisCheckBox); + + } diff --git a/Editor/RendererWindow.h b/Editor/GraphicsWindow.h similarity index 59% rename from Editor/RendererWindow.h rename to Editor/GraphicsWindow.h index 5e304f0e7..26d1b4274 100644 --- a/Editor/RendererWindow.h +++ b/Editor/GraphicsWindow.h @@ -3,22 +3,7 @@ class EditorComponent; -enum PICKTYPE -{ - PICK_VOID = 0, - PICK_OBJECT = wi::enums::RENDERTYPE_ALL, - PICK_LIGHT = 8, - PICK_DECAL = 16, - PICK_ENVPROBE = 32, - PICK_FORCEFIELD = 64, - PICK_EMITTER = 128, - PICK_HAIR = 256, - PICK_CAMERA = 512, - PICK_ARMATURE = 1024, - PICK_SOUND = 2048, -}; - -class RendererWindow : public wi::gui::Window +class GraphicsWindow : public wi::gui::Window { public: void Create(EditorComponent* editor); @@ -27,6 +12,9 @@ public: wi::gui::CheckBox vsyncCheckBox; wi::gui::ComboBox swapchainComboBox; + wi::gui::ComboBox renderPathComboBox; + wi::gui::Slider pathTraceTargetSlider; + wi::gui::Label pathTraceStatisticsLabel; wi::gui::CheckBox occlusionCullingCheckBox; wi::gui::CheckBox visibilityComputeShadingCheckBox; wi::gui::Slider resolutionScaleSlider; @@ -47,6 +35,56 @@ public: wi::gui::Slider voxelRadianceConeTracingSlider; wi::gui::Slider voxelRadianceRayStepSizeSlider; wi::gui::Slider voxelRadianceMaxDistanceSlider; + wi::gui::Slider speedMultiplierSlider; + wi::gui::CheckBox transparentShadowsCheckBox; + wi::gui::ComboBox shadowTypeComboBox; + wi::gui::ComboBox shadowProps2DComboBox; + wi::gui::ComboBox shadowPropsCubeComboBox; + wi::gui::ComboBox MSAAComboBox; + wi::gui::CheckBox temporalAACheckBox; + wi::gui::CheckBox temporalAADebugCheckBox; + wi::gui::ComboBox textureQualityComboBox; + wi::gui::Slider mipLodBiasSlider; + wi::gui::Slider raytraceBounceCountSlider; + wi::gui::CheckBox freezeCullingCameraCheckBox; + wi::gui::CheckBox disableAlbedoMapsCheckBox; + wi::gui::CheckBox forceDiffuseLightingCheckBox; + + wi::gui::Slider exposureSlider; + wi::gui::CheckBox lensFlareCheckBox; + wi::gui::CheckBox lightShaftsCheckBox; + wi::gui::Slider lightShaftsStrengthStrengthSlider; + wi::gui::ComboBox aoComboBox; + wi::gui::Slider aoPowerSlider; + wi::gui::Slider aoRangeSlider; + wi::gui::Slider aoSampleCountSlider; + wi::gui::CheckBox ssrCheckBox; + wi::gui::CheckBox raytracedReflectionsCheckBox; + wi::gui::CheckBox screenSpaceShadowsCheckBox; + wi::gui::Slider screenSpaceShadowsStepCountSlider; + wi::gui::Slider screenSpaceShadowsRangeSlider; + wi::gui::CheckBox eyeAdaptionCheckBox; + wi::gui::Slider eyeAdaptionKeySlider; + wi::gui::Slider eyeAdaptionRateSlider; + wi::gui::CheckBox motionBlurCheckBox; + wi::gui::Slider motionBlurStrengthSlider; + wi::gui::CheckBox depthOfFieldCheckBox; + wi::gui::Slider depthOfFieldScaleSlider; + wi::gui::CheckBox bloomCheckBox; + wi::gui::Slider bloomStrengthSlider; + wi::gui::CheckBox fxaaCheckBox; + wi::gui::CheckBox colorGradingCheckBox; + wi::gui::CheckBox ditherCheckBox; + wi::gui::CheckBox sharpenFilterCheckBox; + wi::gui::Slider sharpenFilterAmountSlider; + wi::gui::CheckBox outlineCheckBox; + wi::gui::Slider outlineThresholdSlider; + wi::gui::Slider outlineThicknessSlider; + wi::gui::CheckBox chromaticaberrationCheckBox; + wi::gui::Slider chromaticaberrationSlider; + wi::gui::CheckBox fsrCheckBox; + wi::gui::Slider fsrSlider; + wi::gui::CheckBox nameDebugCheckBox; wi::gui::CheckBox physicsDebugCheckBox; wi::gui::CheckBox aabbDebugCheckBox; @@ -63,35 +101,17 @@ public: wi::gui::CheckBox envProbesCheckBox; wi::gui::CheckBox gridHelperCheckBox; wi::gui::CheckBox cameraVisCheckBox; - wi::gui::CheckBox pickTypeObjectCheckBox; - wi::gui::CheckBox pickTypeEnvProbeCheckBox; - wi::gui::CheckBox pickTypeLightCheckBox; - wi::gui::CheckBox pickTypeDecalCheckBox; - wi::gui::CheckBox pickTypeForceFieldCheckBox; - wi::gui::CheckBox pickTypeEmitterCheckBox; - wi::gui::CheckBox pickTypeHairCheckBox; - wi::gui::CheckBox pickTypeCameraCheckBox; - wi::gui::CheckBox pickTypeArmatureCheckBox; - wi::gui::CheckBox pickTypeSoundCheckBox; - wi::gui::Slider speedMultiplierSlider; - wi::gui::CheckBox transparentShadowsCheckBox; - wi::gui::ComboBox shadowTypeComboBox; - wi::gui::ComboBox shadowProps2DComboBox; - wi::gui::ComboBox shadowPropsCubeComboBox; - wi::gui::ComboBox MSAAComboBox; - wi::gui::CheckBox temporalAACheckBox; - wi::gui::CheckBox temporalAADebugCheckBox; - wi::gui::ComboBox textureQualityComboBox; - wi::gui::Slider mipLodBiasSlider; - wi::gui::Slider raytraceBounceCountSlider; - wi::gui::CheckBox freezeCullingCameraCheckBox; - wi::gui::CheckBox disableAlbedoMapsCheckBox; - wi::gui::CheckBox forceDiffuseLightingCheckBox; - - uint32_t GetPickType() const; + enum RENDERPATH + { + RENDERPATH_DEFAULT, + RENDERPATH_PATHTRACING, + }; + void ChangeRenderPath(RENDERPATH path); void UpdateSwapChainFormats(wi::graphics::SwapChain* swapChain); void Update(); + + void ResizeLayout() override; }; diff --git a/Editor/OptionsWindow.cpp b/Editor/OptionsWindow.cpp index 73b7d436f..6542942f9 100644 --- a/Editor/OptionsWindow.cpp +++ b/Editor/OptionsWindow.cpp @@ -273,6 +273,8 @@ void OptionsWindow::Create(EditorComponent* _editor) filterCombo.AddItem("Emitter " ICON_EMITTER, (uint64_t)Filter::Emitter); filterCombo.AddItem("Hairparticle " ICON_HAIR, (uint64_t)Filter::Hairparticle); filterCombo.AddItem("Inverse Kinematics " ICON_IK, (uint64_t)Filter::IK); + filterCombo.AddItem("Camera " ICON_CAMERA, (uint64_t)Filter::Camera); + filterCombo.AddItem("Armature " ICON_ARMATURE, (uint64_t)Filter::Armature); filterCombo.SetTooltip("Apply filtering to the Entities"); filterCombo.OnSelect([&](wi::gui::EventArgs args) { filter = (Filter)args.userdata; @@ -312,36 +314,14 @@ void OptionsWindow::Create(EditorComponent* _editor) }); AddWidget(&entityTree); - - renderPathComboBox.Create("Render Path: "); - renderPathComboBox.AddItem("Default"); - renderPathComboBox.AddItem("Path Tracing"); - renderPathComboBox.OnSelect([&](wi::gui::EventArgs args) { - editor->ChangeRenderPath((EditorComponent::RENDERPATH)args.iValue); - }); - renderPathComboBox.SetSelected(EditorComponent::RENDERPATH_DEFAULT); - renderPathComboBox.SetEnabled(true); - renderPathComboBox.SetTooltip("Choose a render path..."); - AddWidget(&renderPathComboBox); - - - pathTraceTargetSlider.Create(1, 2048, 1024, 2047, "Sample count: "); - pathTraceTargetSlider.SetSize(XMFLOAT2(200, 18)); - pathTraceTargetSlider.SetTooltip("The path tracing will perform this many samples per pixel."); - AddWidget(&pathTraceTargetSlider); - pathTraceTargetSlider.SetVisible(false); - - pathTraceStatisticsLabel.Create("Path tracing statistics"); - pathTraceStatisticsLabel.SetSize(XMFLOAT2(240, 60)); - AddWidget(&pathTraceStatisticsLabel); - pathTraceStatisticsLabel.SetVisible(false); - // Renderer and Postprocess windows are created in ChangeRenderPath(), because they deal with // RenderPath related information as well, so it's easier to reset them when changing - + graphicsWnd.Create(editor); + graphicsWnd.SetCollapsed(true); + AddWidget(&graphicsWnd); cameraWnd.Create(editor); cameraWnd.ResetCam(); @@ -656,7 +636,7 @@ void OptionsWindow::Update(float dt) { cameraWnd.Update(); paintToolWnd.Update(dt); - rendererWnd.Update(); + graphicsWnd.Update(); } void OptionsWindow::ResizeLayout() @@ -700,35 +680,9 @@ void OptionsWindow::ResizeLayout() pos.y += themeCombo.GetSize().y; pos.y += padding; - renderPathComboBox.SetPos(XMFLOAT2(pos.x + x_off, pos.y)); - renderPathComboBox.SetSize(XMFLOAT2(width - x_off - renderPathComboBox.GetScale().y - 1, renderPathComboBox.GetScale().y)); - pos.y += renderPathComboBox.GetSize().y; - pos.y += padding; - - if (pathTraceTargetSlider.IsVisible()) - { - pathTraceTargetSlider.SetPos(XMFLOAT2(pos.x + x_off, pos.y)); - pathTraceTargetSlider.SetSize(XMFLOAT2(width - x_off - pathTraceTargetSlider.GetScale().y * 2 - 1, pathTraceTargetSlider.GetScale().y)); - pos.y += pathTraceTargetSlider.GetSize().y; - pos.y += padding; - } - - if (pathTraceStatisticsLabel.IsVisible()) - { - pathTraceStatisticsLabel.SetPos(pos); - pathTraceStatisticsLabel.SetSize(XMFLOAT2(width, pathTraceStatisticsLabel.GetScale().y)); - pos.y += pathTraceStatisticsLabel.GetSize().y; - pos.y += padding; - } - - rendererWnd.SetPos(pos); - rendererWnd.SetSize(XMFLOAT2(width, rendererWnd.GetScale().y)); - pos.y += rendererWnd.GetSize().y; - pos.y += padding; - - postprocessWnd.SetPos(pos); - postprocessWnd.SetSize(XMFLOAT2(width, postprocessWnd.GetScale().y)); - pos.y += postprocessWnd.GetSize().y; + graphicsWnd.SetPos(pos); + graphicsWnd.SetSize(XMFLOAT2(width, graphicsWnd.GetScale().y)); + pos.y += graphicsWnd.GetSize().y; pos.y += padding; cameraWnd.SetPos(pos); @@ -974,7 +928,7 @@ void OptionsWindow::RefreshEntityTree() } } - if (has_flag(filter, Filter::All)) + if (has_flag(filter, Filter::Camera)) { for (size_t i = 0; i < scene.cameras.GetCount(); ++i) { @@ -998,7 +952,7 @@ void OptionsWindow::RefreshEntityTree() } } - if (has_flag(filter, Filter::All)) + if (has_flag(filter, Filter::Armature)) { for (size_t i = 0; i < scene.armatures.GetCount(); ++i) { diff --git a/Editor/OptionsWindow.h b/Editor/OptionsWindow.h index 71ea19ec8..830f3877c 100644 --- a/Editor/OptionsWindow.h +++ b/Editor/OptionsWindow.h @@ -1,7 +1,6 @@ #pragma once #include "WickedEngine.h" -#include "RendererWindow.h" -#include "PostprocessWindow.h" +#include "GraphicsWindow.h" #include "CameraWindow.h" #include "MaterialPickerWindow.h" #include "PaintToolWindow.h" @@ -28,13 +27,9 @@ public: wi::gui::CheckBox fpsCheckBox; wi::gui::CheckBox otherinfoCheckBox; wi::gui::ComboBox themeCombo; - wi::gui::ComboBox renderPathComboBox; wi::gui::ComboBox saveModeComboBox; wi::gui::ComboBox sceneComboBox; - wi::gui::Slider pathTraceTargetSlider; - wi::gui::Label pathTraceStatisticsLabel; - RendererWindow rendererWnd; - PostprocessWindow postprocessWnd; + GraphicsWindow graphicsWnd; CameraWindow cameraWnd; MaterialPickerWindow materialPickerWnd; PaintToolWindow paintToolWnd; @@ -56,6 +51,8 @@ public: Emitter = 1 << 11, Hairparticle = 1 << 12, IK = 1 << 13, + Camera = 1 << 14, + Armature = 1 << 15, All = ~0ull, } filter = Filter::All; diff --git a/Editor/PostprocessWindow.cpp b/Editor/PostprocessWindow.cpp deleted file mode 100644 index 7a356f5de..000000000 --- a/Editor/PostprocessWindow.cpp +++ /dev/null @@ -1,411 +0,0 @@ -#include "stdafx.h" -#include "PostprocessWindow.h" -#include "Editor.h" - -#include - -using namespace wi::graphics; - -void PostprocessWindow::Create(EditorComponent* _editor) -{ - editor = _editor; - wi::gui::Window::Create("PostProcess", wi::gui::Window::WindowControls::COLLAPSE); - SetSize(XMFLOAT2(420, 500)); - - float x = 110; - float y = 0; - float hei = 18; - float step = hei + 2; - float wid = 140; - float mod_wid = 60; - - exposureSlider.Create(0.0f, 3.0f, 1, 10000, "Exposure: "); - exposureSlider.SetTooltip("Set the tonemap exposure value"); - exposureSlider.SetScriptTip("RenderPath3D::SetExposure(float value)"); - exposureSlider.SetSize(XMFLOAT2(wid, hei)); - exposureSlider.SetPos(XMFLOAT2(x, y)); - exposureSlider.SetValue(editor->renderPath->getExposure()); - exposureSlider.OnSlide([=](wi::gui::EventArgs args) { - editor->renderPath->setExposure(args.fValue); - }); - AddWidget(&exposureSlider); - - lensFlareCheckBox.Create("LensFlare: "); - lensFlareCheckBox.SetTooltip("Toggle visibility of light source flares. Additional setup needed per light for a lensflare to be visible."); - lensFlareCheckBox.SetScriptTip("RenderPath3D::SetLensFlareEnabled(bool value)"); - lensFlareCheckBox.SetSize(XMFLOAT2(hei, hei)); - lensFlareCheckBox.SetPos(XMFLOAT2(x, y += step)); - lensFlareCheckBox.SetCheck(editor->renderPath->getLensFlareEnabled()); - lensFlareCheckBox.OnClick([=](wi::gui::EventArgs args) { - editor->renderPath->setLensFlareEnabled(args.bValue); - }); - AddWidget(&lensFlareCheckBox); - - lightShaftsCheckBox.Create("LightShafts: "); - lightShaftsCheckBox.SetTooltip("Enable light shaft for directional light sources."); - lightShaftsCheckBox.SetScriptTip("RenderPath3D::SetLightShaftsEnabled(bool value)"); - lightShaftsCheckBox.SetSize(XMFLOAT2(hei, hei)); - lightShaftsCheckBox.SetPos(XMFLOAT2(x, y += step)); - lightShaftsCheckBox.SetCheck(editor->renderPath->getLightShaftsEnabled()); - lightShaftsCheckBox.OnClick([=](wi::gui::EventArgs args) { - editor->renderPath->setLightShaftsEnabled(args.bValue); - }); - AddWidget(&lightShaftsCheckBox); - - lightShaftsStrengthStrengthSlider.Create(0, 1, 0.05f, 1000, "Strength: "); - lightShaftsStrengthStrengthSlider.SetTooltip("Set light shaft strength."); - lightShaftsStrengthStrengthSlider.SetSize(XMFLOAT2(mod_wid, hei)); - lightShaftsStrengthStrengthSlider.SetPos(XMFLOAT2(x + 100, y)); - lightShaftsStrengthStrengthSlider.SetValue(editor->renderPath->getLightShaftsStrength()); - lightShaftsStrengthStrengthSlider.OnSlide([=](wi::gui::EventArgs args) { - editor->renderPath->setLightShaftsStrength(args.fValue); - }); - AddWidget(&lightShaftsStrengthStrengthSlider); - - aoComboBox.Create("AO: "); - aoComboBox.SetTooltip("Choose Ambient Occlusion type. RTAO is only available if hardware supports ray tracing"); - aoComboBox.SetScriptTip("RenderPath3D::SetAO(int value)"); - aoComboBox.SetSize(XMFLOAT2(wid, hei)); - aoComboBox.SetPos(XMFLOAT2(x, y += step)); - aoComboBox.AddItem("Disabled"); - aoComboBox.AddItem("SSAO"); - aoComboBox.AddItem("HBAO"); - aoComboBox.AddItem("MSAO"); - if (wi::graphics::GetDevice()->CheckCapability(GraphicsDeviceCapability::RAYTRACING)) - { - aoComboBox.AddItem("RTAO"); - } - aoComboBox.SetSelected(editor->renderPath->getAO()); - aoComboBox.OnSelect([=](wi::gui::EventArgs args) { - editor->renderPath->setAO((wi::RenderPath3D::AO)args.iValue); - - switch (editor->renderPath->getAO()) - { - case wi::RenderPath3D::AO_SSAO: - aoRangeSlider.SetEnabled(true); - aoRangeSlider.SetValue(2.0f); - aoSampleCountSlider.SetEnabled(true); - aoSampleCountSlider.SetValue(9.0f); - break; - case wi::RenderPath3D::AO_RTAO: - aoRangeSlider.SetEnabled(true); - aoRangeSlider.SetValue(10.0f); - aoSampleCountSlider.SetEnabled(false); - break; - default: - aoRangeSlider.SetEnabled(false); - aoSampleCountSlider.SetEnabled(false); - break; - } - - editor->renderPath->setAORange(aoRangeSlider.GetValue()); - editor->renderPath->setAOSampleCount((uint32_t)aoSampleCountSlider.GetValue()); - }); - AddWidget(&aoComboBox); - - aoPowerSlider.Create(0.25f, 8.0f, 2, 1000, "Power: "); - aoPowerSlider.SetTooltip("Set SSAO Power. Higher values produce darker, more pronounced effect"); - aoPowerSlider.SetSize(XMFLOAT2(mod_wid, hei)); - aoPowerSlider.SetPos(XMFLOAT2(x + 100, y += step)); - aoPowerSlider.SetValue((float)editor->renderPath->getAOPower()); - aoPowerSlider.OnSlide([=](wi::gui::EventArgs args) { - editor->renderPath->setAOPower(args.fValue); - }); - AddWidget(&aoPowerSlider); - - aoRangeSlider.Create(1.0f, 100.0f, 1, 1000, "Range: "); - aoRangeSlider.SetTooltip("Set AO ray length. Only for SSAO and RTAO"); - aoRangeSlider.SetSize(XMFLOAT2(mod_wid, hei)); - aoRangeSlider.SetPos(XMFLOAT2(x + 100, y += step)); - aoRangeSlider.SetValue((float)editor->renderPath->getAOPower()); - aoRangeSlider.OnSlide([=](wi::gui::EventArgs args) { - editor->renderPath->setAORange(args.fValue); - }); - AddWidget(&aoRangeSlider); - - aoSampleCountSlider.Create(1, 16, 9, 15, "Sample Count: "); - aoSampleCountSlider.SetTooltip("Set AO ray count. Only for SSAO"); - aoSampleCountSlider.SetSize(XMFLOAT2(mod_wid, hei)); - aoSampleCountSlider.SetPos(XMFLOAT2(x + 100, y += step)); - aoSampleCountSlider.SetValue((float)editor->renderPath->getAOPower()); - aoSampleCountSlider.OnSlide([=](wi::gui::EventArgs args) { - editor->renderPath->setAOSampleCount(args.iValue); - }); - AddWidget(&aoSampleCountSlider); - - ssrCheckBox.Create("SSR: "); - ssrCheckBox.SetTooltip("Enable Screen Space Reflections."); - ssrCheckBox.SetScriptTip("RenderPath3D::SetSSREnabled(bool value)"); - ssrCheckBox.SetSize(XMFLOAT2(hei, hei)); - ssrCheckBox.SetPos(XMFLOAT2(x, y += step)); - ssrCheckBox.SetCheck(editor->renderPath->getSSREnabled()); - ssrCheckBox.OnClick([=](wi::gui::EventArgs args) { - editor->renderPath->setSSREnabled(args.bValue); - }); - AddWidget(&ssrCheckBox); - - raytracedReflectionsCheckBox.Create("RT Reflections: "); - raytracedReflectionsCheckBox.SetTooltip("Enable Ray Traced Reflections. Only if GPU supports raytracing."); - raytracedReflectionsCheckBox.SetScriptTip("RenderPath3D::SetRaytracedReflectionsEnabled(bool value)"); - raytracedReflectionsCheckBox.SetSize(XMFLOAT2(hei, hei)); - raytracedReflectionsCheckBox.SetPos(XMFLOAT2(x + 140, y)); - raytracedReflectionsCheckBox.SetCheck(editor->renderPath->getRaytracedReflectionEnabled()); - raytracedReflectionsCheckBox.OnClick([=](wi::gui::EventArgs args) { - editor->renderPath->setRaytracedReflectionsEnabled(args.bValue); - }); - AddWidget(&raytracedReflectionsCheckBox); - raytracedReflectionsCheckBox.SetEnabled(wi::graphics::GetDevice()->CheckCapability(GraphicsDeviceCapability::RAYTRACING)); - - screenSpaceShadowsCheckBox.Create("SS Shadows: "); - screenSpaceShadowsCheckBox.SetTooltip("Enable screen space contact shadows. This can add small shadows details to shadow maps in screen space."); - screenSpaceShadowsCheckBox.SetSize(XMFLOAT2(hei, hei)); - screenSpaceShadowsCheckBox.SetPos(XMFLOAT2(x, y += step)); - screenSpaceShadowsCheckBox.SetCheck(wi::renderer::GetScreenSpaceShadowsEnabled()); - screenSpaceShadowsCheckBox.OnClick([=](wi::gui::EventArgs args) { - wi::renderer::SetScreenSpaceShadowsEnabled(args.bValue); - }); - AddWidget(&screenSpaceShadowsCheckBox); - - screenSpaceShadowsRangeSlider.Create(0.1f, 10.0f, 1, 1000, "Range: "); - screenSpaceShadowsRangeSlider.SetTooltip("Range of contact shadows"); - screenSpaceShadowsRangeSlider.SetSize(XMFLOAT2(mod_wid, hei)); - screenSpaceShadowsRangeSlider.SetPos(XMFLOAT2(x + 100, y)); - screenSpaceShadowsRangeSlider.SetValue((float)editor->renderPath->getScreenSpaceShadowRange()); - screenSpaceShadowsRangeSlider.OnSlide([=](wi::gui::EventArgs args) { - editor->renderPath->setScreenSpaceShadowRange(args.fValue); - }); - AddWidget(&screenSpaceShadowsRangeSlider); - - screenSpaceShadowsStepCountSlider.Create(4, 128, 16, 128 - 4, "Sample Count: "); - screenSpaceShadowsStepCountSlider.SetTooltip("Sample count of contact shadows. Higher values are better quality but slower."); - screenSpaceShadowsStepCountSlider.SetSize(XMFLOAT2(mod_wid, hei)); - screenSpaceShadowsStepCountSlider.SetPos(XMFLOAT2(x + 100, y += step)); - screenSpaceShadowsStepCountSlider.SetValue((float)editor->renderPath->getScreenSpaceShadowSampleCount()); - screenSpaceShadowsStepCountSlider.OnSlide([=](wi::gui::EventArgs args) { - editor->renderPath->setScreenSpaceShadowSampleCount(args.iValue); - }); - AddWidget(&screenSpaceShadowsStepCountSlider); - - eyeAdaptionCheckBox.Create("EyeAdaption: "); - eyeAdaptionCheckBox.SetTooltip("Enable eye adaption for the overall screen luminance"); - eyeAdaptionCheckBox.SetSize(XMFLOAT2(hei, hei)); - eyeAdaptionCheckBox.SetPos(XMFLOAT2(x, y += step)); - eyeAdaptionCheckBox.SetCheck(editor->renderPath->getEyeAdaptionEnabled()); - eyeAdaptionCheckBox.OnClick([=](wi::gui::EventArgs args) { - editor->renderPath->setEyeAdaptionEnabled(args.bValue); - }); - AddWidget(&eyeAdaptionCheckBox); - - eyeAdaptionKeySlider.Create(0.01f, 0.5f, 0.1f, 10000, "Key: "); - eyeAdaptionKeySlider.SetTooltip("Set the key value for eye adaption."); - eyeAdaptionKeySlider.SetSize(XMFLOAT2(mod_wid, hei)); - eyeAdaptionKeySlider.SetPos(XMFLOAT2(x + 100, y)); - eyeAdaptionKeySlider.SetValue(editor->renderPath->getEyeAdaptionKey()); - eyeAdaptionKeySlider.OnSlide([=](wi::gui::EventArgs args) { - editor->renderPath->setEyeAdaptionKey(args.fValue); - }); - AddWidget(&eyeAdaptionKeySlider); - - eyeAdaptionRateSlider.Create(0.01f, 4, 0.5f, 10000, "Rate: "); - eyeAdaptionRateSlider.SetTooltip("Set the eye adaption rate (speed of adjustment)"); - eyeAdaptionRateSlider.SetSize(XMFLOAT2(mod_wid, hei)); - eyeAdaptionRateSlider.SetPos(XMFLOAT2(x + 100, y += step)); - eyeAdaptionRateSlider.SetValue(editor->renderPath->getEyeAdaptionRate()); - eyeAdaptionRateSlider.OnSlide([=](wi::gui::EventArgs args) { - editor->renderPath->setEyeAdaptionRate(args.fValue); - }); - AddWidget(&eyeAdaptionRateSlider); - - motionBlurCheckBox.Create("MotionBlur: "); - motionBlurCheckBox.SetTooltip("Enable motion blur for camera movement and animated meshes."); - motionBlurCheckBox.SetScriptTip("RenderPath3D::SetMotionBlurEnabled(bool value)"); - motionBlurCheckBox.SetSize(XMFLOAT2(hei, hei)); - motionBlurCheckBox.SetPos(XMFLOAT2(x, y += step)); - motionBlurCheckBox.SetCheck(editor->renderPath->getMotionBlurEnabled()); - motionBlurCheckBox.OnClick([=](wi::gui::EventArgs args) { - editor->renderPath->setMotionBlurEnabled(args.bValue); - }); - AddWidget(&motionBlurCheckBox); - - motionBlurStrengthSlider.Create(0.1f, 400, 100, 10000, "Strength: "); - motionBlurStrengthSlider.SetTooltip("Set the camera shutter speed for motion blur (higher value means stronger blur)."); - motionBlurStrengthSlider.SetScriptTip("RenderPath3D::SetMotionBlurStrength(float value)"); - motionBlurStrengthSlider.SetSize(XMFLOAT2(mod_wid, hei)); - motionBlurStrengthSlider.SetPos(XMFLOAT2(x + 100, y)); - motionBlurStrengthSlider.SetValue(editor->renderPath->getMotionBlurStrength()); - motionBlurStrengthSlider.OnSlide([=](wi::gui::EventArgs args) { - editor->renderPath->setMotionBlurStrength(args.fValue); - }); - AddWidget(&motionBlurStrengthSlider); - - depthOfFieldCheckBox.Create("DepthOfField: "); - depthOfFieldCheckBox.SetTooltip("Enable Depth of field effect. Requires additional camera setup: focal length and aperture size."); - depthOfFieldCheckBox.SetScriptTip("RenderPath3D::SetDepthOfFieldEnabled(bool value)"); - depthOfFieldCheckBox.SetSize(XMFLOAT2(hei, hei)); - depthOfFieldCheckBox.SetPos(XMFLOAT2(x, y += step)); - depthOfFieldCheckBox.SetCheck(editor->renderPath->getDepthOfFieldEnabled()); - depthOfFieldCheckBox.OnClick([=](wi::gui::EventArgs args) { - editor->renderPath->setDepthOfFieldEnabled(args.bValue); - }); - AddWidget(&depthOfFieldCheckBox); - - depthOfFieldScaleSlider.Create(1.0f, 20, 100, 1000, "Strength: "); - depthOfFieldScaleSlider.SetTooltip("Set depth of field strength. This is used to scale the Camera's ApertureSize setting"); - depthOfFieldScaleSlider.SetScriptTip("RenderPath3D::SetDepthOfFieldStrength(float value)"); - depthOfFieldScaleSlider.SetSize(XMFLOAT2(mod_wid, hei)); - depthOfFieldScaleSlider.SetPos(XMFLOAT2(x + 100, y)); - depthOfFieldScaleSlider.SetValue(editor->renderPath->getDepthOfFieldStrength()); - depthOfFieldScaleSlider.OnSlide([=](wi::gui::EventArgs args) { - editor->renderPath->setDepthOfFieldStrength(args.fValue); - }); - AddWidget(&depthOfFieldScaleSlider); - - bloomCheckBox.Create("Bloom: "); - bloomCheckBox.SetTooltip("Enable bloom. The effect adds color bleeding to the brightest parts of the scene."); - bloomCheckBox.SetScriptTip("RenderPath3D::SetBloomEnabled(bool value)"); - bloomCheckBox.SetSize(XMFLOAT2(hei, hei)); - bloomCheckBox.SetPos(XMFLOAT2(x, y += step)); - bloomCheckBox.SetCheck(editor->renderPath->getBloomEnabled()); - bloomCheckBox.OnClick([=](wi::gui::EventArgs args) { - editor->renderPath->setBloomEnabled(args.bValue); - }); - AddWidget(&bloomCheckBox); - - bloomStrengthSlider.Create(0.0f, 10, 1, 1000, "Threshold: "); - bloomStrengthSlider.SetTooltip("Set bloom threshold. The values below this will not glow on the screen."); - bloomStrengthSlider.SetSize(XMFLOAT2(mod_wid, hei)); - bloomStrengthSlider.SetPos(XMFLOAT2(x + 100, y)); - bloomStrengthSlider.SetValue(editor->renderPath->getBloomThreshold()); - bloomStrengthSlider.OnSlide([=](wi::gui::EventArgs args) { - editor->renderPath->setBloomThreshold(args.fValue); - }); - AddWidget(&bloomStrengthSlider); - - fxaaCheckBox.Create("FXAA: "); - fxaaCheckBox.SetTooltip("Fast Approximate Anti Aliasing. A fast antialiasing method, but can be a bit too blurry."); - fxaaCheckBox.SetScriptTip("RenderPath3D::SetFXAAEnabled(bool value)"); - fxaaCheckBox.SetSize(XMFLOAT2(hei, hei)); - fxaaCheckBox.SetPos(XMFLOAT2(x, y += step)); - fxaaCheckBox.SetCheck(editor->renderPath->getFXAAEnabled()); - fxaaCheckBox.OnClick([=](wi::gui::EventArgs args) { - editor->renderPath->setFXAAEnabled(args.bValue); - }); - AddWidget(&fxaaCheckBox); - - colorGradingCheckBox.Create("Color Grading: "); - colorGradingCheckBox.SetTooltip("Enable color grading of the final render. An additional lookup texture must be set in the Weather!"); - colorGradingCheckBox.SetSize(XMFLOAT2(hei, hei)); - colorGradingCheckBox.SetPos(XMFLOAT2(x, y += step)); - colorGradingCheckBox.SetCheck(editor->renderPath->getColorGradingEnabled()); - colorGradingCheckBox.OnClick([=](wi::gui::EventArgs args) { - editor->renderPath->setColorGradingEnabled(args.bValue); - }); - AddWidget(&colorGradingCheckBox); - - ditherCheckBox.Create("Dithering: "); - ditherCheckBox.SetTooltip("Toggle the full screen dithering effect. This helps to reduce color banding."); - ditherCheckBox.SetSize(XMFLOAT2(hei, hei)); - ditherCheckBox.SetPos(XMFLOAT2(x, y += step)); - ditherCheckBox.SetCheck(editor->renderPath->getDitherEnabled()); - ditherCheckBox.OnClick([=](wi::gui::EventArgs args) { - editor->renderPath->setDitherEnabled(args.bValue); - }); - AddWidget(&ditherCheckBox); - - sharpenFilterCheckBox.Create("Sharpen Filter: "); - sharpenFilterCheckBox.SetTooltip("Toggle sharpening post process of the final image."); - sharpenFilterCheckBox.SetScriptTip("RenderPath3D::SetSharpenFilterEnabled(bool value)"); - sharpenFilterCheckBox.SetSize(XMFLOAT2(hei, hei)); - sharpenFilterCheckBox.SetPos(XMFLOAT2(x, y += step)); - sharpenFilterCheckBox.SetCheck(editor->renderPath->getSharpenFilterEnabled()); - sharpenFilterCheckBox.OnClick([=](wi::gui::EventArgs args) { - editor->renderPath->setSharpenFilterEnabled(args.bValue); - }); - AddWidget(&sharpenFilterCheckBox); - - sharpenFilterAmountSlider.Create(0, 4, 1, 1000, "Amount: "); - sharpenFilterAmountSlider.SetTooltip("Set sharpness filter strength."); - sharpenFilterAmountSlider.SetScriptTip("RenderPath3D::SetSharpenFilterAmount(float value)"); - sharpenFilterAmountSlider.SetSize(XMFLOAT2(mod_wid, hei)); - sharpenFilterAmountSlider.SetPos(XMFLOAT2(x + 100, y)); - sharpenFilterAmountSlider.SetValue(editor->renderPath->getSharpenFilterAmount()); - sharpenFilterAmountSlider.OnSlide([=](wi::gui::EventArgs args) { - editor->renderPath->setSharpenFilterAmount(args.fValue); - }); - AddWidget(&sharpenFilterAmountSlider); - - outlineCheckBox.Create("Cartoon Outline: "); - outlineCheckBox.SetTooltip("Toggle the full screen cartoon outline effect."); - outlineCheckBox.SetSize(XMFLOAT2(hei, hei)); - outlineCheckBox.SetPos(XMFLOAT2(x, y += step)); - outlineCheckBox.SetCheck(editor->renderPath->getOutlineEnabled()); - outlineCheckBox.OnClick([=](wi::gui::EventArgs args) { - editor->renderPath->setOutlineEnabled(args.bValue); - }); - AddWidget(&outlineCheckBox); - - outlineThresholdSlider.Create(0, 1, 0.1f, 1000, "Threshold: "); - outlineThresholdSlider.SetTooltip("Outline edge detection threshold. Increase if not enough otlines are detected, decrease if too many outlines are detected."); - outlineThresholdSlider.SetSize(XMFLOAT2(mod_wid, hei)); - outlineThresholdSlider.SetPos(XMFLOAT2(x + 100, y)); - outlineThresholdSlider.SetValue(editor->renderPath->getOutlineThreshold()); - outlineThresholdSlider.OnSlide([=](wi::gui::EventArgs args) { - editor->renderPath->setOutlineThreshold(args.fValue); - }); - AddWidget(&outlineThresholdSlider); - - outlineThicknessSlider.Create(0, 4, 1, 1000, "Thickness: "); - outlineThicknessSlider.SetTooltip("Set outline thickness."); - outlineThicknessSlider.SetSize(XMFLOAT2(mod_wid, hei)); - outlineThicknessSlider.SetPos(XMFLOAT2(x + 100, y += step)); - outlineThicknessSlider.SetValue(editor->renderPath->getOutlineThickness()); - outlineThicknessSlider.OnSlide([=](wi::gui::EventArgs args) { - editor->renderPath->setOutlineThickness(args.fValue); - }); - AddWidget(&outlineThicknessSlider); - - chromaticaberrationCheckBox.Create("Chromatic A.: "); - chromaticaberrationCheckBox.SetTooltip("Toggle the full screen chromatic aberration effect. This simulates lens distortion at screen edges."); - chromaticaberrationCheckBox.SetSize(XMFLOAT2(hei, hei)); - chromaticaberrationCheckBox.SetPos(XMFLOAT2(x, y += step)); - chromaticaberrationCheckBox.SetCheck(editor->renderPath->getOutlineEnabled()); - chromaticaberrationCheckBox.OnClick([=](wi::gui::EventArgs args) { - editor->renderPath->setChromaticAberrationEnabled(args.bValue); - }); - AddWidget(&chromaticaberrationCheckBox); - - chromaticaberrationSlider.Create(0, 4, 1.0f, 1000, "Amount: "); - chromaticaberrationSlider.SetTooltip("The lens distortion amount."); - chromaticaberrationSlider.SetSize(XMFLOAT2(mod_wid, hei)); - chromaticaberrationSlider.SetPos(XMFLOAT2(x + 100, y)); - chromaticaberrationSlider.SetValue(editor->renderPath->getChromaticAberrationAmount()); - chromaticaberrationSlider.OnSlide([=](wi::gui::EventArgs args) { - editor->renderPath->setChromaticAberrationAmount(args.fValue); - }); - AddWidget(&chromaticaberrationSlider); - - fsrCheckBox.Create("FSR: "); - fsrCheckBox.SetTooltip("FidelityFX FSR Upscaling. Use this only with Temporal AA or MSAA when the resolution scaling is lowered."); - fsrCheckBox.SetSize(XMFLOAT2(hei, hei)); - fsrCheckBox.SetPos(XMFLOAT2(x, y += step)); - fsrCheckBox.SetCheck(editor->renderPath->getFSREnabled()); - fsrCheckBox.OnClick([=](wi::gui::EventArgs args) { - editor->renderPath->setFSREnabled(args.bValue); - }); - AddWidget(&fsrCheckBox); - - fsrSlider.Create(0, 2, 1.0f, 1000, "Sharpness: "); - fsrSlider.SetTooltip("The sharpening amount to apply for FSR upscaling."); - fsrSlider.SetSize(XMFLOAT2(mod_wid, hei)); - fsrSlider.SetPos(XMFLOAT2(x + 100, y)); - fsrSlider.SetValue(editor->renderPath->getFSRSharpness()); - fsrSlider.OnSlide([=](wi::gui::EventArgs args) { - editor->renderPath->setFSRSharpness(args.fValue); - }); - AddWidget(&fsrSlider); - - - Translate(XMFLOAT3((float)editor->GetLogicalWidth() - 500, 80, 0)); - SetMinimized(true); - -} diff --git a/Editor/PostprocessWindow.h b/Editor/PostprocessWindow.h deleted file mode 100644 index b36a6ff66..000000000 --- a/Editor/PostprocessWindow.h +++ /dev/null @@ -1,50 +0,0 @@ -#pragma once -#include "WickedEngine.h" - -class EditorComponent; - -class PostprocessWindow : public wi::gui::Window -{ -public: - void Create(EditorComponent* editor); - - EditorComponent* editor = nullptr; - - wi::gui::Slider exposureSlider; - wi::gui::CheckBox lensFlareCheckBox; - wi::gui::CheckBox lightShaftsCheckBox; - wi::gui::Slider lightShaftsStrengthStrengthSlider; - wi::gui::ComboBox aoComboBox; - wi::gui::Slider aoPowerSlider; - wi::gui::Slider aoRangeSlider; - wi::gui::Slider aoSampleCountSlider; - wi::gui::CheckBox ssrCheckBox; - wi::gui::CheckBox raytracedReflectionsCheckBox; - wi::gui::CheckBox screenSpaceShadowsCheckBox; - wi::gui::Slider screenSpaceShadowsStepCountSlider; - wi::gui::Slider screenSpaceShadowsRangeSlider; - wi::gui::CheckBox eyeAdaptionCheckBox; - wi::gui::Slider eyeAdaptionKeySlider; - wi::gui::Slider eyeAdaptionRateSlider; - wi::gui::CheckBox motionBlurCheckBox; - wi::gui::Slider motionBlurStrengthSlider; - wi::gui::CheckBox depthOfFieldCheckBox; - wi::gui::Slider depthOfFieldScaleSlider; - wi::gui::CheckBox bloomCheckBox; - wi::gui::Slider bloomStrengthSlider; - wi::gui::CheckBox fxaaCheckBox; - wi::gui::CheckBox colorGradingCheckBox; - wi::gui::CheckBox ditherCheckBox; - wi::gui::CheckBox sharpenFilterCheckBox; - wi::gui::Slider sharpenFilterAmountSlider; - wi::gui::CheckBox outlineCheckBox; - wi::gui::Slider outlineThresholdSlider; - wi::gui::Slider outlineThicknessSlider; - wi::gui::CheckBox chromaticaberrationCheckBox; - wi::gui::Slider chromaticaberrationSlider; - wi::gui::CheckBox fsrCheckBox; - wi::gui::Slider fsrSlider; - - -}; - diff --git a/Editor/TerrainGenerator.h b/Editor/TerrainGenerator.h index aa6d73e82..118a47cc8 100644 --- a/Editor/TerrainGenerator.h +++ b/Editor/TerrainGenerator.h @@ -62,7 +62,12 @@ struct TerrainGenerator : public wi::gui::Window wi::scene::MaterialComponent material_HighAltitude; wi::scene::MaterialComponent material_GrassParticle; wi::HairParticleSystem grass_properties; +#ifdef PLATFORM_LINUX + // TODO: investigate why wi::unordered_map is crashing terrain generator on Linux + std::unordered_map chunks; +#else wi::unordered_map chunks; +#endif wi::vector indices; struct LOD { diff --git a/Editor/WeatherWindow.cpp b/Editor/WeatherWindow.cpp index 38df50d70..7241bf85e 100644 --- a/Editor/WeatherWindow.cpp +++ b/Editor/WeatherWindow.cpp @@ -772,7 +772,7 @@ void WeatherWindow::Update() { scene.weather = {}; scene.weather.SetSimpleSky(true); - scene.weather.ambient = XMFLOAT3(1, 1, 1); + scene.weather.ambient = XMFLOAT3(0.5f, 0.5f, 0.5f); scene.weather.zenith = default_sky_zenith; scene.weather.horizon = default_sky_horizon; } diff --git a/WickedEngine/shaders/ShaderInterop_Renderer.h b/WickedEngine/shaders/ShaderInterop_Renderer.h index f73fa73b2..cedadee3e 100644 --- a/WickedEngine/shaders/ShaderInterop_Renderer.h +++ b/WickedEngine/shaders/ShaderInterop_Renderer.h @@ -134,6 +134,8 @@ struct ShaderMaterial int texture_specularmap_index; uint shaderType; + uint4 userdata; + void init() { baseColor = float4(1, 1, 1, 1); @@ -196,6 +198,7 @@ struct ShaderMaterial texture_specularmap_index = -1; shaderType = 0; + userdata = uint4(0, 0, 0, 0); } #ifndef __cplusplus diff --git a/WickedEngine/wiECS.h b/WickedEngine/wiECS.h index 04819a253..18f1bea5e 100644 --- a/WickedEngine/wiECS.h +++ b/WickedEngine/wiECS.h @@ -2,7 +2,6 @@ #define WI_ENTITY_COMPONENT_SYSTEM_H #include "wiArchive.h" -#include "wiHelper.h" #include "wiJobSystem.h" #include "wiUnorderedMap.h" #include "wiVector.h" diff --git a/WickedEngine/wiGUI.cpp b/WickedEngine/wiGUI.cpp index 289461f92..80ceb1079 100644 --- a/WickedEngine/wiGUI.cpp +++ b/WickedEngine/wiGUI.cpp @@ -310,8 +310,9 @@ namespace wi::gui static const float _border = 2; XMFLOAT2 textSize = tooltipFont.TextSize(); - float textWidth = textSize.x + _border * 2; - float textHeight = textSize.y + _border * 2; + float textWidth = textSize.x; + float textHeight = textSize.y; + const float textHeightWithoutScriptTip = textHeight; if (!scripttipFont.text.empty()) { @@ -344,8 +345,8 @@ namespace wi::gui tooltipSprite.params.pos.x = tooltipFont.params.posX - _border; tooltipSprite.params.pos.y = tooltipFont.params.posY - _border; - tooltipSprite.params.siz.x = textWidth; - tooltipSprite.params.siz.y = textHeight; + tooltipSprite.params.siz.x = textWidth + _border * 2; + tooltipSprite.params.siz.y = textHeight + _border * 2; if (tooltip_shadow > 0) { @@ -366,7 +367,7 @@ namespace wi::gui if (!scripttipFont.text.empty()) { scripttipFont.params = tooltipFont.params; - scripttipFont.params.posY += (int)(textHeight / 2); + scripttipFont.params.posY += textHeightWithoutScriptTip; scripttipFont.params.color = wi::Color::lerp(tooltipFont.params.color, wi::Color::Transparent(), 0.25f); scripttipFont.Draw(cmd); } @@ -470,6 +471,10 @@ namespace wi::gui } bool Widget::IsVisible() const { + if (parent != nullptr && !parent->IsVisible()) + { + return false; + } return visible; } void Widget::Activate() @@ -3022,6 +3027,7 @@ namespace wi::gui { minimized = value; + scrollable_area.SetVisible(!value); if (resizeDragger_BottomLeft.parent != nullptr) { resizeDragger_BottomLeft.SetVisible(!value); @@ -3030,22 +3036,9 @@ namespace wi::gui { resizeDragger_BottomRight.SetVisible(!value); } - for (auto& x : widgets) - { - if (x == &moveDragger) - continue; - if (x == &collapseButton) - continue; - if (x == &closeButton) - continue; - if (x == &resizeDragger_UpperLeft) - continue; - if (x == &resizeDragger_UpperRight) - continue; - if (x == &label) - continue; - x->SetVisible(!value); - } + + scrollbar_horizontal.SetVisible(!value); + scrollbar_vertical.SetVisible(!value); if (IsMinimized()) { diff --git a/WickedEngine/wiScene.cpp b/WickedEngine/wiScene.cpp index 5be1dd53c..fe26ae186 100644 --- a/WickedEngine/wiScene.cpp +++ b/WickedEngine/wiScene.cpp @@ -275,6 +275,7 @@ namespace wi::scene material.layerMask = layerMask; material.transmission = transmission; material.shaderType = (uint)shaderType; + material.userdata = userdata; material.options = 0; if (IsUsingVertexColors()) diff --git a/WickedEngine/wiScene.h b/WickedEngine/wiScene.h index 51f1e9d57..b9800cb13 100644 --- a/WickedEngine/wiScene.h +++ b/WickedEngine/wiScene.h @@ -233,6 +233,7 @@ namespace wi::scene TextureMap textures[TEXTURESLOT_COUNT]; int customShaderID = -1; + uint4 userdata = uint4(0, 0, 0, 0); // can be accessed by custom shader // Non-serialized attributes: uint32_t layerMask = ~0u; @@ -1346,7 +1347,7 @@ namespace wi::scene wi::ecs::ComponentManager& layers = componentLibrary.Register("wi::scene::Scene::layers"); wi::ecs::ComponentManager& transforms = componentLibrary.Register("wi::scene::Scene::transforms"); wi::ecs::ComponentManager& hierarchy = componentLibrary.Register("wi::scene::Scene::hierarchy"); - wi::ecs::ComponentManager& materials = componentLibrary.Register("wi::scene::Scene::materials"); + wi::ecs::ComponentManager& materials = componentLibrary.Register("wi::scene::Scene::materials", 1); // version = 1 wi::ecs::ComponentManager& meshes = componentLibrary.Register("wi::scene::Scene::meshes"); wi::ecs::ComponentManager& impostors = componentLibrary.Register("wi::scene::Scene::impostors"); wi::ecs::ComponentManager& objects = componentLibrary.Register("wi::scene::Scene::objects"); diff --git a/WickedEngine/wiScene_Serializers.cpp b/WickedEngine/wiScene_Serializers.cpp index 7618446be..b6d281357 100644 --- a/WickedEngine/wiScene_Serializers.cpp +++ b/WickedEngine/wiScene_Serializers.cpp @@ -214,6 +214,11 @@ namespace wi::scene archive >> textures[SPECULARMAP].uvset; } + if (seri.GetVersion() >= 1) + { + archive >> userdata; + } + for (auto& x : textures) { if (!x.name.empty()) @@ -339,6 +344,11 @@ namespace wi::scene archive << textures[SPECULARMAP].name; archive << textures[SPECULARMAP].uvset; } + + if (seri.GetVersion() >= 1) + { + archive << userdata; + } } } void MeshComponent::Serialize(wi::Archive& archive, EntitySerializer& seri) diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index 0f5fc4dcd..eb721b548 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wi::version // minor features, major updates, breaking compatibility changes const int minor = 71; // minor bug fixes, alterations, refactors, updates - const int revision = 15; + const int revision = 16; const std::string version_string = std::to_string(major) + "." + std::to_string(minor) + "." + std::to_string(revision);