1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Shadow mapping render pass (#11244)

Co-authored-by: x2048 <codeforsmile@gmail.com>
This commit is contained in:
Liso 2021-06-06 18:51:21 +02:00 committed by GitHub
parent 46f42e15c4
commit c47313db65
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 2624 additions and 38 deletions

View file

@ -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)