summaryrefslogtreecommitdiff
path: root/src/client.cpp
diff options
context:
space:
mode:
authorLars Hofhansl <larsh@apache.org>2017-12-04 22:25:09 -0800
committerLars Hofhansl <larsh@apache.org>2017-12-04 22:29:11 -0800
commitfd9f195fcc2e4e592dbad3290876486eb08318b2 (patch)
tree5e8df8c8057e1a268f700541f8efdf2e4174a2ce /src/client.cpp
parentf470cb7270560a26afff0a0eadfc69070236c109 (diff)
downloadminetest-fd9f195fcc2e4e592dbad3290876486eb08318b2.tar.gz
minetest-fd9f195fcc2e4e592dbad3290876486eb08318b2.tar.bz2
minetest-fd9f195fcc2e4e592dbad3290876486eb08318b2.zip
Use Irrlicht's mesh cache for animated meshes.
Fixes #6676. Allow animated meshes to be cached in Irrlicht's builtin mesh cache. Use Material.EmmissiveColor instead of manipulating the mesh' vertex colors.
Diffstat (limited to 'src/client.cpp')
-rw-r--r--src/client.cpp7
1 files changed, 3 insertions, 4 deletions
diff --git a/src/client.cpp b/src/client.cpp
index 1a6a87487..2d1572d8e 100644
--- a/src/client.cpp
+++ b/src/client.cpp
@@ -1836,7 +1836,7 @@ ParticleManager* Client::getParticleManager()
return &m_particle_manager;
}
-scene::IAnimatedMesh* Client::getMesh(const std::string &filename)
+scene::IAnimatedMesh* Client::getMesh(const std::string &filename, bool cache)
{
StringMap::const_iterator it = m_mesh_data.find(filename);
if (it == m_mesh_data.end()) {
@@ -1855,10 +1855,9 @@ scene::IAnimatedMesh* Client::getMesh(const std::string &filename)
scene::IAnimatedMesh *mesh = RenderingEngine::get_scene_manager()->getMesh(rfile);
rfile->drop();
- // NOTE: By playing with Irrlicht refcounts, maybe we could cache a bunch
- // of uniquely named instances and re-use them
mesh->grab();
- RenderingEngine::get_mesh_cache()->removeMesh(mesh);
+ if (!cache)
+ RenderingEngine::get_mesh_cache()->removeMesh(mesh);
return mesh;
}