Components/GraphicsComponent: Watch every used material to handle reflective information
This commit is contained in:
@@ -68,6 +68,8 @@ namespace Nz
|
||||
NazaraSignal(OnInstancedRenderableInvalidateData, const InstancedRenderable* /*instancedRenderable*/, UInt32 /*flags*/);
|
||||
NazaraSignal(OnInstancedRenderableInvalidateMaterial, const InstancedRenderable* /*instancedRenderable*/, std::size_t /*skinIndex*/, std::size_t /*matIndex*/, const MaterialRef& /*newMat*/);
|
||||
NazaraSignal(OnInstancedRenderableRelease, const InstancedRenderable* /*instancedRenderable*/);
|
||||
NazaraSignal(OnInstancedRenderableResetMaterials, const InstancedRenderable* /*instancedRenderable*/, std::size_t /*newMaterialCount*/);
|
||||
NazaraSignal(OnInstancedRenderableSkinChange, const InstancedRenderable* /*instancedRenderable*/, std::size_t /*newSkinIndex*/);
|
||||
|
||||
struct InstanceData
|
||||
{
|
||||
|
||||
@@ -124,10 +124,15 @@ namespace Nz
|
||||
{
|
||||
NazaraAssert(skinIndex < m_skinCount, "Skin index out of bounds");
|
||||
|
||||
m_skin = skinIndex;
|
||||
if (m_skin != skinIndex)
|
||||
{
|
||||
OnInstancedRenderableSkinChange(this, skinIndex);
|
||||
|
||||
// Force render queue invalidation
|
||||
InvalidateInstanceData(0);
|
||||
m_skin = skinIndex;
|
||||
|
||||
// Force render queue invalidation
|
||||
InvalidateInstanceData(0);
|
||||
}
|
||||
}
|
||||
|
||||
/*!
|
||||
@@ -186,6 +191,8 @@ namespace Nz
|
||||
{
|
||||
NazaraAssert(skinCount != 0, "Invalid skin count (cannot be zero)");
|
||||
|
||||
OnInstancedRenderableResetMaterials(this, matCount);
|
||||
|
||||
m_materials.clear();
|
||||
m_materials.resize(matCount * skinCount, Material::GetDefault());
|
||||
|
||||
|
||||
Reference in New Issue
Block a user