Added full support for runtime editing of material properties #215
|
@ -78,6 +78,7 @@ namespace SHADE
|
|||
ImGui::BeginDisabled(!isDirty);
|
||||
if(ImGui::Button(std::format("{} Save", ICON_MD_SAVE).data()))
|
||||
{
|
||||
auto gfxSystem = SHSystemManager::GetSystem<SHGraphicsSystem>();
|
||||
// Replace Material if it's been instantiated
|
||||
auto matHandle = SHResourceManager::Get<SHMaterial>(currentViewedMaterial);
|
||||
if (matHandle)
|
||||
|
@ -85,7 +86,6 @@ namespace SHADE
|
|||
// - Get Shader Modules
|
||||
auto vertShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(currentMatSpec->vertexShader);
|
||||
auto fragShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(currentMatSpec->fragShader);
|
||||
auto gfxSystem = SHSystemManager::GetSystem<SHGraphicsSystem>();
|
||||
if (vertShader && fragShader && gfxSystem)
|
||||
{
|
||||
// - Retrieve pipeline from pipeline library
|
||||
|
@ -121,7 +121,20 @@ namespace SHADE
|
|||
currentMaterial->SetProperty(VARIABLE->offset, PROP_NODE.as<float>());
|
||||
break;
|
||||
case SHADE::SHShaderBlockInterface::Variable::Type::INT:
|
||||
currentMaterial->SetProperty(VARIABLE->offset, PROP_NODE.as<int>());
|
||||
{
|
||||
Handle<SHTexture> texture = SHResourceManager::LoadOrGet<SHTexture>(PROP_NODE.as<int>());
|
||||
// HACK: Need to split this out to a separate pass before loading the materials and subsequently, the scenes
|
||||
gfxSystem->BuildTextures();
|
||||
if (texture)
|
||||
{
|
||||
matHandle->SetProperty(VARIABLE->offset, texture->TextureArrayIndex);
|
||||
}
|
||||
else
|
||||
{
|
||||
SHLOG_WARNING("[] Attempted to load invalid texture! Setting to 0.");
|
||||
matHandle->SetProperty(VARIABLE->offset, 0);
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SHADE::SHShaderBlockInterface::Variable::Type::VECTOR2:
|
||||
currentMaterial->SetProperty(VARIABLE->offset, PROP_NODE.as<SHVec2>());
|
||||
|
|
Loading…
Reference in New Issue