diff options
author | Liso <anlismon@gmail.com> | 2021-06-06 18:51:21 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-06-06 18:51:21 +0200 |
commit | c47313db65f968559711ac1b505ef341a9872017 (patch) | |
tree | 63d9b1b2be512918e2361d96e4fb52ff1ec3f9de /src/client/wieldmesh.cpp | |
parent | 46f42e15c41cf4ab23c5ff4cd8a7d99d94d10d7b (diff) | |
download | minetest-c47313db65f968559711ac1b505ef341a9872017.tar.xz |
Shadow mapping render pass (#11244)
Co-authored-by: x2048 <codeforsmile@gmail.com>
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) |