mirror of
https://github.com/luanti-org/luanti.git
synced 2025-08-01 17:38:41 +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:
parent
f470cb7270
commit
fd9f195fcc
5 changed files with 25 additions and 9 deletions
|
@ -563,7 +563,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc)
|
|||
}
|
||||
else if(m_prop.visual == "mesh") {
|
||||
infostream<<"GenericCAO::addToScene(): mesh"<<std::endl;
|
||||
scene::IAnimatedMesh *mesh = m_client->getMesh(m_prop.mesh);
|
||||
scene::IAnimatedMesh *mesh = m_client->getMesh(m_prop.mesh, true);
|
||||
if(mesh)
|
||||
{
|
||||
m_animated_meshnode = RenderingEngine::get_scene_manager()->
|
||||
|
@ -575,13 +575,17 @@ void GenericCAO::addToScene(ITextureSource *tsrc)
|
|||
m_prop.visual_size.Y,
|
||||
m_prop.visual_size.X));
|
||||
u8 li = m_last_light;
|
||||
|
||||
// set vertex colors to ensure alpha is set
|
||||
setMeshColor(m_animated_meshnode->getMesh(), video::SColor(255,li,li,li));
|
||||
|
||||
setAnimatedMeshColor(m_animated_meshnode, video::SColor(255,li,li,li));
|
||||
|
||||
bool backface_culling = m_prop.backface_culling;
|
||||
if (m_is_player)
|
||||
backface_culling = false;
|
||||
|
||||
m_animated_meshnode->setMaterialFlag(video::EMF_LIGHTING, false);
|
||||
m_animated_meshnode->setMaterialFlag(video::EMF_LIGHTING, true);
|
||||
m_animated_meshnode->setMaterialFlag(video::EMF_BILINEAR_FILTER, false);
|
||||
m_animated_meshnode->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF);
|
||||
m_animated_meshnode->setMaterialFlag(video::EMF_FOG_ENABLE, true);
|
||||
|
@ -669,7 +673,7 @@ void GenericCAO::updateLightNoCheck(u8 light_at_pos)
|
|||
if (m_meshnode) {
|
||||
setMeshColor(m_meshnode->getMesh(), color);
|
||||
} else if (m_animated_meshnode) {
|
||||
setMeshColor(m_animated_meshnode->getMesh(), color);
|
||||
setAnimatedMeshColor(m_animated_meshnode, color);
|
||||
} else if (m_wield_meshnode) {
|
||||
m_wield_meshnode->setColor(color);
|
||||
} else if (m_spritenode) {
|
||||
|
@ -1025,7 +1029,7 @@ void GenericCAO::updateTextures(std::string mod)
|
|||
// Set material flags and texture
|
||||
video::SMaterial& material = m_animated_meshnode->getMaterial(i);
|
||||
material.TextureLayer[0].Texture = texture;
|
||||
material.setFlag(video::EMF_LIGHTING, false);
|
||||
material.setFlag(video::EMF_LIGHTING, true);
|
||||
material.setFlag(video::EMF_BILINEAR_FILTER, false);
|
||||
|
||||
// don't filter low-res textures, makes them look blurry
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue