From 097d16f664e7fd37830bd52164206ee34fea62fa Mon Sep 17 00:00:00 2001 From: Lynix Date: Sun, 10 Mar 2019 15:13:16 +0100 Subject: [PATCH] SDK/GraphicsComponent: Fix material update not invalidating culling --- ChangeLog.md | 1 + SDK/src/NDK/Components/GraphicsComponent.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index 66c7756aa..712e89340 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -235,6 +235,7 @@ Nazara Development Kit: - Added EntityOwner::Release - Add missing `recomputeMoment` parameter to PhysicsComponent2D::SetMass - Added possibility of disabling synchronization between PhysicsComponent2D and NodeComponent +- Fixed GraphicsComponent not invalidating render queue on material change (causing crashes or visual errors) # 0.4: diff --git a/SDK/src/NDK/Components/GraphicsComponent.cpp b/SDK/src/NDK/Components/GraphicsComponent.cpp index ac1029742..43bfa3b54 100644 --- a/SDK/src/NDK/Components/GraphicsComponent.cpp +++ b/SDK/src/NDK/Components/GraphicsComponent.cpp @@ -124,9 +124,11 @@ namespace Ndk const Nz::MaterialRef& oldMat = renderable->GetMaterial(skinIndex, matIndex); UnregisterMaterial(oldMat); + + ForceCullingInvalidation(); } - void Ndk::GraphicsComponent::InvalidateReflectionMap() + void GraphicsComponent::InvalidateReflectionMap() { m_entity->Invalidate(); @@ -230,6 +232,8 @@ namespace Ndk std::size_t materialCount = renderable->GetMaterialCount(); for (std::size_t i = 0; i < materialCount; ++i) UnregisterMaterial(renderable->GetMaterial(i)); + + ForceCullingInvalidation(); } void GraphicsComponent::OnInstancedRenderableSkinChange(const Nz::InstancedRenderable* renderable, std::size_t newSkinIndex) @@ -240,6 +244,8 @@ namespace Ndk for (std::size_t i = 0; i < materialCount; ++i) UnregisterMaterial(renderable->GetMaterial(i)); + + ForceCullingInvalidation(); } void GraphicsComponent::OnMaterialReflectionChange(const Nz::Material* material, Nz::ReflectionMode reflectionMode)