diff --git a/CHANGELOG.txt b/CHANGELOG.txt new file mode 100644 index 00000000..e69de29b diff --git a/GUIManager.cpp b/GUIManager.cpp index ba821bbd..09e3102b 100644 --- a/GUIManager.cpp +++ b/GUIManager.cpp @@ -399,6 +399,12 @@ namespace ed std::string oldFile = m_data->Parser.GetOpenedFile(); if (m_selectedTemplate == "?empty") { + strcpy(Settings::Instance().Project.GLSLVS_Extenstion, "vert"); + strcpy(Settings::Instance().Project.GLSLPS_Extenstion, "frag"); + strcpy(Settings::Instance().Project.GLSLGS_Extenstion, "geom"); + Settings::Instance().Project.FPCamera = false; + Settings::Instance().Project.ClearColor = ml::Color(0, 0, 0, 0); + m_data->Renderer.FlushCache(); ((CodeEditorUI*)Get(ViewID::Code))->CloseAll(); ((PinnedUI*)Get(ViewID::Pinned))->CloseAll(); diff --git a/Objects/ProjectParser.cpp b/Objects/ProjectParser.cpp index c6e1a382..8aea3929 100644 --- a/Objects/ProjectParser.cpp +++ b/Objects/ProjectParser.cpp @@ -50,6 +50,7 @@ namespace ed strcpy(Settings::Instance().Project.GLSLPS_Extenstion, "frag"); strcpy(Settings::Instance().Project.GLSLGS_Extenstion, "geom"); Settings::Instance().Project.FPCamera = false; + Settings::Instance().Project.ClearColor = ml::Color(0, 0, 0, 0); // shader passes for (pugi::xml_node passNode : doc.child("project").child("pipeline").children("pass")) { @@ -641,6 +642,16 @@ namespace ed if (stage == "geometry") strcpy(Settings::Instance().Project.GLSLGS_Extenstion, settingItem.text().get()); } + else if (type == "clearcolor") { + if (!settingItem.attribute("r").empty()) + Settings::Instance().Project.ClearColor.R = settingItem.attribute("r").as_uint(); + if (!settingItem.attribute("g").empty()) + Settings::Instance().Project.ClearColor.G = settingItem.attribute("g").as_uint(); + if (!settingItem.attribute("b").empty()) + Settings::Instance().Project.ClearColor.B = settingItem.attribute("b").as_uint(); + if (!settingItem.attribute("a").empty()) + Settings::Instance().Project.ClearColor.A = settingItem.attribute("a").as_uint(); + } } } } @@ -1064,6 +1075,16 @@ namespace ed extNodeGS.append_attribute("stage").set_value("geometry"); extNodeGS.text().set(Settings::Instance().Project.GLSLGS_Extenstion); } + + // clear color + { + pugi::xml_node colorNode = settingsNode.append_child("entry"); + colorNode.append_attribute("type").set_value("clearcolor"); + colorNode.append_attribute("r").set_value(Settings::Instance().Project.ClearColor.R); + colorNode.append_attribute("g").set_value(Settings::Instance().Project.ClearColor.G); + colorNode.append_attribute("b").set_value(Settings::Instance().Project.ClearColor.B); + colorNode.append_attribute("a").set_value(Settings::Instance().Project.ClearColor.A); + } } doc.save_file(file.c_str()); diff --git a/Objects/RenderEngine.cpp b/Objects/RenderEngine.cpp index 9a4bde70..c206211d 100644 --- a/Objects/RenderEngine.cpp +++ b/Objects/RenderEngine.cpp @@ -46,8 +46,11 @@ namespace ed } // clear main rt only once + ml::Color oldWndClrColor = m_wnd->GetClearColor(); + m_wnd->SetClearColor(Settings::Instance().Project.ClearColor); m_rt.Clear(); m_rt.ClearDepthStencil(1.0f, 0); + m_wnd->SetClearColor(oldWndClrColor); // bind default sampler state m_sampler.BindVS(0); diff --git a/Objects/Settings.h b/Objects/Settings.h index ff9e45e9..e40360cb 100644 --- a/Objects/Settings.h +++ b/Objects/Settings.h @@ -1,6 +1,7 @@ #pragma once #include #include +#include namespace ed { @@ -55,6 +56,7 @@ namespace ed char GLSLVS_Extenstion[12]; char GLSLPS_Extenstion[12]; char GLSLGS_Extenstion[12]; + ml::Color ClearColor; } Project; static inline Settings& Instance() diff --git a/README.md b/README.md index 15a5a025..9602c21d 100644 --- a/README.md +++ b/README.md @@ -145,7 +145,7 @@ so please submit your own themes! Want to create your own theme but don't know how? Visit [TUTORIAL.md](./TUTORIAL.md). -### Custom template +### Custom templates You can create your own custom templates. SHADERed comes with a GLSL, HLSL and HLSL deferred rendering template. Templates help you start with an already built base for your new project. To create your own project template, paste your project directory in /templates directory and name your project file `template.sprj`. You have to reopen SHADERed if it was diff --git a/SHADERed.vcxproj b/SHADERed.vcxproj index c02a664f..5acd6623 100644 --- a/SHADERed.vcxproj +++ b/SHADERed.vcxproj @@ -267,6 +267,9 @@ + + + diff --git a/UI/OptionsUI.cpp b/UI/OptionsUI.cpp index 861037fd..3d18ad92 100644 --- a/UI/OptionsUI.cpp +++ b/UI/OptionsUI.cpp @@ -429,5 +429,15 @@ namespace ed ImGui::Text("First person camera: "); ImGui::SameLine(); ImGui::Checkbox("##optpr_fpcamera", &settings->Project.FPCamera); + + /* CLEAR COLOR: */ + ImVec4 clearColor(settings->Project.ClearColor.R / 255.0f, settings->Project.ClearColor.G / 255.0f, settings->Project.ClearColor.B / 255.0f, settings->Project.ClearColor.A / 255.0f); + ImGui::Text("Preview window clear color: "); + ImGui::SameLine(); + ImGui::ColorEdit4("##optpr_clrclr", (float*)&clearColor); + settings->Project.ClearColor.R = clearColor.x * 255; + settings->Project.ClearColor.G = clearColor.y * 255; + settings->Project.ClearColor.B = clearColor.z * 255; + settings->Project.ClearColor.A = clearColor.w * 255; } } \ No newline at end of file diff --git a/settings.ini b/settings.ini index dad57f5d..1241c282 100644 --- a/settings.ini +++ b/settings.ini @@ -1,5 +1,5 @@ [general] -theme=Dark +theme=Light vsync=0 autoerror=1 recovery=0 diff --git a/workspace.dat b/workspace.dat index a7a65eaf..604d61d0 100644 --- a/workspace.dat +++ b/workspace.dat @@ -39,14 +39,14 @@ Collapsed=0 DockId=0x00000003,0 [Window][###code_viewPS0] -Pos=17,27 -Size=6,5 +Pos=17,28 +Size=6,4 Collapsed=0 DockId=0x00000008,0 [Window][###code_viewVS0] Pos=17,19 -Size=6,6 +Size=6,7 Collapsed=0 DockId=0x00000007,0 @@ -57,7 +57,8 @@ Collapsed=0 DockId=0x00000004,0 [Window][Options] -Pos=326,160 +ViewportPos=332,17 +ViewportId=0x1F88C31B Size=857,594 Collapsed=0 @@ -122,8 +123,8 @@ DockSpace ID=0x160B189F Pos=0,19 Size=32,13 Split=X DockNode ID=0x00000004 Parent=0x00000001 SizeRef=257,527 SelectedTab=0xC89E3217 DockNode ID=0x00000002 Parent=0x160B189F SizeRef=1665,998 Split=X DockNode ID=0x00000005 Parent=0x00000002 SizeRef=710,998 Split=Y SelectedTab=0xF7C3C717 - DockNode ID=0x00000007 Parent=0x00000005 SizeRef=399,538 SelectedTab=0xF7C3C717 - DockNode ID=0x00000008 Parent=0x00000005 SizeRef=399,458 SelectedTab=0xF34EBBA5 + DockNode ID=0x00000007 Parent=0x00000005 SizeRef=399,596 SelectedTab=0xF7C3C717 + DockNode ID=0x00000008 Parent=0x00000005 SizeRef=399,400 SelectedTab=0xF34EBBA5 DockNode ID=0x00000006 Parent=0x00000002 SizeRef=953,998 Split=Y SelectedTab=0x763816AC DockNode ID=0x00000009 Parent=0x00000006 SizeRef=953,884 CentralNode=1 SelectedTab=0x763816AC DockNode ID=0x0000000A Parent=0x00000006 SizeRef=953,112 SelectedTab=0xCB7211A8