From 5819feb426c49b44aa809be08812da10d7044584 Mon Sep 17 00:00:00 2001 From: turanszkij Date: Wed, 20 Dec 2017 23:45:45 +0100 Subject: [PATCH] editor updates --- Editor/Editor.cpp | 102 +++-------------------------------- Editor/PostprocessWindow.cpp | 50 +++++++++++++++++ Editor/PostprocessWindow.h | 2 + Editor/WorldWindow.cpp | 52 +++++++++++++++++- Editor/WorldWindow.h | 1 + 5 files changed, 111 insertions(+), 96 deletions(-) diff --git a/Editor/Editor.cpp b/Editor/Editor.cpp index 98a38611d..f4cca5a21 100644 --- a/Editor/Editor.cpp +++ b/Editor/Editor.cpp @@ -326,7 +326,7 @@ void EditorComponent::Load() wiComboBox* renderPathComboBox = new wiComboBox("Render Path: "); renderPathComboBox->SetSize(XMFLOAT2(100, 20)); - renderPathComboBox->SetPos(XMFLOAT2(screenW - 55 - 940, 0)); + renderPathComboBox->SetPos(XMFLOAT2(screenW - 55 - 860, 0)); renderPathComboBox->AddItem("Forward"); renderPathComboBox->AddItem("Deferred"); renderPathComboBox->AddItem("Tiled Forward"); @@ -489,7 +489,7 @@ void EditorComponent::Load() wiCheckBox* translatorCheckBox = new wiCheckBox("Translator: "); translatorCheckBox->SetTooltip("Enable the translator tool"); - translatorCheckBox->SetPos(XMFLOAT2(screenW - 50 - 55 - 105 * 6 - 25, 0)); + translatorCheckBox->SetPos(XMFLOAT2(screenW - 50 - 55 - 105 * 5 - 25, 0)); translatorCheckBox->SetSize(XMFLOAT2(18, 18)); translatorCheckBox->OnClick([=](wiEventArgs args) { if(!args.bValue) @@ -503,7 +503,7 @@ void EditorComponent::Load() wiCheckBox* isTranslatorCheckBox = new wiCheckBox("T:"); { isScalatorCheckBox->SetTooltip("Scale"); - isScalatorCheckBox->SetPos(XMFLOAT2(screenW - 50 - 55 - 105 * 6 - 25 - 40 * 2, 22)); + isScalatorCheckBox->SetPos(XMFLOAT2(screenW - 50 - 55 - 105 * 5 - 25 - 40 * 2, 22)); isScalatorCheckBox->SetSize(XMFLOAT2(18, 18)); isScalatorCheckBox->OnClick([=](wiEventArgs args) { translator->isScalator = args.bValue; @@ -516,7 +516,7 @@ void EditorComponent::Load() GetGUI().AddWidget(isScalatorCheckBox); isRotatorCheckBox->SetTooltip("Rotate"); - isRotatorCheckBox->SetPos(XMFLOAT2(screenW - 50 - 55 - 105 * 6 - 25 - 40 * 1, 22)); + isRotatorCheckBox->SetPos(XMFLOAT2(screenW - 50 - 55 - 105 * 5 - 25 - 40 * 1, 22)); isRotatorCheckBox->SetSize(XMFLOAT2(18, 18)); isRotatorCheckBox->OnClick([=](wiEventArgs args) { translator->isRotator = args.bValue; @@ -529,7 +529,7 @@ void EditorComponent::Load() GetGUI().AddWidget(isRotatorCheckBox); isTranslatorCheckBox->SetTooltip("Translate"); - isTranslatorCheckBox->SetPos(XMFLOAT2(screenW - 50 - 55 - 105 * 6 - 25, 22)); + isTranslatorCheckBox->SetPos(XMFLOAT2(screenW - 50 - 55 - 105 * 5 - 25, 22)); isTranslatorCheckBox->SetSize(XMFLOAT2(18, 18)); isTranslatorCheckBox->OnClick([=](wiEventArgs args) { translator->isTranslator = args.bValue; @@ -545,7 +545,7 @@ void EditorComponent::Load() wiButton* saveButton = new wiButton("Save"); saveButton->SetTooltip("Save the current scene as a model"); - saveButton->SetPos(XMFLOAT2(screenW - 50 - 55 - 105 * 6, 0)); + saveButton->SetPos(XMFLOAT2(screenW - 50 - 55 - 105 * 5, 0)); saveButton->SetSize(XMFLOAT2(100, 40)); saveButton->SetColor(wiColor(0, 198, 101, 200), wiWidget::WIDGETSTATE::IDLE); saveButton->SetColor(wiColor(0, 255, 140, 255), wiWidget::WIDGETSTATE::FOCUS); @@ -613,7 +613,7 @@ void EditorComponent::Load() wiButton* modelButton = new wiButton("Load Model"); modelButton->SetTooltip("Load a model into the editor..."); - modelButton->SetPos(XMFLOAT2(screenW - 50 - 55 - 105 * 5, 0)); + modelButton->SetPos(XMFLOAT2(screenW - 50 - 55 - 105 * 4, 0)); modelButton->SetSize(XMFLOAT2(100, 40)); modelButton->SetColor(wiColor(0, 89, 255, 200), wiWidget::WIDGETSTATE::IDLE); modelButton->SetColor(wiColor(112, 155, 255, 255), wiWidget::WIDGETSTATE::FOCUS); @@ -665,94 +665,6 @@ void EditorComponent::Load() GetGUI().AddWidget(modelButton); - wiButton* skyButton = new wiButton("Load Sky"); - skyButton->SetTooltip("Load a skybox cubemap texture..."); - skyButton->SetPos(XMFLOAT2(screenW - 50 - 55 - 105 * 4, 0)); - skyButton->SetSize(XMFLOAT2(100, 18)); - skyButton->SetColor(wiColor(0, 89, 255, 200), wiWidget::WIDGETSTATE::IDLE); - skyButton->SetColor(wiColor(112, 155, 255, 255), wiWidget::WIDGETSTATE::FOCUS); - skyButton->OnClick([=](wiEventArgs args) { - auto x = wiRenderer::GetEnviromentMap(); - - if (x == nullptr) - { - thread([&] { - char szFile[260]; - - OPENFILENAMEA ofn; - ZeroMemory(&ofn, sizeof(ofn)); - ofn.lStructSize = sizeof(ofn); - ofn.hwndOwner = nullptr; - ofn.lpstrFile = szFile; - // Set lpstrFile[0] to '\0' so that GetOpenFileName does not - // use the contents of szFile to initialize itself. - ofn.lpstrFile[0] = '\0'; - ofn.nMaxFile = sizeof(szFile); - ofn.lpstrFilter = "Cubemap texture\0*.dds\0"; - ofn.nFilterIndex = 1; - ofn.lpstrFileTitle = NULL; - ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = NULL; - ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; - if (GetOpenFileNameA(&ofn) == TRUE) { - string fileName = ofn.lpstrFile; - wiRenderer::SetEnviromentMap((Texture2D*)Content.add(fileName)); - } - }).detach(); - } - else - { - wiRenderer::SetEnviromentMap(nullptr); - } - - }); - GetGUI().AddWidget(skyButton); - - - wiButton* colorGradingButton = new wiButton("Color Grading"); - colorGradingButton->SetTooltip("Load a color grading lookup texture..."); - colorGradingButton->SetPos(XMFLOAT2(screenW - 50 - 55 - 105 * 4, 22)); - colorGradingButton->SetSize(XMFLOAT2(100, 18)); - colorGradingButton->SetColor(wiColor(0, 89, 255, 200), wiWidget::WIDGETSTATE::IDLE); - colorGradingButton->SetColor(wiColor(112, 155, 255, 255), wiWidget::WIDGETSTATE::FOCUS); - colorGradingButton->OnClick([=](wiEventArgs args) { - auto x = wiRenderer::GetColorGrading(); - - if (x == nullptr) - { - thread([&] { - char szFile[260]; - - OPENFILENAMEA ofn; - ZeroMemory(&ofn, sizeof(ofn)); - ofn.lStructSize = sizeof(ofn); - ofn.hwndOwner = nullptr; - ofn.lpstrFile = szFile; - // Set lpstrFile[0] to '\0' so that GetOpenFileName does not - // use the contents of szFile to initialize itself. - ofn.lpstrFile[0] = '\0'; - ofn.nMaxFile = sizeof(szFile); - ofn.lpstrFilter = "Color Grading texture\0*.dds;*.png\0"; - ofn.nFilterIndex = 1; - ofn.lpstrFileTitle = NULL; - ofn.nMaxFileTitle = 0; - ofn.lpstrInitialDir = NULL; - ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; - if (GetOpenFileNameA(&ofn) == TRUE) { - string fileName = ofn.lpstrFile; - wiRenderer::SetColorGrading((Texture2D*)Content.add(fileName)); - } - }).detach(); - } - else - { - wiRenderer::SetColorGrading(nullptr); - } - - }); - GetGUI().AddWidget(colorGradingButton); - - wiButton* scriptButton = new wiButton("Load Script"); scriptButton->SetTooltip("Load a Lua script..."); scriptButton->SetPos(XMFLOAT2(screenW - 50 - 55 - 105 * 3, 0)); diff --git a/Editor/PostprocessWindow.cpp b/Editor/PostprocessWindow.cpp index ee53c49ce..60f82b134 100644 --- a/Editor/PostprocessWindow.cpp +++ b/Editor/PostprocessWindow.cpp @@ -1,6 +1,13 @@ #include "stdafx.h" #include "PostprocessWindow.h" +#include +#include // openfile +#include + +using namespace std; +using namespace wiGraphicsTypes; + PostprocessWindow::PostprocessWindow(wiGUI* gui, Renderable3DComponent* comp) : GUI(gui), component(comp) { @@ -148,6 +155,49 @@ PostprocessWindow::PostprocessWindow(wiGUI* gui, Renderable3DComponent* comp) : }); ppWindow->AddWidget(colorGradingCheckBox); + colorGradingButton = new wiButton("Load Color Grading LUT..."); + colorGradingButton->SetTooltip("Load a color grading lookup texture..."); + colorGradingButton->SetPos(XMFLOAT2(x + 35, y)); + colorGradingButton->SetSize(XMFLOAT2(200, 18)); + colorGradingButton->OnClick([=](wiEventArgs args) { + auto x = wiRenderer::GetColorGrading(); + + if (x == nullptr) + { + thread([&] { + char szFile[260]; + + OPENFILENAMEA ofn; + ZeroMemory(&ofn, sizeof(ofn)); + ofn.lStructSize = sizeof(ofn); + ofn.hwndOwner = nullptr; + ofn.lpstrFile = szFile; + // Set lpstrFile[0] to '\0' so that GetOpenFileName does not + // use the contents of szFile to initialize itself. + ofn.lpstrFile[0] = '\0'; + ofn.nMaxFile = sizeof(szFile); + ofn.lpstrFilter = "Color Grading texture\0*.dds;*.png\0"; + ofn.nFilterIndex = 1; + ofn.lpstrFileTitle = NULL; + ofn.nMaxFileTitle = 0; + ofn.lpstrInitialDir = NULL; + ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; + if (GetOpenFileNameA(&ofn) == TRUE) { + string fileName = ofn.lpstrFile; + wiRenderer::SetColorGrading((Texture2D*)wiResourceManager::GetGlobal()->add(fileName)); + colorGradingButton->SetText(fileName); + } + }).detach(); + } + else + { + wiRenderer::SetColorGrading(nullptr); + colorGradingButton->SetText("Load Color Grading LUT..."); + } + + }); + ppWindow->AddWidget(colorGradingButton); + stereogramCheckBox = new wiCheckBox("Stereogram: "); stereogramCheckBox->SetTooltip("Compute a stereogram from the depth buffer. It produces a 3D sihouette image when viewed cross eyed."); stereogramCheckBox->SetScriptTip("Renderable3DComponent::SetStereogramEnabled(bool value)"); diff --git a/Editor/PostprocessWindow.h b/Editor/PostprocessWindow.h index b6e6954df..54e84e8ad 100644 --- a/Editor/PostprocessWindow.h +++ b/Editor/PostprocessWindow.h @@ -7,6 +7,7 @@ class wiWindow; class wiLabel; class wiCheckBox; class wiSlider; +class wiButton; class PostprocessWindow { @@ -32,6 +33,7 @@ public: wiCheckBox* fxaaCheckBox; wiCheckBox* stereogramCheckBox; wiCheckBox* colorGradingCheckBox; + wiButton* colorGradingButton; wiCheckBox* sharpenFilterCheckBox; wiSlider* sharpenFilterAmountSlider; diff --git a/Editor/WorldWindow.cpp b/Editor/WorldWindow.cpp index 80aafcbac..92b32928c 100644 --- a/Editor/WorldWindow.cpp +++ b/Editor/WorldWindow.cpp @@ -1,6 +1,12 @@ #include "stdafx.h" #include "WorldWindow.h" +#include +#include // openfile +#include + +using namespace std; +using namespace wiGraphicsTypes; WorldWindow::WorldWindow(wiGUI* gui) : GUI(gui) { @@ -16,7 +22,7 @@ WorldWindow::WorldWindow(wiGUI* gui) : GUI(gui) float x = 200; float y = 20; - float step = 30; + float step = 32; fogStartSlider = new wiSlider(0, 5000, 0, 100000, "Fog Start: "); fogStartSlider->SetSize(XMFLOAT2(100, 30)); @@ -43,6 +49,50 @@ WorldWindow::WorldWindow(wiGUI* gui) : GUI(gui) worldWindow->AddWidget(fogHeightSlider); + skyButton = new wiButton("Load Sky"); + skyButton->SetTooltip("Load a skybox cubemap texture..."); + skyButton->SetSize(XMFLOAT2(240, 30)); + skyButton->SetPos(XMFLOAT2(x-100, y += step)); + skyButton->OnClick([=](wiEventArgs args) { + auto x = wiRenderer::GetEnviromentMap(); + + if (x == nullptr) + { + thread([&] { + char szFile[260]; + + OPENFILENAMEA ofn; + ZeroMemory(&ofn, sizeof(ofn)); + ofn.lStructSize = sizeof(ofn); + ofn.hwndOwner = nullptr; + ofn.lpstrFile = szFile; + // Set lpstrFile[0] to '\0' so that GetOpenFileName does not + // use the contents of szFile to initialize itself. + ofn.lpstrFile[0] = '\0'; + ofn.nMaxFile = sizeof(szFile); + ofn.lpstrFilter = "Cubemap texture\0*.dds\0"; + ofn.nFilterIndex = 1; + ofn.lpstrFileTitle = NULL; + ofn.nMaxFileTitle = 0; + ofn.lpstrInitialDir = NULL; + ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST; + if (GetOpenFileNameA(&ofn) == TRUE) { + string fileName = ofn.lpstrFile; + wiRenderer::SetEnviromentMap((Texture2D*)wiResourceManager::GetGlobal()->add(fileName)); + skyButton->SetText(fileName); + } + }).detach(); + } + else + { + wiRenderer::SetEnviromentMap(nullptr); + skyButton->SetText("Load Sky"); + } + + }); + worldWindow->AddWidget(skyButton); + + diff --git a/Editor/WorldWindow.h b/Editor/WorldWindow.h index 7996aa5e7..94371c75e 100644 --- a/Editor/WorldWindow.h +++ b/Editor/WorldWindow.h @@ -22,6 +22,7 @@ public: wiSlider* fogStartSlider; wiSlider* fogEndSlider; wiSlider* fogHeightSlider; + wiButton* skyButton; wiColorPicker* ambientColorPicker; wiColorPicker* horizonColorPicker; wiColorPicker* zenithColorPicker;