diff options
Diffstat (limited to 'src/client/wieldmesh.cpp')
-rw-r--r-- | src/client/wieldmesh.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/src/client/wieldmesh.cpp b/src/client/wieldmesh.cpp index 08fd49fc0..7597aaa88 100644 --- a/src/client/wieldmesh.cpp +++ b/src/client/wieldmesh.cpp @@ -33,6 +33,7 @@ with this program; if not, write to the Free Software Foundation, Inc., #include "util/numeric.h" #include <map> #include <IMeshManipulator.h> +#include "client/renderingengine.h" #define WIELD_SCALE_FACTOR 30.0 #define WIELD_SCALE_FACTOR_EXTRUDED 40.0 @@ -220,11 +221,18 @@ WieldMeshSceneNode::WieldMeshSceneNode(scene::ISceneManager *mgr, s32 id, bool l m_meshnode->setReadOnlyMaterials(false); m_meshnode->setVisible(false); dummymesh->drop(); // m_meshnode grabbed it + + m_shadow = RenderingEngine::get_shadow_renderer(); } WieldMeshSceneNode::~WieldMeshSceneNode() { sanity_check(g_extrusion_mesh_cache); + + // Remove node from shadow casters + if (m_shadow) + m_shadow->removeNodeFromShadowList(m_meshnode); + if (g_extrusion_mesh_cache->drop()) g_extrusion_mesh_cache = nullptr; } @@ -527,6 +535,10 @@ void WieldMeshSceneNode::changeToMesh(scene::IMesh *mesh) // need to normalize normals when lighting is enabled (because of setScale()) m_meshnode->setMaterialFlag(video::EMF_NORMALIZE_NORMALS, m_lighting); m_meshnode->setVisible(true); + + // Add mesh to shadow caster + if (m_shadow) + m_shadow->addNodeToShadowList(m_meshnode); } void getItemMesh(Client *client, const ItemStack &item, ItemMesh *result) |