Fixed compilation issues in SHResourceManager

This commit is contained in:
Kah Wei 2022-10-31 18:18:06 +08:00
parent 33431d71a6
commit 2ca353a0b7
2 changed files with 9 additions and 8 deletions

View File

@ -24,6 +24,7 @@ of DigiPen Institute of Technology is prohibited.
#include "Graphics/MiddleEnd/Textures/SHTextureLibrary.h"
#include "Graphics/MiddleEnd/Interface/SHMeshLibrary.h"
#include "Graphics/MiddleEnd/Interface/SHMaterial.h"
#include "Assets/Asset Types/SHMaterialAsset.h"
namespace SHADE
{
@ -51,7 +52,7 @@ namespace SHADE
template<>
struct SHResourceLoader<SHMaterial>
{
using AssetType = std::string;
using AssetType = SHMaterialAsset;
};

View File

@ -183,7 +183,7 @@ namespace SHADE
else if constexpr (std::is_same_v<ResourceType, SHMaterial>)
{
// Get the data we need to construct
SHMaterialSpec matSpec = YAML::Node(assetData).as<SHMaterialSpec>();
SHMaterialSpec matSpec = YAML::Node(assetData.data).as<SHMaterialSpec>();
// Load shaders
auto vertexShader = SHResourceManager::LoadOrGet<SHVkShaderModule>(matSpec.vertexShader);
@ -214,7 +214,7 @@ namespace SHADE
auto matHandle = gfxSystem->AddMaterial(vertexShader, fragShader, subPass);
// Set properties for the material
Handle<SHShaderBlockInterface> pipelineProperties = matHandle.GetShaderBlockInterface();
Handle<SHShaderBlockInterface> pipelineProperties = matHandle->GetShaderBlockInterface();
for (int i = 0; i < static_cast<int>(pipelineProperties->GetVariableCount()); ++i)
{
const std::string& PROP_NAME = pipelineProperties->GetVariableName(i);
@ -226,19 +226,19 @@ namespace SHADE
switch (VARIABLE->type)
{
case SHADE::SHShaderBlockInterface::Variable::Type::FLOAT:
matHandle.SetProperty(VARIABLE->offset, PROP_NODE.as<float>());
matHandle->SetProperty(VARIABLE->offset, PROP_NODE.as<float>());
break;
case SHADE::SHShaderBlockInterface::Variable::Type::INT:
matHandle.SetProperty(VARIABLE->offset, PROP_NODE.as<int>());
matHandle->SetProperty(VARIABLE->offset, PROP_NODE.as<int>());
break;
case SHADE::SHShaderBlockInterface::Variable::Type::VECTOR2:
matHandle.SetProperty(VARIABLE->offset, PROP_NODE.as<SHVec2>());
matHandle->SetProperty(VARIABLE->offset, PROP_NODE.as<SHVec2>());
break;
case SHADE::SHShaderBlockInterface::Variable::Type::VECTOR3:
matHandle.SetProperty(VARIABLE->offset, PROP_NODE.as<SHVec3>());
matHandle->SetProperty(VARIABLE->offset, PROP_NODE.as<SHVec3>());
break;
case SHADE::SHShaderBlockInterface::Variable::Type::VECTOR4:
matHandle.SetProperty(VARIABLE->offset, PROP_NODE.as<SHVec4>());
matHandle->SetProperty(VARIABLE->offset, PROP_NODE.as<SHVec4>());
break;
case SHADE::SHShaderBlockInterface::Variable::Type::OTHER:
default: