Material Thumbnail, PostFX, more

big commit
+ Depth of field
+ Barrel distortion
+ Vignette
+ Material thumbnail in filebrowser
+ Fullbright wad conversion turns into emissive
This commit is contained in:
Antoine Pilote
2023-09-25 02:21:22 -04:00
parent 513bf6aa0e
commit d843d54388
25 changed files with 2495 additions and 50 deletions

View File

@@ -682,8 +682,13 @@ namespace Nuake {
ImGui::TableNextColumn();
int iteration = env->mBloom->GetIteration();
int oldIteration = iteration;
ImGui::DragInt("##quality", &iteration, 1.0f, 0, 4);
env->mBloom->SetIteration(iteration);
if (oldIteration != iteration)
{
env->mBloom->SetIteration(iteration);
}
ImGui::TableNextColumn();
// Reset button
@@ -1046,6 +1051,164 @@ namespace Nuake {
ImGui::EndTable();
}
END_COLLAPSE_HEADER()
BEGIN_COLLAPSE_HEADER(DOF)
if (ImGui::BeginTable("EnvTable", 3, ImGuiTableFlags_BordersInner | ImGuiTableFlags_SizingStretchProp))
{
ImGui::TableSetupColumn("name", 0, 0.3);
ImGui::TableSetupColumn("set", 0, 0.6);
ImGui::TableSetupColumn("reset", 0, 0.1);
{
ImGui::TableNextColumn();
// Title
ImGui::Text("DOF Enabled");
ImGui::TableNextColumn();
ImGui::Checkbox("##dofEnabled", &env->DOFEnabled);
ImGui::TableNextColumn();
// Reset button
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1, 1, 1, 0));
std::string resetSSR = ICON_FA_UNDO + std::string("##resetrBarrelDistortionEnabled");
if (ImGui::Button(resetSSR.c_str())) env->DOFEnabled = false;
ImGui::PopStyleColor();
}
ImGui::EndTable();
}
END_COLLAPSE_HEADER()
BEGIN_COLLAPSE_HEADER(BARREL_DISTORTION)
if (ImGui::BeginTable("EnvTable", 3, ImGuiTableFlags_BordersInner | ImGuiTableFlags_SizingStretchProp))
{
ImGui::TableSetupColumn("name", 0, 0.3);
ImGui::TableSetupColumn("set", 0, 0.6);
ImGui::TableSetupColumn("reset", 0, 0.1);
{
ImGui::TableNextColumn();
// Title
ImGui::Text("Barrel Distortion");
ImGui::TableNextColumn();
ImGui::Checkbox("##BarrelEnabled", &env->BarrelDistortionEnabled);
ImGui::TableNextColumn();
// Reset button
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1, 1, 1, 0));
std::string resetSSR = ICON_FA_UNDO + std::string("##resetrBarrelDistortionEnabled");
if (ImGui::Button(resetSSR.c_str())) env->BarrelDistortionEnabled = false;
ImGui::PopStyleColor();
}
{
ImGui::TableNextColumn();
// Title
ImGui::Text("Distortion");
ImGui::TableNextColumn();
ImGui::DragFloat("##distortion", &env->BarrelDistortion, 0.01f);
ImGui::TableNextColumn();
// Reset button
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1, 1, 1, 0));
std::string resetVolumetric = ICON_FA_UNDO + std::string("##resetVolumetric");
if (ImGui::Button(resetVolumetric.c_str())) env->BarrelDistortion = 0.0f;
ImGui::PopStyleColor();
}
{
ImGui::TableNextColumn();
// Title
ImGui::Text("Edge Distortion");
ImGui::TableNextColumn();
ImGui::DragFloat("##edgedistortion", &env->BarrelEdgeDistortion, 0.01f);
ImGui::TableNextColumn();
// Reset button
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1, 1, 1, 0));
std::string resetVolumetric = ICON_FA_UNDO + std::string("##resetVolumetric");
if (ImGui::Button(resetVolumetric.c_str())) env->BarrelEdgeDistortion = 0.0f;
ImGui::PopStyleColor();
}
{
ImGui::TableNextColumn();
// Title
ImGui::Text("Scale Adjustement");
ImGui::TableNextColumn();
ImGui::DragFloat("##barrelScale", &env->BarrelScale, 0.01f);
ImGui::TableNextColumn();
// Reset button
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1, 1, 1, 0));
std::string resetVolumetric = ICON_FA_UNDO + std::string("##resetVolumetric");
if (ImGui::Button(resetVolumetric.c_str())) env->BarrelScale = 1.0f;
ImGui::PopStyleColor();
}
ImGui::EndTable();
}
END_COLLAPSE_HEADER()
BEGIN_COLLAPSE_HEADER(VIGNETTE)
if (ImGui::BeginTable("EnvTable", 3, ImGuiTableFlags_BordersInner | ImGuiTableFlags_SizingStretchProp))
{
ImGui::TableSetupColumn("name", 0, 0.3);
ImGui::TableSetupColumn("set", 0, 0.6);
ImGui::TableSetupColumn("reset", 0, 0.1);
{
ImGui::TableNextColumn();
// Title
ImGui::Text("Vignette Enabled");
ImGui::TableNextColumn();
ImGui::Checkbox("##VignetteEnabled", &env->VignetteEnabled);
ImGui::TableNextColumn();
// Reset button
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1, 1, 1, 0));
std::string resetSSR = ICON_FA_UNDO + std::string("##resetrBarrelDistortionEnabled");
if (ImGui::Button(resetSSR.c_str())) env->VignetteEnabled = false;
ImGui::PopStyleColor();
}
{
ImGui::TableNextColumn();
// Title
ImGui::Text("Intensity");
ImGui::TableNextColumn();
ImGui::DragFloat("##vignetteIntensity", &env->VignetteIntensity, 0.1f);
ImGui::TableNextColumn();
// Reset button
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1, 1, 1, 0));
std::string resetVolumetric = ICON_FA_UNDO + std::string("##resetVolumetric");
if (ImGui::Button(resetVolumetric.c_str())) env->VignetteIntensity = 0.0f;
ImGui::PopStyleColor();
}
{
ImGui::TableNextColumn();
// Title
ImGui::Text("Extend");
ImGui::TableNextColumn();
ImGui::DragFloat("##vignetteExtend", &env->VignetteExtend, 0.01f, 0.0f);
ImGui::TableNextColumn();
// Reset button
ImGui::PushStyleColor(ImGuiCol_Button, ImVec4(1, 1, 1, 0));
std::string resetVolumetric = ICON_FA_UNDO + std::string("##resetVolumetric");
if (ImGui::Button(resetVolumetric.c_str())) env->VignetteExtend = 0.0f;
ImGui::PopStyleColor();
}
ImGui::EndTable();
}
END_COLLAPSE_HEADER()
}
ImGui::End();

View File

@@ -57,6 +57,20 @@ void EditorSelectionPanel::Draw(EditorSelection selection)
ResolveFile(selection.File);
}
if (!selection.File->IsValid())
{
std::string text = "File is invaluid";
auto windowWidth = ImGui::GetWindowSize().x;
auto windowHeight = ImGui::GetWindowSize().y;
auto textWidth = ImGui::CalcTextSize(text.c_str()).x;
auto textHeight = ImGui::CalcTextSize(text.c_str()).y;
ImGui::SetCursorPosX((windowWidth - textWidth) * 0.5f);
ImGui::SetCursorPosY((windowHeight - textHeight) * 0.5f);
ImGui::TextColored({1, 0.1, 0.1, 1.0}, text.c_str());
}
DrawFile(selection.File);
break;
}

View File

@@ -14,6 +14,7 @@
#include "../Misc/PopupHelper.h"
#include "src/Scene/Systems/WadConverter.h"
#include "../Misc/ThumbnailManager.h"
namespace Nuake
{
@@ -38,6 +39,10 @@ namespace Nuake
void FileSystemUI::EditorInterfaceDrawFiletree(Ref<Directory> dir)
{
ImGuiTreeNodeFlags base_flags = ImGuiTreeNodeFlags_OpenOnArrow | ImGuiTreeNodeFlags_OpenOnDoubleClick | ImGuiTreeNodeFlags_SpanFullWidth | ImGuiTreeNodeFlags_FramePadding;
//if (is_selected)
@@ -211,10 +216,31 @@ namespace Nuake
icon = ICON_FA_FILE_IMAGE;
std::string fullName = icon + std::string("##") + file->GetAbsolutePath();
if (ImGui::Button(fullName.c_str(), ImVec2(100, 100)))
bool pressed = false;
if (fileExtension == ".material")
{
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
pressed = ImGui::ImageButton(fullName.c_str(), (void*)ThumbnailManager::Get().GetThumbnail(file->GetRelativePath())->GetID(), ImVec2(100, 100), ImVec2(0, 1), ImVec2(1, 0));
ImGui::PopStyleVar();
}
else
{
ImGui::PushStyleVar(ImGuiStyleVar_FramePadding, ImVec2(0, 0));
pressed = ImGui::Button(fullName.c_str(), ImVec2(100, 100));
ImGui::PopStyleVar();
}
if (Editor->Selection.File == file)
{
ThumbnailManager::Get().MarkThumbnailAsDirty(file->GetRelativePath());
}
if(pressed)
{
Editor->Selection = EditorSelection(file);
}
if (ImGui::IsItemHovered() && ImGui::IsMouseDoubleClicked(0))
{
OS::OpenTrenchbroomMap(file->GetAbsolutePath());
@@ -528,6 +554,13 @@ namespace Nuake
static float sz2 = 300;
void FileSystemUI::DrawDirectoryExplorer()
{
//if (ImGui::Begin("thumbnail debugger"))
//{
// auto texture = ThumbnailManager::Get().GetThumbnail("Materials/prototype_1_2/64_blood_2.material");
// ImGui::Image((void*)texture->GetID(), ImGui::GetContentRegionAvail(), ImVec2(0, 1), ImVec2(1, 0));
//}
//ImGui::End();
if (ImGui::Begin("File browser"))
{
Ref<Directory> rootDirectory = FileSystem::GetFileTree();