Skip to content

Commit

Permalink
Fix UID not being created for new material and its ressources
Browse files Browse the repository at this point in the history
  • Loading branch information
Benualdo committed Nov 11, 2024
1 parent 9913cca commit ca50821
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/engine/Resource/Material/Default/DefaultMaterialData.h
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ namespace vg::engine
DefaultMaterialData(const core::string & _name = "", IObject * _parent = nullptr);
~DefaultMaterialData();

renderer::IMaterialModel * CreateRendererMaterialModel() const final override;
bool RegisterUID () override;
renderer::IMaterialModel * CreateRendererMaterialModel () const final override;

private:
UVSource m_UVSource = UVSource::UV0;
Expand Down
12 changes: 12 additions & 0 deletions src/engine/Resource/Material/Default/DefaultMaterialData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -86,4 +86,16 @@ namespace vg::engine

return material;
}

//--------------------------------------------------------------------------------------
bool DefaultMaterialData::RegisterUID()
{
bool result = super::RegisterUID();

result &= m_albedoMap.RegisterUID();
result &= m_normalMap.RegisterUID();
result &= m_pbrMap.RegisterUID();

return result;
}
}
1 change: 1 addition & 0 deletions src/engine/Resource/Material/MaterialResourceData.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ namespace vg::engine
{
// TODO : abstract factory using 'shader' string
m_data = new DefaultMaterialData("Default", this);
m_data->RegisterUID();
CreateRendererMaterial();
}
}
Expand Down

0 comments on commit ca50821

Please sign in to comment.