From e99822ae3ce6c2dacffb65c65b563c8d9b0b5c48 Mon Sep 17 00:00:00 2001 From: Vsevolod Kremianskii Date: Mon, 10 May 2021 12:07:44 +0700 Subject: [PATCH] Refactor shadow casters --- src/engine/scene/node/modelnodescenenode.cpp | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/engine/scene/node/modelnodescenenode.cpp b/src/engine/scene/node/modelnodescenenode.cpp index e93f9a74..6e7919f9 100644 --- a/src/engine/scene/node/modelnodescenenode.cpp +++ b/src/engine/scene/node/modelnodescenenode.cpp @@ -169,11 +169,14 @@ bool ModelNodeSceneNode::shouldRender() const { } bool ModelNodeSceneNode::shouldCastShadows() const { - if (_modelSceneNode->usage() != ModelUsage::Creature) return false; + // Skin nodes must not cast shadows + if (static_cast(_modelNode->skin())) return false; + // Meshless nodes must not cast shadows shared_ptr mesh(_modelNode->mesh()); + if (!mesh) return false; - return mesh && mesh->shouldCastShadows() && !static_cast(_modelNode->skin()); + return mesh->shouldCastShadows(); } bool ModelNodeSceneNode::isTransparent() const {