Added material inspector and setting of materials #168
|
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
};
|
||||
}
|
Loading…
Reference in New Issue