diff --git a/Editor/AnimationWindow.cpp b/Editor/AnimationWindow.cpp index 7fa02e658..212893a8c 100644 --- a/Editor/AnimationWindow.cpp +++ b/Editor/AnimationWindow.cpp @@ -1,12 +1,13 @@ #include "stdafx.h" #include "AnimationWindow.h" +#include "Editor.h" #include using namespace wiECS; using namespace wiScene; -AnimationWindow::AnimationWindow(wiGUI* gui) :GUI(gui) +AnimationWindow::AnimationWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) { assert(GUI && "Invalid GUI!"); diff --git a/Editor/AnimationWindow.h b/Editor/AnimationWindow.h index 142dde019..770f9363a 100644 --- a/Editor/AnimationWindow.h +++ b/Editor/AnimationWindow.h @@ -8,10 +8,12 @@ class wiSlider; class wiComboBox; class wiButton; +class EditorComponent; + class AnimationWindow { public: - AnimationWindow(wiGUI* gui); + AnimationWindow(EditorComponent* editor); ~AnimationWindow(); wiGUI* GUI; diff --git a/Editor/CameraWindow.cpp b/Editor/CameraWindow.cpp index 730a480fd..4b36e831c 100644 --- a/Editor/CameraWindow.cpp +++ b/Editor/CameraWindow.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "CameraWindow.h" +#include "Editor.h" using namespace wiECS; using namespace wiScene; @@ -17,7 +18,7 @@ void CameraWindow::ResetCam() camera_target.UpdateTransform(); } -CameraWindow::CameraWindow(wiGUI* gui) :GUI(gui) +CameraWindow::CameraWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) { assert(GUI && "Invalid GUI!"); diff --git a/Editor/CameraWindow.h b/Editor/CameraWindow.h index cffe33de8..762714b3b 100644 --- a/Editor/CameraWindow.h +++ b/Editor/CameraWindow.h @@ -7,10 +7,12 @@ class wiCheckBox; class wiSlider; class wiTextInputField; +class EditorComponent; + class CameraWindow { public: - CameraWindow(wiGUI* gui); + CameraWindow(EditorComponent* editor); ~CameraWindow(); void ResetCam(); diff --git a/Editor/DecalWindow.cpp b/Editor/DecalWindow.cpp index 7828ddc4c..2f32e9af5 100644 --- a/Editor/DecalWindow.cpp +++ b/Editor/DecalWindow.cpp @@ -1,11 +1,12 @@ #include "stdafx.h" #include "DecalWindow.h" +#include "Editor.h" using namespace wiECS; using namespace wiScene; -DecalWindow::DecalWindow(wiGUI* gui) : GUI(gui) +DecalWindow::DecalWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) { assert(GUI && "Invalid GUI!"); diff --git a/Editor/DecalWindow.h b/Editor/DecalWindow.h index 204dae35a..e7abdf83c 100644 --- a/Editor/DecalWindow.h +++ b/Editor/DecalWindow.h @@ -6,10 +6,12 @@ class wiLabel; class wiCheckBox; class wiSlider; +class EditorComponent; + class DecalWindow { public: - DecalWindow(wiGUI* gui); + DecalWindow(EditorComponent* editor); ~DecalWindow(); wiGUI* GUI; diff --git a/Editor/Editor.cpp b/Editor/Editor.cpp index 9c73955e2..79a36eb56 100644 --- a/Editor/Editor.cpp +++ b/Editor/Editor.cpp @@ -17,6 +17,9 @@ #include "ForceFieldWindow.h" #include "SoundWindow.h" #include "PaintToolWindow.h" +#include "SpringWindow.h" +#include "IKWindow.h" +#include "TransformWindow.h" #include "ModelImporter.h" #include "Translator.h" @@ -128,21 +131,24 @@ void EditorComponent::ChangeRenderPath(RENDERPATH path) renderPath->Update(0); materialWnd = std::make_unique(this); - postprocessWnd = std::make_unique(&GetGUI(), renderPath.get()); - weatherWnd = std::make_unique(&GetGUI()); + postprocessWnd = std::make_unique(this); + weatherWnd = std::make_unique(this); objectWnd = std::make_unique(this); meshWnd = std::make_unique(this); - cameraWnd = std::make_unique(&GetGUI()); - rendererWnd = std::make_unique(&GetGUI(), this, renderPath.get()); - envProbeWnd = std::make_unique(&GetGUI()); - soundWnd = std::make_unique(&GetGUI()); - decalWnd = std::make_unique(&GetGUI()); - lightWnd = std::make_unique(&GetGUI()); - animWnd = std::make_unique(&GetGUI()); - emitterWnd = std::make_unique(&GetGUI()); - hairWnd = std::make_unique(&GetGUI()); - forceFieldWnd = std::make_unique(&GetGUI()); + cameraWnd = std::make_unique(this); + rendererWnd = std::make_unique(this); + envProbeWnd = std::make_unique(this); + soundWnd = std::make_unique(this); + decalWnd = std::make_unique(this); + lightWnd = std::make_unique(this); + animWnd = std::make_unique(this); + emitterWnd = std::make_unique(this); + hairWnd = std::make_unique(this); + forceFieldWnd = std::make_unique(this); paintToolWnd = std::make_unique(this); + springWnd = std::make_unique(this); + ikWnd = std::make_unique(this); + transformWnd = std::make_unique(this); ResizeBuffers(); } @@ -219,32 +225,56 @@ void EditorComponent::Load() float screenW = (float)wiRenderer::GetDevice()->GetScreenWidth(); float screenH = (float)wiRenderer::GetDevice()->GetScreenHeight(); - XMFLOAT2 option_size = XMFLOAT2(100, 28); - float step = (option_size.y + 2) * -1, x = screenW - option_size.x, y = screenH - option_size.y; + XMFLOAT2 option_size = XMFLOAT2(100, 34); + float x = screenW - option_size.x; + float y = screenH - option_size.y; + float step = (option_size.y + 2) * -1; float hstep = (option_size.x + 2) * -1; + + wiButton* rendererWnd_Toggle = new wiButton("Renderer"); + rendererWnd_Toggle->SetTooltip("Renderer settings window"); + rendererWnd_Toggle->SetPos(XMFLOAT2(x += hstep, y)); + rendererWnd_Toggle->SetSize(option_size); + rendererWnd_Toggle->OnClick([=](wiEventArgs args) { + rendererWnd->rendererWindow->SetVisible(!rendererWnd->rendererWindow->IsVisible()); + }); + GetGUI().AddWidget(rendererWnd_Toggle); + + wiButton* postprocessWnd_Toggle = new wiButton("PostProcess"); + postprocessWnd_Toggle->SetTooltip("Postprocess settings window"); + postprocessWnd_Toggle->SetPos(XMFLOAT2(x += hstep, y)); + postprocessWnd_Toggle->SetSize(option_size); + postprocessWnd_Toggle->OnClick([=](wiEventArgs args) { + postprocessWnd->ppWindow->SetVisible(!postprocessWnd->ppWindow->IsVisible()); + }); + GetGUI().AddWidget(postprocessWnd_Toggle); + wiButton* paintToolWnd_Toggle = new wiButton("Paint Tool"); paintToolWnd_Toggle->SetTooltip("Paint tool window"); - paintToolWnd_Toggle->SetPos(XMFLOAT2(x + hstep, y)); + paintToolWnd_Toggle->SetPos(XMFLOAT2(x += hstep, y)); paintToolWnd_Toggle->SetSize(option_size); paintToolWnd_Toggle->OnClick([=](wiEventArgs args) { paintToolWnd->window->SetVisible(!paintToolWnd->window->IsVisible()); }); GetGUI().AddWidget(paintToolWnd_Toggle); - wiButton* rendererWnd_Toggle = new wiButton("Renderer"); - rendererWnd_Toggle->SetTooltip("Renderer settings window"); - rendererWnd_Toggle->SetPos(XMFLOAT2(x, y)); - rendererWnd_Toggle->SetSize(option_size); - rendererWnd_Toggle->OnClick([=](wiEventArgs args) { - rendererWnd->rendererWindow->SetVisible(!rendererWnd->rendererWindow->IsVisible()); - }); - GetGUI().AddWidget(rendererWnd_Toggle); + + /////////////////////// + option_size.y = 16; + step = (option_size.y + 2) * -1; + x = screenW - option_size.x; + y = screenH - option_size.y; + wiColor option_color_idle = wiColor(255, 145, 145, 100); + wiColor option_color_focus = wiColor(255, 197, 193, 200); + wiButton* weatherWnd_Toggle = new wiButton("Weather"); - weatherWnd_Toggle->SetTooltip("World settings window"); - weatherWnd_Toggle->SetPos(XMFLOAT2(x, y += step)); + weatherWnd_Toggle->SetColor(option_color_idle, wiWidget::IDLE); + weatherWnd_Toggle->SetColor(option_color_focus, wiWidget::FOCUS); + weatherWnd_Toggle->SetTooltip("Weather settings window"); + weatherWnd_Toggle->SetPos(XMFLOAT2(x, y)); weatherWnd_Toggle->SetSize(option_size); weatherWnd_Toggle->OnClick([=](wiEventArgs args) { weatherWnd->weatherWindow->SetVisible(!weatherWnd->weatherWindow->IsVisible()); @@ -252,6 +282,8 @@ void EditorComponent::Load() GetGUI().AddWidget(weatherWnd_Toggle); wiButton* objectWnd_Toggle = new wiButton("Object"); + objectWnd_Toggle->SetColor(option_color_idle, wiWidget::IDLE); + objectWnd_Toggle->SetColor(option_color_focus, wiWidget::FOCUS); objectWnd_Toggle->SetTooltip("Object settings window"); objectWnd_Toggle->SetPos(XMFLOAT2(x, y += step)); objectWnd_Toggle->SetSize(option_size); @@ -261,6 +293,8 @@ void EditorComponent::Load() GetGUI().AddWidget(objectWnd_Toggle); wiButton* meshWnd_Toggle = new wiButton("Mesh"); + meshWnd_Toggle->SetColor(option_color_idle, wiWidget::IDLE); + meshWnd_Toggle->SetColor(option_color_focus, wiWidget::FOCUS); meshWnd_Toggle->SetTooltip("Mesh settings window"); meshWnd_Toggle->SetPos(XMFLOAT2(x, y += step)); meshWnd_Toggle->SetSize(option_size); @@ -270,6 +304,8 @@ void EditorComponent::Load() GetGUI().AddWidget(meshWnd_Toggle); wiButton* materialWnd_Toggle = new wiButton("Material"); + materialWnd_Toggle->SetColor(option_color_idle, wiWidget::IDLE); + materialWnd_Toggle->SetColor(option_color_focus, wiWidget::FOCUS); materialWnd_Toggle->SetTooltip("Material settings window"); materialWnd_Toggle->SetPos(XMFLOAT2(x, y += step)); materialWnd_Toggle->SetSize(option_size); @@ -278,16 +314,9 @@ void EditorComponent::Load() }); GetGUI().AddWidget(materialWnd_Toggle); - wiButton* postprocessWnd_Toggle = new wiButton("PostProcess"); - postprocessWnd_Toggle->SetTooltip("Postprocess settings window"); - postprocessWnd_Toggle->SetPos(XMFLOAT2(x, y += step)); - postprocessWnd_Toggle->SetSize(option_size); - postprocessWnd_Toggle->OnClick([=](wiEventArgs args) { - postprocessWnd->ppWindow->SetVisible(!postprocessWnd->ppWindow->IsVisible()); - }); - GetGUI().AddWidget(postprocessWnd_Toggle); - wiButton* cameraWnd_Toggle = new wiButton("Camera"); + cameraWnd_Toggle->SetColor(option_color_idle, wiWidget::IDLE); + cameraWnd_Toggle->SetColor(option_color_focus, wiWidget::FOCUS); cameraWnd_Toggle->SetTooltip("Camera settings window"); cameraWnd_Toggle->SetPos(XMFLOAT2(x, y += step)); cameraWnd_Toggle->SetSize(option_size); @@ -297,6 +326,8 @@ void EditorComponent::Load() GetGUI().AddWidget(cameraWnd_Toggle); wiButton* envProbeWnd_Toggle = new wiButton("EnvProbe"); + envProbeWnd_Toggle->SetColor(option_color_idle, wiWidget::IDLE); + envProbeWnd_Toggle->SetColor(option_color_focus, wiWidget::FOCUS); envProbeWnd_Toggle->SetTooltip("Environment probe settings window"); envProbeWnd_Toggle->SetPos(XMFLOAT2(x, y += step)); envProbeWnd_Toggle->SetSize(option_size); @@ -306,6 +337,8 @@ void EditorComponent::Load() GetGUI().AddWidget(envProbeWnd_Toggle); wiButton* decalWnd_Toggle = new wiButton("Decal"); + decalWnd_Toggle->SetColor(option_color_idle, wiWidget::IDLE); + decalWnd_Toggle->SetColor(option_color_focus, wiWidget::FOCUS); decalWnd_Toggle->SetTooltip("Decal settings window"); decalWnd_Toggle->SetPos(XMFLOAT2(x, y += step)); decalWnd_Toggle->SetSize(option_size); @@ -315,6 +348,8 @@ void EditorComponent::Load() GetGUI().AddWidget(decalWnd_Toggle); wiButton* soundWnd_Toggle = new wiButton("Sound"); + soundWnd_Toggle->SetColor(option_color_idle, wiWidget::IDLE); + soundWnd_Toggle->SetColor(option_color_focus, wiWidget::FOCUS); soundWnd_Toggle->SetTooltip("Sound settings window"); soundWnd_Toggle->SetPos(XMFLOAT2(x, y += step)); soundWnd_Toggle->SetSize(option_size); @@ -324,6 +359,8 @@ void EditorComponent::Load() GetGUI().AddWidget(soundWnd_Toggle); wiButton* lightWnd_Toggle = new wiButton("Light"); + lightWnd_Toggle->SetColor(option_color_idle, wiWidget::IDLE); + lightWnd_Toggle->SetColor(option_color_focus, wiWidget::FOCUS); lightWnd_Toggle->SetTooltip("Light settings window"); lightWnd_Toggle->SetPos(XMFLOAT2(x, y += step)); lightWnd_Toggle->SetSize(option_size); @@ -333,6 +370,8 @@ void EditorComponent::Load() GetGUI().AddWidget(lightWnd_Toggle); wiButton* animWnd_Toggle = new wiButton("Animation"); + animWnd_Toggle->SetColor(option_color_idle, wiWidget::IDLE); + animWnd_Toggle->SetColor(option_color_focus, wiWidget::FOCUS); animWnd_Toggle->SetTooltip("Animation inspector window"); animWnd_Toggle->SetPos(XMFLOAT2(x, y += step)); animWnd_Toggle->SetSize(option_size); @@ -342,6 +381,8 @@ void EditorComponent::Load() GetGUI().AddWidget(animWnd_Toggle); wiButton* emitterWnd_Toggle = new wiButton("Emitter"); + emitterWnd_Toggle->SetColor(option_color_idle, wiWidget::IDLE); + emitterWnd_Toggle->SetColor(option_color_focus, wiWidget::FOCUS); emitterWnd_Toggle->SetTooltip("Emitter Particle System properties"); emitterWnd_Toggle->SetPos(XMFLOAT2(x, y += step)); emitterWnd_Toggle->SetSize(option_size); @@ -351,6 +392,8 @@ void EditorComponent::Load() GetGUI().AddWidget(emitterWnd_Toggle); wiButton* hairWnd_Toggle = new wiButton("HairParticle"); + hairWnd_Toggle->SetColor(option_color_idle, wiWidget::IDLE); + hairWnd_Toggle->SetColor(option_color_focus, wiWidget::FOCUS); hairWnd_Toggle->SetTooltip("Hair Particle System properties"); hairWnd_Toggle->SetPos(XMFLOAT2(x, y += step)); hairWnd_Toggle->SetSize(option_size); @@ -360,6 +403,8 @@ void EditorComponent::Load() GetGUI().AddWidget(hairWnd_Toggle); wiButton* forceFieldWnd_Toggle = new wiButton("ForceField"); + forceFieldWnd_Toggle->SetColor(option_color_idle, wiWidget::IDLE); + forceFieldWnd_Toggle->SetColor(option_color_focus, wiWidget::FOCUS); forceFieldWnd_Toggle->SetTooltip("Force Field properties"); forceFieldWnd_Toggle->SetPos(XMFLOAT2(x, y += step)); forceFieldWnd_Toggle->SetSize(option_size); @@ -368,9 +413,48 @@ void EditorComponent::Load() }); GetGUI().AddWidget(forceFieldWnd_Toggle); + wiButton* springWnd_Toggle = new wiButton("Spring"); + springWnd_Toggle->SetColor(option_color_idle, wiWidget::IDLE); + springWnd_Toggle->SetColor(option_color_focus, wiWidget::FOCUS); + springWnd_Toggle->SetTooltip("Spring properties"); + springWnd_Toggle->SetPos(XMFLOAT2(x, y += step)); + springWnd_Toggle->SetSize(option_size); + springWnd_Toggle->OnClick([=](wiEventArgs args) { + springWnd->window->SetVisible(!springWnd->window->IsVisible()); + }); + GetGUI().AddWidget(springWnd_Toggle); + + wiButton* ikWnd_Toggle = new wiButton("IK"); + ikWnd_Toggle->SetColor(option_color_idle, wiWidget::IDLE); + ikWnd_Toggle->SetColor(option_color_focus, wiWidget::FOCUS); + ikWnd_Toggle->SetTooltip("Inverse Kinematics properties"); + ikWnd_Toggle->SetPos(XMFLOAT2(x, y += step)); + ikWnd_Toggle->SetSize(option_size); + ikWnd_Toggle->OnClick([=](wiEventArgs args) { + ikWnd->window->SetVisible(!ikWnd->window->IsVisible()); + }); + GetGUI().AddWidget(ikWnd_Toggle); + + wiButton* transformWnd_Toggle = new wiButton("Transform"); + transformWnd_Toggle->SetColor(option_color_idle, wiWidget::IDLE); + transformWnd_Toggle->SetColor(option_color_focus, wiWidget::FOCUS); + transformWnd_Toggle->SetTooltip("Transform properties"); + transformWnd_Toggle->SetPos(XMFLOAT2(x, y += step)); + transformWnd_Toggle->SetSize(option_size); + transformWnd_Toggle->OnClick([=](wiEventArgs args) { + transformWnd->window->SetVisible(!transformWnd->window->IsVisible()); + }); + GetGUI().AddWidget(transformWnd_Toggle); + + + + //////////////////////////////////////////////////////////////////////////////////// + + + wiCheckBox* translatorCheckBox = new wiCheckBox("Translator: "); translatorCheckBox->SetTooltip("Enable the translator tool"); translatorCheckBox->SetPos(XMFLOAT2(screenW - 50 - 55 - 105 * 5 - 25, 0)); @@ -380,9 +464,9 @@ void EditorComponent::Load() }); GetGUI().AddWidget(translatorCheckBox); - wiCheckBox* isScalatorCheckBox = new wiCheckBox("S:"); - wiCheckBox* isRotatorCheckBox = new wiCheckBox("R:"); - wiCheckBox* isTranslatorCheckBox = new wiCheckBox("T:"); + wiCheckBox* isScalatorCheckBox = new wiCheckBox("S: "); + wiCheckBox* isRotatorCheckBox = new wiCheckBox("R: "); + wiCheckBox* isTranslatorCheckBox = new wiCheckBox("T: "); { isScalatorCheckBox->SetTooltip("Scale"); isScalatorCheckBox->SetPos(XMFLOAT2(screenW - 50 - 55 - 105 * 5 - 25 - 40 * 2, 22)); @@ -588,6 +672,9 @@ void EditorComponent::Load() forceFieldWnd->SetEntity(INVALID_ENTITY); cameraWnd->SetEntity(INVALID_ENTITY); paintToolWnd->SetEntity(INVALID_ENTITY); + springWnd->SetEntity(INVALID_ENTITY); + ikWnd->SetEntity(INVALID_ENTITY); + transformWnd->SetEntity(INVALID_ENTITY); }); GetGUI().AddWidget(clearButton); @@ -617,7 +704,6 @@ void EditorComponent::Load() ss << "Copy: Ctrl + C" << endl; ss << "Paste: Ctrl + V" << endl; ss << "Delete: DELETE button" << endl; - ss << "Add Spring to selected transform: R button" << endl; ss << "Place Instances: Ctrl + Shift + Left mouse click (place clipboard onto clicked surface)" << endl; ss << "Script Console / backlog: HOME button" << endl; ss << endl; @@ -654,10 +740,19 @@ void EditorComponent::Load() GetGUI().AddWidget(exitButton); + wiCheckBox* profilerEnabledCheckBox = new wiCheckBox("Profiler Enabled: "); + profilerEnabledCheckBox->SetSize(XMFLOAT2(20, 20)); + profilerEnabledCheckBox->SetPos(XMFLOAT2(screenW - 520, 45)); + profilerEnabledCheckBox->SetTooltip("Toggle Profiler Engine On/Off"); + profilerEnabledCheckBox->OnClick([&](wiEventArgs args) { + wiProfiler::SetEnabled(args.bValue); + }); + profilerEnabledCheckBox->SetCheck(wiProfiler::IsEnabled()); + GetGUI().AddWidget(profilerEnabledCheckBox); wiCheckBox* physicsEnabledCheckBox = new wiCheckBox("Physics Enabled: "); - physicsEnabledCheckBox->SetSize(XMFLOAT2(18, 18)); - physicsEnabledCheckBox->SetPos(XMFLOAT2(screenW - 25, 50)); + physicsEnabledCheckBox->SetSize(XMFLOAT2(20, 20)); + physicsEnabledCheckBox->SetPos(XMFLOAT2(screenW - 370, 45)); physicsEnabledCheckBox->SetTooltip("Toggle Physics Engine On/Off"); physicsEnabledCheckBox->OnClick([&](wiEventArgs args) { wiPhysicsEngine::SetEnabled(args.bValue); @@ -666,8 +761,8 @@ void EditorComponent::Load() GetGUI().AddWidget(physicsEnabledCheckBox); cinemaModeCheckBox = new wiCheckBox("Cinema Mode: "); - cinemaModeCheckBox->SetSize(XMFLOAT2(18, 18)); - cinemaModeCheckBox->SetPos(XMFLOAT2(screenW - 25, 72)); + cinemaModeCheckBox->SetSize(XMFLOAT2(20, 20)); + cinemaModeCheckBox->SetPos(XMFLOAT2(screenW - 240, 45)); cinemaModeCheckBox->SetTooltip("Toggle Cinema Mode (All HUD disabled). Press ESC to exit."); cinemaModeCheckBox->OnClick([&](wiEventArgs args) { if (renderPath != nullptr) @@ -683,7 +778,7 @@ void EditorComponent::Load() wiComboBox* renderPathComboBox = new wiComboBox("Render Path: "); renderPathComboBox->SetSize(XMFLOAT2(100, 20)); - renderPathComboBox->SetPos(XMFLOAT2(screenW - 128, 94)); + renderPathComboBox->SetPos(XMFLOAT2(screenW - 120, 45)); renderPathComboBox->AddItem("Forward"); renderPathComboBox->AddItem("Deferred"); renderPathComboBox->AddItem("Tiled Forward"); @@ -718,8 +813,8 @@ void EditorComponent::Load() sceneGraphView = new wiTreeList("Scene graph view (WIP)"); - sceneGraphView->SetPos(XMFLOAT2(0, screenH - 200)); - sceneGraphView->SetSize(XMFLOAT2(260, 200)); + sceneGraphView->SetSize(XMFLOAT2(260, 300)); + sceneGraphView->SetPos(XMFLOAT2(0, screenH - sceneGraphView->scale_local.y)); sceneGraphView->OnSelect([this](wiEventArgs args) { translator.selected.clear(); @@ -1384,23 +1479,6 @@ void EditorComponent::Update(float dt) } - // Springs - if (wiInput::Press((wiInput::BUTTON)'R')) - { - for (auto& x : translator.selected) - { - bool has_spring = scene.springs.Contains(x.entity); - if (scene.transforms.Contains(x.entity) && !has_spring) - { - SpringComponent& spring = scene.springs.Create(x.entity); - } - else if (has_spring) - { - scene.springs.Remove_KeepSorted(x.entity); - } - } - } - // Delete if (wiInput::Press(wiInput::KEYBOARD_BUTTON_DELETE)) @@ -1440,6 +1518,9 @@ void EditorComponent::Update(float dt) forceFieldWnd->SetEntity(INVALID_ENTITY); cameraWnd->SetEntity(INVALID_ENTITY); paintToolWnd->SetEntity(INVALID_ENTITY); + springWnd->SetEntity(INVALID_ENTITY); + ikWnd->SetEntity(INVALID_ENTITY); + transformWnd->SetEntity(INVALID_ENTITY); } else { @@ -1466,6 +1547,9 @@ void EditorComponent::Update(float dt) forceFieldWnd->SetEntity(picked.entity); cameraWnd->SetEntity(picked.entity); paintToolWnd->SetEntity(picked.entity, picked.subsetIndex); + springWnd->SetEntity(picked.entity); + ikWnd->SetEntity(picked.entity); + transformWnd->SetEntity(picked.entity); if (picked.subsetIndex >= 0) { @@ -1606,14 +1690,17 @@ void EditorComponent::Render() const } // Spring visualizer: - for (size_t i = 0; i < scene.springs.GetCount(); ++i) + if (springWnd->debugCheckBox->GetCheck()) { - const SpringComponent& spring = scene.springs[i]; - wiRenderer::RenderablePoint point; - point.position = spring.center_of_mass; - point.size = 0.05f; - point.color = XMFLOAT4(1, 1, 0, 1); - wiRenderer::DrawPoint(point); + for (size_t i = 0; i < scene.springs.GetCount(); ++i) + { + const SpringComponent& spring = scene.springs[i]; + wiRenderer::RenderablePoint point; + point.position = spring.center_of_mass; + point.size = 0.05f; + point.color = XMFLOAT4(1, 1, 0, 1); + wiRenderer::DrawPoint(point); + } } } diff --git a/Editor/Editor.h b/Editor/Editor.h index d69a35fe8..27b13904e 100644 --- a/Editor/Editor.h +++ b/Editor/Editor.h @@ -18,6 +18,9 @@ class HairParticleWindow; class ForceFieldWindow; class SoundWindow; class PaintToolWindow; +class SpringWindow; +class IKWindow; +class TransformWindow; class EditorLoadingScreen : public LoadingScreen { @@ -52,6 +55,9 @@ public: std::unique_ptr hairWnd; std::unique_ptr forceFieldWnd; std::unique_ptr paintToolWnd; + std::unique_ptr springWnd; + std::unique_ptr ikWnd; + std::unique_ptr transformWnd; Editor* main = nullptr; diff --git a/Editor/Editor.vcxproj b/Editor/Editor.vcxproj index 1c6176993..199360831 100644 --- a/Editor/Editor.vcxproj +++ b/Editor/Editor.vcxproj @@ -173,6 +173,7 @@ + @@ -185,10 +186,12 @@ + + @@ -202,6 +205,7 @@ + @@ -213,12 +217,14 @@ + Create Create Create Create + diff --git a/Editor/Editor.vcxproj.filters b/Editor/Editor.vcxproj.filters index dabccc23e..c88a81494 100644 --- a/Editor/Editor.vcxproj.filters +++ b/Editor/Editor.vcxproj.filters @@ -94,6 +94,15 @@ Code + + Code + + + Code + + + Code + @@ -165,6 +174,15 @@ Code + + Code + + + Code + + + Code + diff --git a/Editor/EmitterWindow.cpp b/Editor/EmitterWindow.cpp index e87444c65..1282bb75a 100644 --- a/Editor/EmitterWindow.cpp +++ b/Editor/EmitterWindow.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "EmitterWindow.h" +#include "Editor.h" #include @@ -7,7 +8,7 @@ using namespace std; using namespace wiECS; using namespace wiScene; -EmitterWindow::EmitterWindow(wiGUI* gui) : GUI(gui) +EmitterWindow::EmitterWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) { assert(GUI && "Invalid GUI!"); @@ -35,9 +36,12 @@ EmitterWindow::EmitterWindow(wiGUI* gui) : GUI(gui) addButton = new wiButton("Add Emitter"); addButton->SetPos(XMFLOAT2(x, y += step)); addButton->SetSize(XMFLOAT2(150, 30)); - addButton->OnClick([&](wiEventArgs args) { + addButton->OnClick([=](wiEventArgs args) { Scene& scene = wiScene::GetScene(); - scene.Entity_CreateEmitter("editorEmitter"); + Entity entity = scene.Entity_CreateEmitter("editorEmitter"); + editor->ClearSelected(); + editor->AddSelected(entity); + SetEntity(entity); }); addButton->SetTooltip("Add new emitter particle system."); emitterWindow->AddWidget(addButton); diff --git a/Editor/EmitterWindow.h b/Editor/EmitterWindow.h index b47a252ca..c7419c113 100644 --- a/Editor/EmitterWindow.h +++ b/Editor/EmitterWindow.h @@ -9,12 +9,14 @@ class wiComboBox; class wiColorPicker; class wiButton; +class EditorComponent; + class MaterialWindow; class EmitterWindow { public: - EmitterWindow(wiGUI* gui); + EmitterWindow(EditorComponent* editor); ~EmitterWindow(); wiECS::Entity entity; diff --git a/Editor/EnvProbeWindow.cpp b/Editor/EnvProbeWindow.cpp index 06060781b..cbb0bae1b 100644 --- a/Editor/EnvProbeWindow.cpp +++ b/Editor/EnvProbeWindow.cpp @@ -1,10 +1,11 @@ #include "stdafx.h" #include "EnvProbeWindow.h" +#include "Editor.h" using namespace wiECS; using namespace wiScene; -EnvProbeWindow::EnvProbeWindow(wiGUI* gui) : GUI(gui) +EnvProbeWindow::EnvProbeWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) { assert(GUI && "Invalid GUI!"); @@ -29,10 +30,13 @@ EnvProbeWindow::EnvProbeWindow(wiGUI* gui) : GUI(gui) generateButton = new wiButton("Put"); generateButton->SetPos(XMFLOAT2(x, y += step)); - generateButton->OnClick([](wiEventArgs args) { + generateButton->OnClick([=](wiEventArgs args) { XMFLOAT3 pos; XMStoreFloat3(&pos, XMVectorAdd(wiRenderer::GetCamera().GetEye(), wiRenderer::GetCamera().GetAt() * 4)); - wiScene::GetScene().Entity_CreateEnvironmentProbe("editorProbe", pos); + Entity entity = wiScene::GetScene().Entity_CreateEnvironmentProbe("editorProbe", pos); + editor->ClearSelected(); + editor->AddSelected(entity); + SetEntity(entity); }); envProbeWindow->AddWidget(generateButton); diff --git a/Editor/EnvProbeWindow.h b/Editor/EnvProbeWindow.h index 68cc43b52..ea2d5c8e9 100644 --- a/Editor/EnvProbeWindow.h +++ b/Editor/EnvProbeWindow.h @@ -6,10 +6,12 @@ class wiLabel; class wiCheckBox; class wiSlider; +class EditorComponent; + class EnvProbeWindow { public: - EnvProbeWindow(wiGUI* gui); + EnvProbeWindow(EditorComponent* editor); ~EnvProbeWindow(); wiGUI* GUI; diff --git a/Editor/ForceFieldWindow.cpp b/Editor/ForceFieldWindow.cpp index dff490e4d..877f6238b 100644 --- a/Editor/ForceFieldWindow.cpp +++ b/Editor/ForceFieldWindow.cpp @@ -1,11 +1,12 @@ #include "stdafx.h" #include "ForceFieldWindow.h" +#include "Editor.h" using namespace wiECS; using namespace wiScene; -ForceFieldWindow::ForceFieldWindow(wiGUI* gui) : GUI(gui) +ForceFieldWindow::ForceFieldWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) { assert(GUI && "Invalid GUI!"); @@ -78,7 +79,7 @@ ForceFieldWindow::ForceFieldWindow(wiGUI* gui) : GUI(gui) addButton = new wiButton("Add Force Field"); addButton->SetSize(XMFLOAT2(150, 30)); addButton->SetPos(XMFLOAT2(x, y += step * 2)); - addButton->OnClick([&](wiEventArgs args) { + addButton->OnClick([=](wiEventArgs args) { Entity entity = wiScene::GetScene().Entity_CreateForce("editorForce"); ForceFieldComponent* force = wiScene::GetScene().forces.GetComponent(entity); if (force != nullptr) @@ -95,6 +96,9 @@ ForceFieldWindow::ForceFieldWindow(wiGUI* gui) : GUI(gui) assert(0); break; } + editor->ClearSelected(); + editor->AddSelected(entity); + SetEntity(entity); } else { diff --git a/Editor/ForceFieldWindow.h b/Editor/ForceFieldWindow.h index 08d5f4e37..24a2fe300 100644 --- a/Editor/ForceFieldWindow.h +++ b/Editor/ForceFieldWindow.h @@ -8,10 +8,12 @@ class wiSlider; class wiComboBox; class wiColorPicker; +class EditorComponent; + class ForceFieldWindow { public: - ForceFieldWindow(wiGUI* gui); + ForceFieldWindow(EditorComponent* editor); ~ForceFieldWindow(); wiECS::Entity entity; diff --git a/Editor/HairParticleWindow.cpp b/Editor/HairParticleWindow.cpp index 62ea3c809..d7dae4e49 100644 --- a/Editor/HairParticleWindow.cpp +++ b/Editor/HairParticleWindow.cpp @@ -1,11 +1,12 @@ #include "stdafx.h" #include "HairParticleWindow.h" +#include "Editor.h" using namespace std; using namespace wiECS; using namespace wiScene; -HairParticleWindow::HairParticleWindow(wiGUI* gui) : GUI(gui) +HairParticleWindow::HairParticleWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) { assert(GUI && "Invalid GUI!"); @@ -21,9 +22,12 @@ HairParticleWindow::HairParticleWindow(wiGUI* gui) : GUI(gui) addButton = new wiButton("Add Hair Particle System"); addButton->SetPos(XMFLOAT2(x, y += step)); addButton->SetSize(XMFLOAT2(200, 30)); - addButton->OnClick([&](wiEventArgs args) { + addButton->OnClick([=](wiEventArgs args) { Scene& scene = wiScene::GetScene(); - scene.Entity_CreateHair("editorHair"); + Entity entity = scene.Entity_CreateHair("editorHair"); + editor->ClearSelected(); + editor->AddSelected(entity); + SetEntity(entity); }); addButton->SetTooltip("Add new hair particle system."); hairWindow->AddWidget(addButton); diff --git a/Editor/HairParticleWindow.h b/Editor/HairParticleWindow.h index 0ee48bb00..b109b3beb 100644 --- a/Editor/HairParticleWindow.h +++ b/Editor/HairParticleWindow.h @@ -10,12 +10,14 @@ class wiColorPicker; class wiButton; class wiTextInputField; +class EditorComponent; + class MaterialWindow; class HairParticleWindow { public: - HairParticleWindow(wiGUI* gui); + HairParticleWindow(EditorComponent* editor); ~HairParticleWindow(); wiECS::Entity entity; diff --git a/Editor/IKWindow.cpp b/Editor/IKWindow.cpp new file mode 100644 index 000000000..c7c029e56 --- /dev/null +++ b/Editor/IKWindow.cpp @@ -0,0 +1,154 @@ +#include "stdafx.h" +#include "IKWindow.h" +#include "Editor.h" + +using namespace wiECS; +using namespace wiScene; + + +IKWindow::IKWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) +{ + assert(GUI && "Invalid GUI!"); + + window = new wiWindow(GUI, "Inverse Kinematics (IK) Window"); + window->SetSize(XMFLOAT2(460, 200)); + GUI->AddWidget(window); + + float x = 100; + float y = 0; + float step = 25; + float siz = 200; + float hei = 20; + + createButton = new wiButton("Create"); + createButton->SetTooltip("Create/Remove IK Component to selected entity"); + createButton->SetPos(XMFLOAT2(x, y += step)); + createButton->SetSize(XMFLOAT2(siz, hei)); + window->AddWidget(createButton); + + targetCombo = new wiComboBox("Target: "); + targetCombo->SetSize(XMFLOAT2(siz, hei)); + targetCombo->SetPos(XMFLOAT2(x, y += step)); + targetCombo->SetEnabled(false); + targetCombo->OnSelect([&](wiEventArgs args) { + Scene& scene = wiScene::GetScene(); + InverseKinematicsComponent* ik = scene.inverse_kinematics.GetComponent(entity); + if (ik != nullptr) + { + if (args.iValue == 0) + { + ik->target = INVALID_ENTITY; + } + else + { + ik->target = scene.transforms.GetEntity(args.iValue - 1); + } + } + }); + targetCombo->SetTooltip("Choose a target entity (with transform) that the IK will follow"); + window->AddWidget(targetCombo); + + disabledCheckBox = new wiCheckBox("Disabled: "); + disabledCheckBox->SetTooltip("Disable simulation."); + disabledCheckBox->SetPos(XMFLOAT2(x, y += step)); + disabledCheckBox->SetSize(XMFLOAT2(hei, hei)); + disabledCheckBox->OnClick([=](wiEventArgs args) { + wiScene::GetScene().inverse_kinematics.GetComponent(entity)->SetDisabled(args.bValue); + }); + window->AddWidget(disabledCheckBox); + + chainLengthSlider = new wiSlider(0, 10, 0, 10, "Chain Length: "); + chainLengthSlider->SetTooltip("How far the hierarchy chain is simulated backwards from this entity"); + chainLengthSlider->SetPos(XMFLOAT2(x, y += step)); + chainLengthSlider->SetSize(XMFLOAT2(siz, hei)); + chainLengthSlider->OnSlide([&](wiEventArgs args) { + wiScene::GetScene().inverse_kinematics.GetComponent(entity)->chain_length = args.iValue; + }); + window->AddWidget(chainLengthSlider); + + iterationCountSlider = new wiSlider(0, 10, 1, 10, "Iteration Count: "); + iterationCountSlider->SetTooltip("How many iterations to compute the inverse kinematics for. Higher values are slower but more accurate."); + iterationCountSlider->SetPos(XMFLOAT2(x, y += step)); + iterationCountSlider->SetSize(XMFLOAT2(siz, hei)); + iterationCountSlider->OnSlide([&](wiEventArgs args) { + wiScene::GetScene().inverse_kinematics.GetComponent(entity)->iteration_count = args.iValue; + }); + window->AddWidget(iterationCountSlider); + + window->Translate(XMFLOAT3((float)wiRenderer::GetDevice()->GetScreenWidth() - 740, 150, 0)); + window->SetVisible(false); + + SetEntity(INVALID_ENTITY); +} + + +IKWindow::~IKWindow() +{ + window->RemoveWidgets(true); + GUI->RemoveWidget(window); + delete window; +} + +void IKWindow::SetEntity(Entity entity) +{ + this->entity = entity; + + Scene& scene = wiScene::GetScene(); + const InverseKinematicsComponent* ik = scene.inverse_kinematics.GetComponent(entity); + + if (ik != nullptr) + { + window->SetEnabled(true); + + disabledCheckBox->SetCheck(ik->IsDisabled()); + chainLengthSlider->SetValue((float)ik->chain_length); + iterationCountSlider->SetValue((float)ik->iteration_count); + + targetCombo->ClearItems(); + targetCombo->AddItem("NO TARGET"); + for (size_t i = 0; i < scene.transforms.GetCount(); ++i) + { + Entity entity = scene.transforms.GetEntity(i); + std::string str; + const NameComponent* name = scene.names.GetComponent(entity); + if (name != nullptr) + { + str = name->name; + } + str = str + " (" + std::to_string(entity) + ")"; + targetCombo->AddItem(str); + + if (ik->target == entity) + { + targetCombo->SetSelected((int)i + 1); + } + } + } + else + { + window->SetEnabled(false); + } + + const TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity); + if (transform != nullptr) + { + createButton->SetEnabled(true); + + if (ik == nullptr) + { + createButton->SetText("Create"); + createButton->OnClick([=](wiEventArgs args) { + wiScene::GetScene().inverse_kinematics.Create(entity).chain_length = 1; + SetEntity(entity); + }); + } + else + { + createButton->SetText("Remove"); + createButton->OnClick([=](wiEventArgs args) { + wiScene::GetScene().inverse_kinematics.Remove_KeepSorted(entity); + SetEntity(entity); + }); + } + } +} diff --git a/Editor/IKWindow.h b/Editor/IKWindow.h new file mode 100644 index 000000000..195b7bbe7 --- /dev/null +++ b/Editor/IKWindow.h @@ -0,0 +1,32 @@ +#pragma once + +class wiGUI; +class wiWindow; +class wiLabel; +class wiCheckBox; +class wiSlider; +class wiComboBox; +class wiColorPicker; + +class EditorComponent; + +class IKWindow +{ +public: + IKWindow(EditorComponent* editor); + ~IKWindow(); + + wiECS::Entity entity; + void SetEntity(wiECS::Entity entity); + + wiGUI* GUI; + + wiWindow* window; + + wiButton* createButton; + wiComboBox* targetCombo; + wiCheckBox* disabledCheckBox; + wiSlider* chainLengthSlider; + wiSlider* iterationCountSlider; +}; + diff --git a/Editor/LightWindow.cpp b/Editor/LightWindow.cpp index ae8d2941a..795539cdb 100644 --- a/Editor/LightWindow.cpp +++ b/Editor/LightWindow.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "LightWindow.h" +#include "Editor.h" #include @@ -8,7 +9,7 @@ using namespace wiGraphics; using namespace wiScene; -LightWindow::LightWindow(wiGUI* gui) : GUI(gui) +LightWindow::LightWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) { assert(GUI && "Invalid GUI!"); @@ -173,12 +174,15 @@ LightWindow::LightWindow(wiGUI* gui) : GUI(gui) addLightButton = new wiButton("Add Light"); addLightButton->SetPos(XMFLOAT2(x, y += step)); addLightButton->SetSize(XMFLOAT2(150, 30)); - addLightButton->OnClick([&](wiEventArgs args) { + addLightButton->OnClick([=](wiEventArgs args) { Entity entity = wiScene::GetScene().Entity_CreateLight("editorLight", XMFLOAT3(0, 3, 0), XMFLOAT3(1, 1, 1), 2, 60); LightComponent* light = wiScene::GetScene().lights.GetComponent(entity); if (light != nullptr) { light->type = (LightComponent::LightType)typeSelectorComboBox->GetSelected(); + editor->ClearSelected(); + editor->AddSelected(entity); + SetEntity(entity); } else { diff --git a/Editor/LightWindow.h b/Editor/LightWindow.h index d9867491e..0c94a6b68 100644 --- a/Editor/LightWindow.h +++ b/Editor/LightWindow.h @@ -9,10 +9,12 @@ class wiButton; class wiColorPicker; class wiComboBox; +class EditorComponent; + class LightWindow { public: - LightWindow(wiGUI* gui); + LightWindow(EditorComponent* editor); ~LightWindow(); wiGUI* GUI; diff --git a/Editor/PostprocessWindow.cpp b/Editor/PostprocessWindow.cpp index d0c71aa53..bc6a02186 100644 --- a/Editor/PostprocessWindow.cpp +++ b/Editor/PostprocessWindow.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "PostprocessWindow.h" +#include "Editor.h" #include @@ -7,9 +8,8 @@ using namespace std; using namespace wiGraphics; -PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), component(comp) +PostprocessWindow::PostprocessWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) { - assert(component && "PostprocessWnd invalid component!"); assert(GUI && "Invalid GUI!"); ppWindow = new wiWindow(GUI, "PostProcess Window"); @@ -25,9 +25,9 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), exposureSlider->SetScriptTip("RenderPath3D::SetExposure(float value)"); exposureSlider->SetSize(XMFLOAT2(100, 20)); exposureSlider->SetPos(XMFLOAT2(x, y += step)); - exposureSlider->SetValue(component->getExposure()); + exposureSlider->SetValue(editor->renderPath->getExposure()); exposureSlider->OnSlide([&](wiEventArgs args) { - component->setExposure(args.fValue); + editor->renderPath->setExposure(args.fValue); }); ppWindow->AddWidget(exposureSlider); @@ -35,9 +35,9 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), 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->SetPos(XMFLOAT2(x, y += step)); - lensFlareCheckBox->SetCheck(component->getLensFlareEnabled()); + lensFlareCheckBox->SetCheck(editor->renderPath->getLensFlareEnabled()); lensFlareCheckBox->OnClick([&](wiEventArgs args) { - component->setLensFlareEnabled(args.bValue); + editor->renderPath->setLensFlareEnabled(args.bValue); }); ppWindow->AddWidget(lensFlareCheckBox); @@ -45,9 +45,9 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), lightShaftsCheckBox->SetTooltip("Enable light shaft for directional light sources."); lightShaftsCheckBox->SetScriptTip("RenderPath3D::SetLightShaftsEnabled(bool value)"); lightShaftsCheckBox->SetPos(XMFLOAT2(x, y += step)); - lightShaftsCheckBox->SetCheck(component->getLightShaftsEnabled()); + lightShaftsCheckBox->SetCheck(editor->renderPath->getLightShaftsEnabled()); lightShaftsCheckBox->OnClick([&](wiEventArgs args) { - component->setLightShaftsEnabled(args.bValue); + editor->renderPath->setLightShaftsEnabled(args.bValue); }); ppWindow->AddWidget(lightShaftsCheckBox); @@ -59,9 +59,9 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), aoComboBox->AddItem("SSAO"); aoComboBox->AddItem("HBAO"); aoComboBox->AddItem("MSAO"); - aoComboBox->SetSelected(component->getAO()); + aoComboBox->SetSelected(editor->renderPath->getAO()); aoComboBox->OnSelect([&](wiEventArgs args) { - component->setAO((RenderPath3D::AO)args.iValue); + editor->renderPath->setAO((RenderPath3D::AO)args.iValue); }); ppWindow->AddWidget(aoComboBox); @@ -69,9 +69,9 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), aoPowerSlider->SetTooltip("Set SSAO Power. Higher values produce darker, more pronounced effect"); aoPowerSlider->SetSize(XMFLOAT2(100, 20)); aoPowerSlider->SetPos(XMFLOAT2(x + 100, y += step)); - aoPowerSlider->SetValue((float)component->getAOPower()); + aoPowerSlider->SetValue((float)editor->renderPath->getAOPower()); aoPowerSlider->OnSlide([&](wiEventArgs args) { - component->setAOPower(args.fValue); + editor->renderPath->setAOPower(args.fValue); }); ppWindow->AddWidget(aoPowerSlider); @@ -79,9 +79,9 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), ssrCheckBox->SetTooltip("Enable Screen Space Reflections."); ssrCheckBox->SetScriptTip("RenderPath3D::SetSSREnabled(bool value)"); ssrCheckBox->SetPos(XMFLOAT2(x, y += step)); - ssrCheckBox->SetCheck(component->getSSREnabled()); + ssrCheckBox->SetCheck(editor->renderPath->getSSREnabled()); ssrCheckBox->OnClick([&](wiEventArgs args) { - component->setSSREnabled(args.bValue); + editor->renderPath->setSSREnabled(args.bValue); }); ppWindow->AddWidget(ssrCheckBox); @@ -89,18 +89,18 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), sssCheckBox->SetTooltip("Enable Subsurface Scattering. (Deferred only for now)"); sssCheckBox->SetScriptTip("RenderPath3D::SetSSSEnabled(bool value)"); sssCheckBox->SetPos(XMFLOAT2(x, y += step)); - sssCheckBox->SetCheck(component->getSSSEnabled()); + sssCheckBox->SetCheck(editor->renderPath->getSSSEnabled()); sssCheckBox->OnClick([&](wiEventArgs args) { - component->setSSSEnabled(args.bValue); + editor->renderPath->setSSSEnabled(args.bValue); }); ppWindow->AddWidget(sssCheckBox); eyeAdaptionCheckBox = new wiCheckBox("EyeAdaption: "); eyeAdaptionCheckBox->SetTooltip("Enable eye adaption for the overall screen luminance"); eyeAdaptionCheckBox->SetPos(XMFLOAT2(x, y += step)); - eyeAdaptionCheckBox->SetCheck(component->getEyeAdaptionEnabled()); + eyeAdaptionCheckBox->SetCheck(editor->renderPath->getEyeAdaptionEnabled()); eyeAdaptionCheckBox->OnClick([&](wiEventArgs args) { - component->setEyeAdaptionEnabled(args.bValue); + editor->renderPath->setEyeAdaptionEnabled(args.bValue); }); ppWindow->AddWidget(eyeAdaptionCheckBox); @@ -108,9 +108,9 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), motionBlurCheckBox->SetTooltip("Enable motion blur for camera movement and animated meshes."); motionBlurCheckBox->SetScriptTip("RenderPath3D::SetMotionBlurEnabled(bool value)"); motionBlurCheckBox->SetPos(XMFLOAT2(x, y += step)); - motionBlurCheckBox->SetCheck(component->getMotionBlurEnabled()); + motionBlurCheckBox->SetCheck(editor->renderPath->getMotionBlurEnabled()); motionBlurCheckBox->OnClick([&](wiEventArgs args) { - component->setMotionBlurEnabled(args.bValue); + editor->renderPath->setMotionBlurEnabled(args.bValue); }); ppWindow->AddWidget(motionBlurCheckBox); @@ -119,9 +119,9 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), motionBlurStrengthSlider->SetScriptTip("RenderPath3D::SetMotionBlurStrength(float value)"); motionBlurStrengthSlider->SetSize(XMFLOAT2(100, 20)); motionBlurStrengthSlider->SetPos(XMFLOAT2(x + 100, y)); - motionBlurStrengthSlider->SetValue(component->getMotionBlurStrength()); + motionBlurStrengthSlider->SetValue(editor->renderPath->getMotionBlurStrength()); motionBlurStrengthSlider->OnSlide([&](wiEventArgs args) { - component->setMotionBlurStrength(args.fValue); + editor->renderPath->setMotionBlurStrength(args.fValue); }); ppWindow->AddWidget(motionBlurStrengthSlider); @@ -129,9 +129,9 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), depthOfFieldCheckBox->SetTooltip("Enable Depth of field effect. Additional focus and strength setup required."); depthOfFieldCheckBox->SetScriptTip("RenderPath3D::SetDepthOfFieldEnabled(bool value)"); depthOfFieldCheckBox->SetPos(XMFLOAT2(x, y += step)); - depthOfFieldCheckBox->SetCheck(component->getDepthOfFieldEnabled()); + depthOfFieldCheckBox->SetCheck(editor->renderPath->getDepthOfFieldEnabled()); depthOfFieldCheckBox->OnClick([&](wiEventArgs args) { - component->setDepthOfFieldEnabled(args.bValue); + editor->renderPath->setDepthOfFieldEnabled(args.bValue); }); ppWindow->AddWidget(depthOfFieldCheckBox); @@ -140,9 +140,9 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), depthOfFieldFocusSlider->SetScriptTip("RenderPath3D::SetDepthOfFieldFocus(float value)"); depthOfFieldFocusSlider->SetSize(XMFLOAT2(100, 20)); depthOfFieldFocusSlider->SetPos(XMFLOAT2(x + 100, y)); - depthOfFieldFocusSlider->SetValue(component->getDepthOfFieldFocus()); + depthOfFieldFocusSlider->SetValue(editor->renderPath->getDepthOfFieldFocus()); depthOfFieldFocusSlider->OnSlide([&](wiEventArgs args) { - component->setDepthOfFieldFocus(args.fValue); + editor->renderPath->setDepthOfFieldFocus(args.fValue); }); ppWindow->AddWidget(depthOfFieldFocusSlider); @@ -151,9 +151,9 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), depthOfFieldScaleSlider->SetScriptTip("RenderPath3D::SetDepthOfFieldStrength(float value)"); depthOfFieldScaleSlider->SetSize(XMFLOAT2(100, 20)); depthOfFieldScaleSlider->SetPos(XMFLOAT2(x + 100, y += step)); - depthOfFieldScaleSlider->SetValue(component->getDepthOfFieldStrength()); + depthOfFieldScaleSlider->SetValue(editor->renderPath->getDepthOfFieldStrength()); depthOfFieldScaleSlider->OnSlide([&](wiEventArgs args) { - component->setDepthOfFieldStrength(args.fValue); + editor->renderPath->setDepthOfFieldStrength(args.fValue); }); ppWindow->AddWidget(depthOfFieldScaleSlider); @@ -162,9 +162,9 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), depthOfFieldAspectSlider->SetScriptTip("RenderPath3D::SetDepthOfFieldAspect(float value)"); depthOfFieldAspectSlider->SetSize(XMFLOAT2(100, 20)); depthOfFieldAspectSlider->SetPos(XMFLOAT2(x + 100, y += step)); - depthOfFieldAspectSlider->SetValue(component->getDepthOfFieldAspect()); + depthOfFieldAspectSlider->SetValue(editor->renderPath->getDepthOfFieldAspect()); depthOfFieldAspectSlider->OnSlide([&](wiEventArgs args) { - component->setDepthOfFieldAspect(args.fValue); + editor->renderPath->setDepthOfFieldAspect(args.fValue); }); ppWindow->AddWidget(depthOfFieldAspectSlider); @@ -172,9 +172,9 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), bloomCheckBox->SetTooltip("Enable bloom. The effect adds color bleeding to the brightest parts of the scene."); bloomCheckBox->SetScriptTip("RenderPath3D::SetBloomEnabled(bool value)"); bloomCheckBox->SetPos(XMFLOAT2(x, y += step)); - bloomCheckBox->SetCheck(component->getBloomEnabled()); + bloomCheckBox->SetCheck(editor->renderPath->getBloomEnabled()); bloomCheckBox->OnClick([&](wiEventArgs args) { - component->setBloomEnabled(args.bValue); + editor->renderPath->setBloomEnabled(args.bValue); }); ppWindow->AddWidget(bloomCheckBox); @@ -182,9 +182,9 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), bloomStrengthSlider->SetTooltip("Set bloom threshold. The values below this will not glow on the screen."); bloomStrengthSlider->SetSize(XMFLOAT2(100, 20)); bloomStrengthSlider->SetPos(XMFLOAT2(x + 100, y)); - bloomStrengthSlider->SetValue(component->getBloomThreshold()); + bloomStrengthSlider->SetValue(editor->renderPath->getBloomThreshold()); bloomStrengthSlider->OnSlide([&](wiEventArgs args) { - component->setBloomThreshold(args.fValue); + editor->renderPath->setBloomThreshold(args.fValue); }); ppWindow->AddWidget(bloomStrengthSlider); @@ -192,9 +192,9 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), fxaaCheckBox->SetTooltip("Fast Approximate Anti Aliasing. A fast antialiasing method, but can be a bit too blurry."); fxaaCheckBox->SetScriptTip("RenderPath3D::SetFXAAEnabled(bool value)"); fxaaCheckBox->SetPos(XMFLOAT2(x, y += step)); - fxaaCheckBox->SetCheck(component->getFXAAEnabled()); + fxaaCheckBox->SetCheck(editor->renderPath->getFXAAEnabled()); fxaaCheckBox->OnClick([&](wiEventArgs args) { - component->setFXAAEnabled(args.bValue); + editor->renderPath->setFXAAEnabled(args.bValue); }); ppWindow->AddWidget(fxaaCheckBox); @@ -202,9 +202,9 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), colorGradingCheckBox->SetTooltip("Enable color grading of the final render. An additional lookup texture must be set for it to take effect."); colorGradingCheckBox->SetScriptTip("RenderPath3D::SetColorGradingEnabled(bool value)"); colorGradingCheckBox->SetPos(XMFLOAT2(x, y += step)); - colorGradingCheckBox->SetCheck(component->getColorGradingEnabled()); + colorGradingCheckBox->SetCheck(editor->renderPath->getColorGradingEnabled()); colorGradingCheckBox->OnClick([&](wiEventArgs args) { - component->setColorGradingEnabled(args.bValue); + editor->renderPath->setColorGradingEnabled(args.bValue); }); ppWindow->AddWidget(colorGradingCheckBox); @@ -213,7 +213,7 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), colorGradingButton->SetPos(XMFLOAT2(x + 35, y)); colorGradingButton->SetSize(XMFLOAT2(200, 18)); colorGradingButton->OnClick([=](wiEventArgs args) { - auto x = component->getColorGradingTexture(); + auto x = editor->renderPath->getColorGradingTexture(); if (x == nullptr) { @@ -230,8 +230,8 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), if (result.ok) { string fileName = result.filenames.front(); - component->setColorGradingTexture(wiResourceManager::Load(fileName)); - if (component->getColorGradingTexture() != nullptr) + editor->renderPath->setColorGradingTexture(wiResourceManager::Load(fileName)); + if (editor->renderPath->getColorGradingTexture() != nullptr) { colorGradingButton->SetText(fileName); } @@ -240,7 +240,7 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), } else { - component->setColorGradingTexture(nullptr); + editor->renderPath->setColorGradingTexture(nullptr); colorGradingButton->SetText("Load Color Grading LUT..."); } @@ -250,9 +250,9 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), outlineCheckBox = new wiCheckBox("Dithering: "); outlineCheckBox->SetTooltip("Toggle the full screen dithering effect. This helps to reduce color banding."); outlineCheckBox->SetPos(XMFLOAT2(x, y += step)); - outlineCheckBox->SetCheck(component->getDitherEnabled()); + outlineCheckBox->SetCheck(editor->renderPath->getDitherEnabled()); outlineCheckBox->OnClick([&](wiEventArgs args) { - component->setDitherEnabled(args.bValue); + editor->renderPath->setDitherEnabled(args.bValue); }); ppWindow->AddWidget(outlineCheckBox); @@ -260,9 +260,9 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), sharpenFilterCheckBox->SetTooltip("Toggle sharpening post process of the final image."); sharpenFilterCheckBox->SetScriptTip("RenderPath3D::SetSharpenFilterEnabled(bool value)"); sharpenFilterCheckBox->SetPos(XMFLOAT2(x, y += step)); - sharpenFilterCheckBox->SetCheck(component->getSharpenFilterEnabled()); + sharpenFilterCheckBox->SetCheck(editor->renderPath->getSharpenFilterEnabled()); sharpenFilterCheckBox->OnClick([&](wiEventArgs args) { - component->setSharpenFilterEnabled(args.bValue); + editor->renderPath->setSharpenFilterEnabled(args.bValue); }); ppWindow->AddWidget(sharpenFilterCheckBox); @@ -271,18 +271,18 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), sharpenFilterAmountSlider->SetScriptTip("RenderPath3D::SetSharpenFilterAmount(float value)"); sharpenFilterAmountSlider->SetSize(XMFLOAT2(100, 20)); sharpenFilterAmountSlider->SetPos(XMFLOAT2(x + 100, y)); - sharpenFilterAmountSlider->SetValue(component->getSharpenFilterAmount()); + sharpenFilterAmountSlider->SetValue(editor->renderPath->getSharpenFilterAmount()); sharpenFilterAmountSlider->OnSlide([&](wiEventArgs args) { - component->setSharpenFilterAmount(args.fValue); + editor->renderPath->setSharpenFilterAmount(args.fValue); }); ppWindow->AddWidget(sharpenFilterAmountSlider); outlineCheckBox = new wiCheckBox("Cartoon Outline: "); outlineCheckBox->SetTooltip("Toggle the full screen cartoon outline effect."); outlineCheckBox->SetPos(XMFLOAT2(x, y += step)); - outlineCheckBox->SetCheck(component->getOutlineEnabled()); + outlineCheckBox->SetCheck(editor->renderPath->getOutlineEnabled()); outlineCheckBox->OnClick([&](wiEventArgs args) { - component->setOutlineEnabled(args.bValue); + editor->renderPath->setOutlineEnabled(args.bValue); }); ppWindow->AddWidget(outlineCheckBox); @@ -290,9 +290,9 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), outlineThresholdSlider->SetTooltip("Outline edge detection threshold. Increase if not enough otlines are detected, decrease if too many outlines are detected."); outlineThresholdSlider->SetSize(XMFLOAT2(100, 20)); outlineThresholdSlider->SetPos(XMFLOAT2(x + 100, y)); - outlineThresholdSlider->SetValue(component->getOutlineThreshold()); + outlineThresholdSlider->SetValue(editor->renderPath->getOutlineThreshold()); outlineThresholdSlider->OnSlide([&](wiEventArgs args) { - component->setOutlineThreshold(args.fValue); + editor->renderPath->setOutlineThreshold(args.fValue); }); ppWindow->AddWidget(outlineThresholdSlider); @@ -300,18 +300,18 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), outlineThicknessSlider->SetTooltip("Set outline thickness."); outlineThicknessSlider->SetSize(XMFLOAT2(100, 20)); outlineThicknessSlider->SetPos(XMFLOAT2(x + 100, y += step)); - outlineThicknessSlider->SetValue(component->getOutlineThickness()); + outlineThicknessSlider->SetValue(editor->renderPath->getOutlineThickness()); outlineThicknessSlider->OnSlide([&](wiEventArgs args) { - component->setOutlineThickness(args.fValue); + editor->renderPath->setOutlineThickness(args.fValue); }); ppWindow->AddWidget(outlineThicknessSlider); chromaticaberrationCheckBox = new wiCheckBox("Chromatic Aberration: "); chromaticaberrationCheckBox->SetTooltip("Toggle the full screen chromatic aberration effect. This simulates lens distortion at screen edges."); chromaticaberrationCheckBox->SetPos(XMFLOAT2(x, y += step)); - chromaticaberrationCheckBox->SetCheck(component->getOutlineEnabled()); + chromaticaberrationCheckBox->SetCheck(editor->renderPath->getOutlineEnabled()); chromaticaberrationCheckBox->OnClick([&](wiEventArgs args) { - component->setChromaticAberrationEnabled(args.bValue); + editor->renderPath->setChromaticAberrationEnabled(args.bValue); }); ppWindow->AddWidget(chromaticaberrationCheckBox); @@ -319,9 +319,9 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, RenderPath3D* comp) : GUI(gui), chromaticaberrationSlider->SetTooltip("The lens distortion amount."); chromaticaberrationSlider->SetSize(XMFLOAT2(100, 20)); chromaticaberrationSlider->SetPos(XMFLOAT2(x + 100, y)); - chromaticaberrationSlider->SetValue(component->getChromaticAberrationAmount()); + chromaticaberrationSlider->SetValue(editor->renderPath->getChromaticAberrationAmount()); chromaticaberrationSlider->OnSlide([&](wiEventArgs args) { - component->setChromaticAberrationAmount(args.fValue); + editor->renderPath->setChromaticAberrationAmount(args.fValue); }); ppWindow->AddWidget(chromaticaberrationSlider); diff --git a/Editor/PostprocessWindow.h b/Editor/PostprocessWindow.h index a509f0164..248af9287 100644 --- a/Editor/PostprocessWindow.h +++ b/Editor/PostprocessWindow.h @@ -1,7 +1,5 @@ #pragma once -class RenderPath3D; - class wiGUI; class wiWindow; class wiLabel; @@ -10,14 +8,15 @@ class wiSlider; class wiButton; class wiComboBox; +class EditorComponent; + class PostprocessWindow { public: - PostprocessWindow(wiGUI* gui, RenderPath3D* component); + PostprocessWindow(EditorComponent* editor); ~PostprocessWindow(); wiGUI* GUI; - RenderPath3D* component; wiWindow* ppWindow; wiSlider* exposureSlider; diff --git a/Editor/RendererWindow.cpp b/Editor/RendererWindow.cpp index 3acc97b87..cdcd900a5 100644 --- a/Editor/RendererWindow.cpp +++ b/Editor/RendererWindow.cpp @@ -4,7 +4,7 @@ #include "Editor.h" -RendererWindow::RendererWindow(wiGUI* gui, EditorComponent* editorcomponent, RenderPath3D* path) : GUI(gui) +RendererWindow::RendererWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) { assert(GUI && "Invalid GUI!"); @@ -13,10 +13,10 @@ RendererWindow::RendererWindow(wiGUI* gui, EditorComponent* editorcomponent, Ren wiRenderer::SetToDrawDebugCameras(true); rendererWindow = new wiWindow(GUI, "Renderer Window"); - rendererWindow->SetSize(XMFLOAT2(640, 790)); + rendererWindow->SetSize(XMFLOAT2(640, 700)); GUI->AddWidget(rendererWindow); - float x = 260, y = 20, step = 30, sliderheight = 26; + float x = 260, y = 0, step = 28, sliderheight = 26; vsyncCheckBox = new wiCheckBox("VSync: "); vsyncCheckBox->SetTooltip("Toggle vertical sync"); @@ -69,7 +69,7 @@ RendererWindow::RendererWindow(wiGUI* gui, EditorComponent* editorcomponent, Ren voxelRadianceDebugCheckBox = new wiCheckBox("DEBUG: "); voxelRadianceDebugCheckBox->SetTooltip("Toggle Voxel GI visualization."); - voxelRadianceDebugCheckBox->SetPos(XMFLOAT2(x + 130, y)); + voxelRadianceDebugCheckBox->SetPos(XMFLOAT2(x + 122, y)); voxelRadianceDebugCheckBox->OnClick([](wiEventArgs args) { wiRenderer::SetToDrawVoxelHelper(args.bValue); }); @@ -87,7 +87,7 @@ RendererWindow::RendererWindow(wiGUI* gui, EditorComponent* editorcomponent, Ren voxelRadianceReflectionsCheckBox = new wiCheckBox("Reflections: "); voxelRadianceReflectionsCheckBox->SetTooltip("Toggle specular reflections computation for Voxel GI."); - voxelRadianceReflectionsCheckBox->SetPos(XMFLOAT2(x + 130, y)); + voxelRadianceReflectionsCheckBox->SetPos(XMFLOAT2(x + 122, y)); voxelRadianceReflectionsCheckBox->OnClick([](wiEventArgs args) { wiRenderer::SetVoxelRadianceReflectionsEnabled(args.bValue); }); @@ -154,7 +154,7 @@ RendererWindow::RendererWindow(wiGUI* gui, EditorComponent* editorcomponent, Ren debugLightCullingCheckBox = new wiCheckBox("DEBUG: "); debugLightCullingCheckBox->SetTooltip("Toggle visualization of the screen space light culling heatmap grid (Tiled renderer only)"); - debugLightCullingCheckBox->SetPos(XMFLOAT2(x + 100, y)); + debugLightCullingCheckBox->SetPos(XMFLOAT2(x + 122, y)); debugLightCullingCheckBox->OnClick([](wiEventArgs args) { wiRenderer::SetDebugLightCulling(args.bValue); }); @@ -165,7 +165,7 @@ RendererWindow::RendererWindow(wiGUI* gui, EditorComponent* editorcomponent, Ren tessellationCheckBox->SetTooltip("Enable tessellation feature. You also need to specify a tessellation factor for individual objects."); tessellationCheckBox->SetPos(XMFLOAT2(x, y += step)); tessellationCheckBox->OnClick([=](wiEventArgs args) { - path->setTessellationEnabled(args.bValue); + editor->renderPath->setTessellationEnabled(args.bValue); }); tessellationCheckBox->SetCheck(false); rendererWindow->AddWidget(tessellationCheckBox); @@ -199,7 +199,7 @@ RendererWindow::RendererWindow(wiGUI* gui, EditorComponent* editorcomponent, Ren }); rendererWindow->AddWidget(transparentShadowsCheckBox); - shadowProps2DComboBox = new wiComboBox("2D Shadowmap resolution:"); + shadowProps2DComboBox = new wiComboBox("2D Shadowmap resolution: "); shadowProps2DComboBox->SetSize(XMFLOAT2(100, 20)); shadowProps2DComboBox->SetPos(XMFLOAT2(x, y += step)); shadowProps2DComboBox->AddItem("Off"); @@ -244,7 +244,7 @@ RendererWindow::RendererWindow(wiGUI* gui, EditorComponent* editorcomponent, Ren shadowProps2DComboBox->SetScriptTip("SetShadowProps2D(int resolution, int count, int softShadowQuality)"); rendererWindow->AddWidget(shadowProps2DComboBox); - shadowPropsCubeComboBox = new wiComboBox("Cube Shadowmap resolution:"); + shadowPropsCubeComboBox = new wiComboBox("Cube Shadowmap resolution: "); shadowPropsCubeComboBox->SetSize(XMFLOAT2(100, 20)); shadowPropsCubeComboBox->SetPos(XMFLOAT2(x, y += step)); shadowPropsCubeComboBox->AddItem("Off"); @@ -288,7 +288,7 @@ RendererWindow::RendererWindow(wiGUI* gui, EditorComponent* editorcomponent, Ren shadowPropsCubeComboBox->SetScriptTip("SetShadowPropsCube(int resolution, int count)"); rendererWindow->AddWidget(shadowPropsCubeComboBox); - MSAAComboBox = new wiComboBox("MSAA:"); + MSAAComboBox = new wiComboBox("MSAA: "); MSAAComboBox->SetSize(XMFLOAT2(100, 20)); MSAAComboBox->SetPos(XMFLOAT2(x, y += step)); MSAAComboBox->AddItem("Off"); @@ -299,21 +299,20 @@ RendererWindow::RendererWindow(wiGUI* gui, EditorComponent* editorcomponent, Ren switch (args.iValue) { case 0: - path->setMSAASampleCount(1); + editor->renderPath->setMSAASampleCount(1); break; case 1: - path->setMSAASampleCount(2); + editor->renderPath->setMSAASampleCount(2); break; case 2: - path->setMSAASampleCount(4); + editor->renderPath->setMSAASampleCount(4); break; case 3: - path->setMSAASampleCount(8); + editor->renderPath->setMSAASampleCount(8); break; default: break; } - editorcomponent->ResizeBuffers(); }); MSAAComboBox->SetSelected(0); MSAAComboBox->SetEnabled(true); @@ -332,14 +331,14 @@ RendererWindow::RendererWindow(wiGUI* gui, EditorComponent* editorcomponent, Ren temporalAADebugCheckBox = new wiCheckBox("DEBUGJitter: "); temporalAADebugCheckBox->SetText("DEBUG: "); temporalAADebugCheckBox->SetTooltip("Disable blending of frame history. Camera Subpixel jitter will be visible."); - temporalAADebugCheckBox->SetPos(XMFLOAT2(x + 100, y)); + temporalAADebugCheckBox->SetPos(XMFLOAT2(x + 122, y)); temporalAADebugCheckBox->OnClick([](wiEventArgs args) { wiRenderer::SetTemporalAADebugEnabled(args.bValue); }); temporalAADebugCheckBox->SetCheck(wiRenderer::GetTemporalAADebugEnabled()); rendererWindow->AddWidget(temporalAADebugCheckBox); - textureQualityComboBox = new wiComboBox("Texture Quality:"); + textureQualityComboBox = new wiComboBox("Texture Quality: "); textureQualityComboBox->SetSize(XMFLOAT2(100, 20)); textureQualityComboBox->SetPos(XMFLOAT2(x, y += step)); textureQualityComboBox->AddItem("Nearest"); @@ -399,7 +398,7 @@ RendererWindow::RendererWindow(wiGUI* gui, EditorComponent* editorcomponent, Ren // Visualizer toggles: - x = 600, y = 20; + x = 600, y = 0; partitionBoxesCheckBox = new wiCheckBox("SPTree visualizer: "); partitionBoxesCheckBox->SetTooltip("Visualize the world space partitioning tree as boxes"); diff --git a/Editor/RendererWindow.h b/Editor/RendererWindow.h index db8136e0e..ca28400c4 100644 --- a/Editor/RendererWindow.h +++ b/Editor/RendererWindow.h @@ -1,7 +1,5 @@ #pragma once -class EditorComponent; - class wiGUI; class wiWindow; class wiLabel; @@ -9,6 +7,8 @@ class wiCheckBox; class wiSlider; class wiComboBox; +class EditorComponent; + enum PICKTYPE { PICK_VOID = 0, @@ -27,7 +27,7 @@ enum PICKTYPE class RendererWindow { public: - RendererWindow(wiGUI* gui, EditorComponent* editorcomponent, RenderPath3D* path); + RendererWindow(EditorComponent* editorcomponent); ~RendererWindow(); wiGUI* GUI; diff --git a/Editor/SoundWindow.cpp b/Editor/SoundWindow.cpp index 55ccd0073..b9bc5d02b 100644 --- a/Editor/SoundWindow.cpp +++ b/Editor/SoundWindow.cpp @@ -1,6 +1,7 @@ #include "stdafx.h" #include "SoundWindow.h" #include "wiAudio.h" +#include "Editor.h" #include @@ -9,7 +10,7 @@ using namespace wiGraphics; using namespace wiECS; using namespace wiScene; -SoundWindow::SoundWindow(wiGUI* gui) : GUI(gui) +SoundWindow::SoundWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) { assert(GUI && "Invalid GUI!"); @@ -66,7 +67,7 @@ SoundWindow::SoundWindow(wiGUI* gui) : GUI(gui) addButton->SetTooltip("Add a sound file to the scene."); addButton->SetPos(XMFLOAT2(x, y += step)); addButton->SetSize(XMFLOAT2(80, 30)); - addButton->OnClick([&](wiEventArgs args) { + addButton->OnClick([=](wiEventArgs args) { wiHelper::FileDialogParams params; wiHelper::FileDialogResult result; params.type = wiHelper::FileDialogParams::OPEN; @@ -77,6 +78,9 @@ SoundWindow::SoundWindow(wiGUI* gui) : GUI(gui) if (result.ok) { string fileName = result.filenames.front(); Entity entity = GetScene().Entity_CreateSound("editorSound", fileName); + editor->ClearSelected(); + editor->AddSelected(entity); + SetEntity(entity); } }); soundWindow->AddWidget(addButton); diff --git a/Editor/SoundWindow.h b/Editor/SoundWindow.h index 44dc0168b..fc2a1d0ef 100644 --- a/Editor/SoundWindow.h +++ b/Editor/SoundWindow.h @@ -10,10 +10,12 @@ class wiButton; class wiComboBox; class wiTextInputField; +class EditorComponent; + class SoundWindow { public: - SoundWindow(wiGUI* gui); + SoundWindow(EditorComponent* editor); ~SoundWindow(); wiECS::Entity entity = wiECS::INVALID_ENTITY; diff --git a/Editor/SpringWindow.cpp b/Editor/SpringWindow.cpp new file mode 100644 index 000000000..6c72cdff6 --- /dev/null +++ b/Editor/SpringWindow.cpp @@ -0,0 +1,149 @@ +#include "stdafx.h" +#include "SpringWindow.h" +#include "Editor.h" + +using namespace wiECS; +using namespace wiScene; + + +SpringWindow::SpringWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) +{ + assert(GUI && "Invalid GUI!"); + + window = new wiWindow(GUI, "Spring Window"); + window->SetSize(XMFLOAT2(460, 230)); + GUI->AddWidget(window); + + float x = 150; + float y = 0; + float step = 25; + float siz = 200; + float hei = 20; + + createButton = new wiButton("Create"); + createButton->SetTooltip("Create/Remove Spring Component to selected entity"); + createButton->SetPos(XMFLOAT2(x, y += step)); + createButton->SetSize(XMFLOAT2(siz, hei)); + window->AddWidget(createButton); + + debugCheckBox = new wiCheckBox("DEBUG: "); + debugCheckBox->SetTooltip("Enabling this will visualize springs as small yellow X-es in the scene"); + debugCheckBox->SetPos(XMFLOAT2(x, y += step)); + debugCheckBox->SetSize(XMFLOAT2(hei, hei)); + window->AddWidget(debugCheckBox); + + disabledCheckBox = new wiCheckBox("Disabled: "); + disabledCheckBox->SetTooltip("Disable simulation."); + disabledCheckBox->SetPos(XMFLOAT2(x, y += step)); + disabledCheckBox->SetSize(XMFLOAT2(hei, hei)); + disabledCheckBox->OnClick([=](wiEventArgs args) { + wiScene::GetScene().springs.GetComponent(entity)->SetDisabled(args.bValue); + }); + window->AddWidget(disabledCheckBox); + + stretchCheckBox = new wiCheckBox("Stretch enabled: "); + stretchCheckBox->SetTooltip("Stretch means that length from parent transform won't be preserved."); + stretchCheckBox->SetPos(XMFLOAT2(x, y += step)); + stretchCheckBox->SetSize(XMFLOAT2(hei, hei)); + stretchCheckBox->OnClick([=](wiEventArgs args) { + wiScene::GetScene().springs.GetComponent(entity)->SetStretchEnabled(args.bValue); + }); + window->AddWidget(stretchCheckBox); + + gravityCheckBox = new wiCheckBox("Gravity enabled: "); + gravityCheckBox->SetTooltip("Whether global gravity should affect the spring"); + gravityCheckBox->SetPos(XMFLOAT2(x, y += step)); + gravityCheckBox->SetSize(XMFLOAT2(hei, hei)); + gravityCheckBox->OnClick([=](wiEventArgs args) { + wiScene::GetScene().springs.GetComponent(entity)->SetGravityEnabled(args.bValue); + }); + window->AddWidget(gravityCheckBox); + + stiffnessSlider = new wiSlider(0, 1000, 100, 100000, "Stiffness: "); + stiffnessSlider->SetTooltip("The stiffness affects how strongly the spring tries to orient itself to rest pose (higher values increase the jiggliness)"); + stiffnessSlider->SetPos(XMFLOAT2(x, y += step)); + stiffnessSlider->SetSize(XMFLOAT2(siz, hei)); + stiffnessSlider->OnSlide([&](wiEventArgs args) { + wiScene::GetScene().springs.GetComponent(entity)->stiffness = args.fValue; + }); + window->AddWidget(stiffnessSlider); + + dampingSlider = new wiSlider(0, 1, 0.8f, 100000, "Damping: "); + dampingSlider->SetTooltip("The damping affects how fast energy is lost (higher values make the spring come to rest faster)"); + dampingSlider->SetPos(XMFLOAT2(x, y += step)); + dampingSlider->SetSize(XMFLOAT2(siz, hei)); + dampingSlider->OnSlide([&](wiEventArgs args) { + wiScene::GetScene().springs.GetComponent(entity)->damping = args.fValue; + }); + window->AddWidget(dampingSlider); + + windSlider = new wiSlider(0, 1, 0, 100000, "Wind affection: "); + windSlider->SetTooltip("How much the global wind effect affects the spring"); + windSlider->SetPos(XMFLOAT2(x, y += step)); + windSlider->SetSize(XMFLOAT2(siz, hei)); + windSlider->OnSlide([&](wiEventArgs args) { + wiScene::GetScene().springs.GetComponent(entity)->wind_affection = args.fValue; + }); + window->AddWidget(windSlider); + + window->Translate(XMFLOAT3((float)wiRenderer::GetDevice()->GetScreenWidth() - 700, 80, 0)); + window->SetVisible(false); + + SetEntity(INVALID_ENTITY); +} + + +SpringWindow::~SpringWindow() +{ + window->RemoveWidgets(true); + GUI->RemoveWidget(window); + delete window; +} + +void SpringWindow::SetEntity(Entity entity) +{ + this->entity = entity; + + const SpringComponent* spring = wiScene::GetScene().springs.GetComponent(entity); + + if (spring != nullptr) + { + window->SetEnabled(true); + + disabledCheckBox->SetCheck(spring->IsDisabled()); + stretchCheckBox->SetCheck(spring->IsStretchEnabled()); + gravityCheckBox->SetCheck(spring->IsGravityEnabled()); + stiffnessSlider->SetValue(spring->stiffness); + dampingSlider->SetValue(spring->damping); + windSlider->SetValue(spring->wind_affection); + } + else + { + window->SetEnabled(false); + } + + const TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity); + if (transform != nullptr) + { + createButton->SetEnabled(true); + + if (spring == nullptr) + { + createButton->SetText("Create"); + createButton->OnClick([=](wiEventArgs args) { + wiScene::GetScene().springs.Create(entity); + SetEntity(entity); + }); + } + else + { + createButton->SetText("Remove"); + createButton->OnClick([=](wiEventArgs args) { + wiScene::GetScene().springs.Remove_KeepSorted(entity); + SetEntity(entity); + }); + } + } + + debugCheckBox->SetEnabled(true); +} diff --git a/Editor/SpringWindow.h b/Editor/SpringWindow.h new file mode 100644 index 000000000..f456c260d --- /dev/null +++ b/Editor/SpringWindow.h @@ -0,0 +1,35 @@ +#pragma once + +class wiGUI; +class wiWindow; +class wiLabel; +class wiCheckBox; +class wiSlider; +class wiComboBox; +class wiColorPicker; + +class EditorComponent; + +class SpringWindow +{ +public: + SpringWindow(EditorComponent* editor); + ~SpringWindow(); + + wiECS::Entity entity; + void SetEntity(wiECS::Entity entity); + + wiGUI* GUI; + + wiWindow* window; + + wiButton* createButton; + wiCheckBox* debugCheckBox; + wiCheckBox* disabledCheckBox; + wiCheckBox* stretchCheckBox; + wiCheckBox* gravityCheckBox; + wiSlider* stiffnessSlider; + wiSlider* dampingSlider; + wiSlider* windSlider; +}; + diff --git a/Editor/TransformWindow.cpp b/Editor/TransformWindow.cpp new file mode 100644 index 000000000..4501c0c68 --- /dev/null +++ b/Editor/TransformWindow.cpp @@ -0,0 +1,242 @@ +#include "stdafx.h" +#include "TransformWindow.h" +#include "Editor.h" + +using namespace wiECS; +using namespace wiScene; + + +TransformWindow::TransformWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) +{ + assert(GUI && "Invalid GUI!"); + + window = new wiWindow(GUI, "Transform Window"); + window->SetSize(XMFLOAT2(460, 150)); + GUI->AddWidget(window); + + float x = 100; + float y = 0; + float step = 25; + float siz = 50; + float hei = 20; + + createButton = new wiButton("Create New Transform"); + createButton->SetTooltip("Create a new entity with only a trasform component"); + createButton->SetPos(XMFLOAT2(x, y += step)); + createButton->SetSize(XMFLOAT2(350, hei)); + createButton->OnClick([=](wiEventArgs args) { + Entity entity = CreateEntity(); + wiScene::GetScene().transforms.Create(entity); + editor->ClearSelected(); + editor->AddSelected(entity); + SetEntity(entity); + }); + window->AddWidget(createButton); + + txInput = new wiTextInputField(""); + txInput->SetValue(0); + txInput->SetDescription("Translation X: "); + txInput->SetPos(XMFLOAT2(x, y += step)); + txInput->SetSize(XMFLOAT2(siz, hei)); + txInput->OnInputAccepted([&](wiEventArgs args) { + TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity); + if (transform != nullptr) + { + transform->translation_local.x = args.fValue; + transform->SetDirty(); + } + }); + window->AddWidget(txInput); + + tyInput = new wiTextInputField(""); + tyInput->SetValue(0); + tyInput->SetDescription("Translation Y: "); + tyInput->SetPos(XMFLOAT2(x, y += step)); + tyInput->SetSize(XMFLOAT2(siz, hei)); + tyInput->OnInputAccepted([&](wiEventArgs args) { + TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity); + if (transform != nullptr) + { + transform->translation_local.y = args.fValue; + transform->SetDirty(); + } + }); + window->AddWidget(tyInput); + + tzInput = new wiTextInputField(""); + tzInput->SetValue(0); + tzInput->SetDescription("Translation Z: "); + tzInput->SetPos(XMFLOAT2(x, y += step)); + tzInput->SetSize(XMFLOAT2(siz, hei)); + tzInput->OnInputAccepted([&](wiEventArgs args) { + TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity); + if (transform != nullptr) + { + transform->translation_local.z = args.fValue; + transform->SetDirty(); + } + }); + window->AddWidget(tzInput); + + + + x = 250; + y = step; + + + rxInput = new wiTextInputField(""); + rxInput->SetValue(0); + rxInput->SetDescription("Rotation X: "); + rxInput->SetPos(XMFLOAT2(x, y += step)); + rxInput->SetSize(XMFLOAT2(siz, hei)); + rxInput->OnInputAccepted([&](wiEventArgs args) { + TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity); + if (transform != nullptr) + { + transform->rotation_local.x = args.fValue; + transform->SetDirty(); + } + }); + window->AddWidget(rxInput); + + ryInput = new wiTextInputField(""); + ryInput->SetValue(0); + ryInput->SetDescription("Rotation Y: "); + ryInput->SetPos(XMFLOAT2(x, y += step)); + ryInput->SetSize(XMFLOAT2(siz, hei)); + ryInput->OnInputAccepted([&](wiEventArgs args) { + TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity); + if (transform != nullptr) + { + transform->rotation_local.y = args.fValue; + transform->SetDirty(); + } + }); + window->AddWidget(ryInput); + + rzInput = new wiTextInputField(""); + rzInput->SetValue(0); + rzInput->SetDescription("Rotation Z: "); + rzInput->SetPos(XMFLOAT2(x, y += step)); + rzInput->SetSize(XMFLOAT2(siz, hei)); + rzInput->OnInputAccepted([&](wiEventArgs args) { + TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity); + if (transform != nullptr) + { + transform->rotation_local.z = args.fValue; + transform->SetDirty(); + } + }); + window->AddWidget(rzInput); + + rwInput = new wiTextInputField(""); + rwInput->SetValue(1); + rwInput->SetDescription("Rotation W: "); + rwInput->SetPos(XMFLOAT2(x, y += step)); + rwInput->SetSize(XMFLOAT2(siz, hei)); + rwInput->OnInputAccepted([&](wiEventArgs args) { + TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity); + if (transform != nullptr) + { + transform->rotation_local.w = args.fValue; + transform->SetDirty(); + } + }); + window->AddWidget(rwInput); + + + + + x = 400; + y = step; + + + sxInput = new wiTextInputField(""); + sxInput->SetValue(1); + sxInput->SetDescription("Scale X: "); + sxInput->SetPos(XMFLOAT2(x, y += step)); + sxInput->SetSize(XMFLOAT2(siz, hei)); + sxInput->OnInputAccepted([&](wiEventArgs args) { + TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity); + if (transform != nullptr) + { + transform->scale_local.x = args.fValue; + transform->SetDirty(); + } + }); + window->AddWidget(sxInput); + + syInput = new wiTextInputField(""); + syInput->SetValue(1); + syInput->SetDescription("Scale Y: "); + syInput->SetPos(XMFLOAT2(x, y += step)); + syInput->SetSize(XMFLOAT2(siz, hei)); + syInput->OnInputAccepted([&](wiEventArgs args) { + TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity); + if (transform != nullptr) + { + transform->scale_local.y = args.fValue; + transform->SetDirty(); + } + }); + window->AddWidget(syInput); + + szInput = new wiTextInputField(""); + szInput->SetValue(1); + szInput->SetDescription("Scale Z: "); + szInput->SetPos(XMFLOAT2(x, y += step)); + szInput->SetSize(XMFLOAT2(siz, hei)); + szInput->OnInputAccepted([&](wiEventArgs args) { + TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity); + if (transform != nullptr) + { + transform->scale_local.z = args.fValue; + transform->SetDirty(); + } + }); + window->AddWidget(szInput); + + window->Translate(XMFLOAT3((float)wiRenderer::GetDevice()->GetScreenWidth() - 750, 100, 0)); + window->SetVisible(false); + + SetEntity(INVALID_ENTITY); +} + + +TransformWindow::~TransformWindow() +{ + window->RemoveWidgets(true); + GUI->RemoveWidget(window); + delete window; +} + +void TransformWindow::SetEntity(Entity entity) +{ + this->entity = entity; + + const TransformComponent* transform = wiScene::GetScene().transforms.GetComponent(entity); + + if (transform != nullptr) + { + txInput->SetValue(transform->translation_local.x); + tyInput->SetValue(transform->translation_local.y); + tzInput->SetValue(transform->translation_local.z); + + rxInput->SetValue(transform->rotation_local.x); + ryInput->SetValue(transform->rotation_local.y); + rzInput->SetValue(transform->rotation_local.z); + rwInput->SetValue(transform->rotation_local.w); + + sxInput->SetValue(transform->scale_local.x); + syInput->SetValue(transform->scale_local.y); + szInput->SetValue(transform->scale_local.z); + + window->SetEnabled(true); + } + else + { + window->SetEnabled(false); + } + + createButton->SetEnabled(true); +} diff --git a/Editor/TransformWindow.h b/Editor/TransformWindow.h new file mode 100644 index 000000000..6b5aea7ca --- /dev/null +++ b/Editor/TransformWindow.h @@ -0,0 +1,42 @@ +#pragma once + +class wiGUI; +class wiWindow; +class wiLabel; +class wiCheckBox; +class wiSlider; +class wiComboBox; +class wiColorPicker; +class wiTextInputField; + +class EditorComponent; + +class TransformWindow +{ +public: + TransformWindow(EditorComponent* editor); + ~TransformWindow(); + + wiECS::Entity entity; + void SetEntity(wiECS::Entity entity); + + wiGUI* GUI; + + wiWindow* window; + + wiButton* createButton; + + wiTextInputField* txInput; + wiTextInputField* tyInput; + wiTextInputField* tzInput; + + wiTextInputField* rxInput; + wiTextInputField* ryInput; + wiTextInputField* rzInput; + wiTextInputField* rwInput; + + wiTextInputField* sxInput; + wiTextInputField* syInput; + wiTextInputField* szInput; +}; + diff --git a/Editor/WeatherWindow.cpp b/Editor/WeatherWindow.cpp index 82abb3228..7d1a97d8d 100644 --- a/Editor/WeatherWindow.cpp +++ b/Editor/WeatherWindow.cpp @@ -1,5 +1,6 @@ #include "stdafx.h" #include "WeatherWindow.h" +#include "Editor.h" #include @@ -8,7 +9,7 @@ using namespace wiECS; using namespace wiScene; using namespace wiGraphics; -WeatherWindow::WeatherWindow(wiGUI* gui) : GUI(gui) +WeatherWindow::WeatherWindow(EditorComponent* editor) : GUI(&editor->GetGUI()) { assert(GUI && "Invalid GUI!"); @@ -508,7 +509,7 @@ void WeatherWindow::Update() ambientColorPicker->SetPickColor(wiColor::fromFloat3(weather.ambient)); horizonColorPicker->SetPickColor(wiColor::fromFloat3(weather.horizon)); zenithColorPicker->SetPickColor(wiColor::fromFloat3(weather.zenith)); - + simpleskyCheckBox->SetCheck(weather.IsSimpleSky()); ocean_enabledCheckBox->SetCheck(weather.IsOceanEnabled()); ocean_patchSizeSlider->SetValue(weather.oceanParameters.patch_length); diff --git a/Editor/WeatherWindow.h b/Editor/WeatherWindow.h index 0b949891a..93fbff041 100644 --- a/Editor/WeatherWindow.h +++ b/Editor/WeatherWindow.h @@ -8,11 +8,13 @@ class wiSlider; class wiColorPicker; class wiButton; +class EditorComponent; + class WeatherWindow { void UpdateWind(); public: - WeatherWindow(wiGUI* gui); + WeatherWindow(EditorComponent* editor); ~WeatherWindow(); void Update(); diff --git a/Editor/startup.lua b/Editor/startup.lua index eef2dba68..beebdf49f 100644 --- a/Editor/startup.lua +++ b/Editor/startup.lua @@ -1 +1 @@ -SetProfilerEnabled(true) \ No newline at end of file +SetProfilerEnabled(false) \ No newline at end of file diff --git a/WickedEngine/wiGUI.cpp b/WickedEngine/wiGUI.cpp index c357e95b6..41cdfb097 100644 --- a/WickedEngine/wiGUI.cpp +++ b/WickedEngine/wiGUI.cpp @@ -116,8 +116,11 @@ void wiGUI::Update(float dt) for (auto& widget : priorityChangeQueue) { - widgets.remove(widget); - widgets.push_front(widget); + if (std::find(widgets.begin(), widgets.end(), widget) != widgets.end()) + { + widgets.remove(widget); + widgets.push_front(widget); + } } priorityChangeQueue.clear(); diff --git a/WickedEngine/wiProfiler.cpp b/WickedEngine/wiProfiler.cpp index 881c421a0..05d6a2bf6 100644 --- a/WickedEngine/wiProfiler.cpp +++ b/WickedEngine/wiProfiler.cpp @@ -2,7 +2,9 @@ #include "wiGraphicsDevice.h" #include "wiRenderer.h" #include "wiFont.h" +#include "wiImage.h" #include "wiTimer.h" +#include "wiTextureHelper.h" #include #include @@ -223,12 +225,34 @@ namespace wiProfiler } } - wiFont(ss.str(), wiFontParams(x, y, WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_TOP, 0, 0, wiColor(255, 255, 255, 255), wiColor(0, 0, 0, 255))).Draw(cmd); + wiFont font; + font.SetText(ss.str()); + font.params = wiFontParams(x, y, WIFONTSIZE_DEFAULT, WIFALIGN_LEFT, WIFALIGN_TOP, 0, 0, wiColor(255, 255, 255, 255), wiColor(0, 0, 0, 255)); + + wiImageParams fx; + fx.pos.x = (float)font.params.posX; + fx.pos.y = (float)font.params.posY; + fx.siz.x = (float)font.textWidth(); + fx.siz.y = (float)font.textHeight(); + fx.color = wiColor(40, 40, 40, 140); + wiImage::Draw(wiTextureHelper::getWhite(), fx, cmd); + + font.Draw(cmd); } void SetEnabled(bool value) { - ENABLED = value; + if (value != ENABLED) + { + initialized = false; + ranges.clear(); + ENABLED = value; + } + } + + bool IsEnabled() + { + return ENABLED; } } diff --git a/WickedEngine/wiProfiler.h b/WickedEngine/wiProfiler.h index 38ec2f240..79412edf2 100644 --- a/WickedEngine/wiProfiler.h +++ b/WickedEngine/wiProfiler.h @@ -28,5 +28,7 @@ namespace wiProfiler // Enable/disable profiling void SetEnabled(bool value); + + bool IsEnabled(); }; diff --git a/WickedEngine/wiScene.cpp b/WickedEngine/wiScene.cpp index 84a64ca88..a4d59bebd 100644 --- a/WickedEngine/wiScene.cpp +++ b/WickedEngine/wiScene.cpp @@ -1907,7 +1907,6 @@ namespace wiScene const HierarchyComponent* hier = hierarchy.GetComponent(entity); if (transform == nullptr || target == nullptr || hier == nullptr) { - assert(0); // without any of the above, the IK simulation doesn't make sense continue; } diff --git a/WickedEngine/wiVersion.cpp b/WickedEngine/wiVersion.cpp index e99845843..ce202bb96 100644 --- a/WickedEngine/wiVersion.cpp +++ b/WickedEngine/wiVersion.cpp @@ -9,7 +9,7 @@ namespace wiVersion // minor features, major updates const int minor = 39; // minor bug fixes, alterations, refactors, updates - const int revision = 61; + const int revision = 62; long GetVersion() diff --git a/WickedEngine/wiWidget.cpp b/WickedEngine/wiWidget.cpp index fbfe378b3..e1da98594 100644 --- a/WickedEngine/wiWidget.cpp +++ b/WickedEngine/wiWidget.cpp @@ -1146,7 +1146,6 @@ void wiComboBox::Update(wiGUI* gui, float dt) } } - font.params.posX = (int)translation.x + 2; font.params.posY = (int)(translation.y + sprites[state].params.siz.y * 0.5f); } void wiComboBox::Render(const wiGUI* gui, CommandList cmd) const @@ -1401,6 +1400,7 @@ wiWindow::wiWindow(wiGUI* gui, const std::string& name, bool window_controls) : scaleDiff.y = (scale.y - args.deltaPos.y) / scale.y; this->Translate(XMFLOAT3(args.deltaPos.x, args.deltaPos.y, 0)); this->Scale(XMFLOAT3(scaleDiff.x, scaleDiff.y, 1)); + this->scale_local = wiMath::Max(this->scale_local, XMFLOAT3(40, 40, 1)); // don't allow resize to negative or too small this->wiWidget::Update(gui, 0); for (auto& x : this->childrenWidgets) { @@ -1420,6 +1420,7 @@ wiWindow::wiWindow(wiGUI* gui, const std::string& name, bool window_controls) : scaleDiff.x = (scale.x + args.deltaPos.x) / scale.x; scaleDiff.y = (scale.y + args.deltaPos.y) / scale.y; this->Scale(XMFLOAT3(scaleDiff.x, scaleDiff.y, 1)); + this->scale_local = wiMath::Max(this->scale_local, XMFLOAT3(40, 40, 1)); // don't allow resize to negative or too small this->wiWidget::Update(gui, 0); for (auto& x : this->childrenWidgets) { @@ -1682,6 +1683,8 @@ void wiWindow::SetEnabled(bool value) continue; if (x == resizeDragger_UpperLeft) continue; + if (x == resizeDragger_BottomRight) + continue; x->SetEnabled(value); } }