mirror of
https://github.com/luanti-org/luanti.git
synced 2025-09-15 18:57:08 +00:00
Release shadow mapping resources when not needed (#12497)
This commit is contained in:
parent
b15393c2a5
commit
7c261118e0
5 changed files with 47 additions and 33 deletions
|
@ -1318,12 +1318,6 @@ void GenericCAO::updateTextures(std::string mod)
|
|||
m_previous_texture_modifier = m_current_texture_modifier;
|
||||
m_current_texture_modifier = mod;
|
||||
|
||||
video::ITexture *shadow_texture = nullptr;
|
||||
if (auto shadow = RenderingEngine::get_shadow_renderer())
|
||||
shadow_texture = shadow->get_texture();
|
||||
|
||||
const u32 TEXTURE_LAYER_SHADOW = 3;
|
||||
|
||||
if (m_spritenode) {
|
||||
if (m_prop.visual == "sprite") {
|
||||
std::string texturestring = "no_texture.png";
|
||||
|
@ -1334,7 +1328,6 @@ void GenericCAO::updateTextures(std::string mod)
|
|||
m_spritenode->getMaterial(0).MaterialTypeParam = 0.5f;
|
||||
m_spritenode->setMaterialTexture(0,
|
||||
tsrc->getTextureForMesh(texturestring));
|
||||
m_spritenode->setMaterialTexture(TEXTURE_LAYER_SHADOW, shadow_texture);
|
||||
|
||||
// This allows setting per-material colors. However, until a real lighting
|
||||
// system is added, the code below will have no effect. Once MineTest
|
||||
|
@ -1370,7 +1363,6 @@ void GenericCAO::updateTextures(std::string mod)
|
|||
material.MaterialType = m_material_type;
|
||||
material.MaterialTypeParam = 0.5f;
|
||||
material.TextureLayer[0].Texture = texture;
|
||||
material.TextureLayer[TEXTURE_LAYER_SHADOW].Texture = shadow_texture;
|
||||
material.setFlag(video::EMF_LIGHTING, true);
|
||||
material.setFlag(video::EMF_BILINEAR_FILTER, false);
|
||||
material.setFlag(video::EMF_BACK_FACE_CULLING, m_prop.backface_culling);
|
||||
|
@ -1421,7 +1413,6 @@ void GenericCAO::updateTextures(std::string mod)
|
|||
material.setFlag(video::EMF_BILINEAR_FILTER, false);
|
||||
material.setTexture(0,
|
||||
tsrc->getTextureForMesh(texturestring));
|
||||
material.setTexture(TEXTURE_LAYER_SHADOW, shadow_texture);
|
||||
material.getTextureMatrix(0).makeIdentity();
|
||||
|
||||
// This allows setting per-material colors. However, until a real lighting
|
||||
|
@ -1448,7 +1439,6 @@ void GenericCAO::updateTextures(std::string mod)
|
|||
auto& material = m_meshnode->getMaterial(0);
|
||||
material.setTexture(0,
|
||||
tsrc->getTextureForMesh(tname));
|
||||
material.setTexture(TEXTURE_LAYER_SHADOW, shadow_texture);
|
||||
|
||||
// This allows setting per-material colors. However, until a real lighting
|
||||
// system is added, the code below will have no effect. Once MineTest
|
||||
|
@ -1473,7 +1463,6 @@ void GenericCAO::updateTextures(std::string mod)
|
|||
auto& material = m_meshnode->getMaterial(1);
|
||||
material.setTexture(0,
|
||||
tsrc->getTextureForMesh(tname));
|
||||
material.setTexture(TEXTURE_LAYER_SHADOW, shadow_texture);
|
||||
|
||||
// This allows setting per-material colors. However, until a real lighting
|
||||
// system is added, the code below will have no effect. Once MineTest
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue