Fixed UI Rendering #326

Merged
Xenosas1337 merged 13 commits from SP3-1-Rendering into main 2023-01-31 22:53:04 +08:00
2 changed files with 41 additions and 7 deletions
Showing only changes of commit 8a4a469abf - Show all commits

View File

@ -1,8 +1,11 @@
#include "SHpch.h"
#include <memory>
#include <imgui.h>
#include "Serialization/SHSerializationHelper.hpp"
#include "SHMaterialInspector.h"
#include "Editor/SHImGuiHelpers.hpp"
#include <imgui.h>
#include "Assets/SHAssetManager.h"
#include "Editor/IconsMaterialDesign.h"
@ -176,7 +179,7 @@ namespace SHADE
const std::string VERT_SHADER_NAME = VERT_SHADER_INFO ? VERT_SHADER_INFO->name : "Unknown Shader";
isDirty |= SHEditorWidgets::DragDropReadOnlyField<AssetID>
(
"Fragment Shader", VERT_SHADER_NAME.data(),
"Vertex Shader", VERT_SHADER_NAME.data(),
[this]() { return currentMatSpec->vertexShader; },
[this](const AssetID& id) { currentMatSpec->vertexShader = id; },
SHDragDrop::DRAG_RESOURCE
@ -191,6 +194,37 @@ namespace SHADE
SHDragDrop::DRAG_RESOURCE
);
// Subpass
const auto& SP_NAMES = SHGraphicsConstants::RenderGraphEntityNames::USABLE_SUBPASSES;
ImGui::Text("Subpass");
ImGui::SameLine();
if (ImGui::BeginCombo("##", currentMatSpec->subpassName.data(), ImGuiComboFlags_None))
{
for (const auto& NAME : SP_NAMES)
{
const bool IS_SELECTED = currentMatSpec->subpassName == NAME;
if (ImGui::Selectable(NAME.data(), IS_SELECTED))
{
isDirty = true;
SHCommandManager::PerformCommand
(
std::reinterpret_pointer_cast<SHBaseCommand>(std::make_shared<SHCommand<std::string>>
(
currentMatSpec->subpassName,
std::string(NAME),
[&](const std::string& newName){ currentMatSpec->subpassName = newName; }
)),
false
);
}
if (IS_SELECTED)
{
ImGui::SetItemDefaultFocus();
}
}
ImGui::EndCombo();
}
// Load the shader to access it's data
auto fragShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(currentMatSpec->fragShader);
if (!fragShader)