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

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.
This commit is contained in:
Lars Hofhansl 2017-12-04 22:25:09 -08:00
parent f470cb7270
commit fd9f195fcc
5 changed files with 25 additions and 9 deletions

View file

@ -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;
}