material inspector

This commit is contained in:
Sri Sham Haran 2022-11-01 19:03:08 +08:00
parent 2f94002561
commit 26591e8c24
2 changed files with 109 additions and 0 deletions

View File

@ -0,0 +1,81 @@
#include "SHpch.h"
#include "SHMaterialInspector.h"
#include "Editor/SHImGuiHelpers.hpp"
#include <imgui.h>
//#include "Assets/SHAssetManager.h"
//#include "Graphics/MiddleEnd/Materials/SHMaterialSpec.h"
//#include "Editor/SHEditorWidgets.hpp"
//#include "Resource/SHResourceManager.h"
namespace SHADE
{
SHMaterialInspector::SHMaterialInspector()
:SHEditorWindow("Material Inspector", ImGuiWindowFlags_MenuBar)//,isNewMaterial(false), currentViewedMaterial(0)
{
}
void SHMaterialInspector::OpenMaterial(AssetID const& assetId) noexcept
{
//Get mat data
//isNewMaterial = false;
}
void SHMaterialInspector::Init()
{
SHEditorWindow::Init();
}
void SHMaterialInspector::Update()
{
SHEditorWindow::Update();
//if(Begin())
//{
// DrawMenuBar();
// if(SHEditorWidgets::DragDropReadOnlyField<AssetID>("Vertex Shader", std::to_string(currentMatSpec.vertexShader), [&](){return currentMatSpec.vertexShader;}, [&](AssetID const& id){currentMatSpec.vertexShader = id;}, SHDragDrop::DRAG_RESOURCE))
// {
// vertShaderHandle = SHResourceManager::LoadOrGet<SHVkShaderModule>(currentMatSpec.vertexShader);
// }
// if(SHEditorWidgets::DragDropReadOnlyField<AssetID>("Fragment Shader", std::to_string(currentMatSpec.fragShader), [&](){return currentMatSpec.fragShader;}, [&](AssetID const& id){currentMatSpec.fragShader = id;}, SHDragDrop::DRAG_RESOURCE))
// {
// fragShaderHandle = SHResourceManager::LoadOrGet<SHVkShaderModule>(currentMatSpec.fragShader);
// }
// auto vertInterface = vertShaderHandle->GetReflectedData().GetDescriptorBindingInfo().GetShaderBlockInterface(SHGraphicsConstants::DescriptorSetIndex::PER_INSTANCE, SHGraphicsConstants::DescriptorSetBindings::BATCHED_PER_INST_DATA);
// int const varCount = static_cast<int>(vertInterface->GetVariableCount());
//
// for(int i = 0; i < varCount; ++i)
// {
// auto variable = vertInterface->GetVariable(i);
// }
//}
//ImGui::End();
}
void SHMaterialInspector::Exit()
{
SHEditorWindow::Exit();
}
void SHMaterialInspector::CreateNewMaterial()
{
//isNewMaterial = true;
////prompt for a name
//currentViewedMaterial = SHAssetManager::CreateNewAsset(AssetType::MATERIAL, "NewMaterial");
//currentMatSpec = {};
//vertShaderHandle = {};
//fragShaderHandle = {};
}
void SHMaterialInspector::DrawMenuBar()
{
if(ImGui::BeginMenuBar())
{
ImGui::EndMenuBar();
}
}
}

View File

@ -0,0 +1,28 @@
#pragma once
#include "Assets/SHAssetMacros.h"
#include "Editor/EditorWindow/SHEditorWindow.h"
namespace SHADE
{
class SHMaterialInspector final : public SHEditorWindow
{
public:
SHMaterialInspector();
~SHMaterialInspector() = default;
void Init() override;
void Update() override;
void Exit() override;
void CreateNewMaterial();
void OpenMaterial(AssetID const& assetId) noexcept;
private:
void DrawMenuBar();
//bool isNewMaterial;
//AssetID currentViewedMaterial;
//SHMaterialSpec currentMatSpec;
//Handle<SHVkShaderModule> vertShaderHandle, fragShaderHandle;
};
}