diff options
Diffstat (limited to 'src/content_cao.cpp')
-rw-r--r-- | src/content_cao.cpp | 23 |
1 files changed, 15 insertions, 8 deletions
diff --git a/src/content_cao.cpp b/src/content_cao.cpp index 1dec95839..92b0ddfbd 100644 --- a/src/content_cao.cpp +++ b/src/content_cao.cpp @@ -477,6 +477,9 @@ void GenericCAO::addToScene(ITextureSource *tsrc) return; } + video::E_MATERIAL_TYPE material_type = (m_prop.use_texture_alpha) ? + video::EMT_TRANSPARENT_ALPHA_CHANNEL : video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF; + if (m_prop.visual == "sprite") { infostream<<"GenericCAO::addToScene(): single_sprite"<<std::endl; m_spritenode = RenderingEngine::get_scene_manager()->addBillboardSceneNode( @@ -486,7 +489,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc) tsrc->getTextureForMesh("unknown_node.png")); m_spritenode->setMaterialFlag(video::EMF_LIGHTING, false); m_spritenode->setMaterialFlag(video::EMF_BILINEAR_FILTER, false); - m_spritenode->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF); + m_spritenode->setMaterialType(material_type); m_spritenode->setMaterialFlag(video::EMF_FOG_ENABLE, true); u8 li = m_last_light; m_spritenode->setColor(video::SColor(255,li,li,li)); @@ -564,7 +567,7 @@ void GenericCAO::addToScene(ITextureSource *tsrc) m_meshnode->setMaterialFlag(video::EMF_LIGHTING, false); m_meshnode->setMaterialFlag(video::EMF_BILINEAR_FILTER, false); - m_meshnode->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF); + m_meshnode->setMaterialType(material_type); m_meshnode->setMaterialFlag(video::EMF_FOG_ENABLE, true); } else if(m_prop.visual == "mesh") { @@ -587,15 +590,12 @@ void GenericCAO::addToScene(ITextureSource *tsrc) 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, true); m_animated_meshnode->setMaterialFlag(video::EMF_BILINEAR_FILTER, false); - m_animated_meshnode->setMaterialType(video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF); + m_animated_meshnode->setMaterialType(material_type); m_animated_meshnode->setMaterialFlag(video::EMF_FOG_ENABLE, true); - m_animated_meshnode->setMaterialFlag(video::EMF_BACK_FACE_CULLING, backface_culling); + m_animated_meshnode->setMaterialFlag(video::EMF_BACK_FACE_CULLING, + m_prop.backface_culling); } else errorstream<<"GenericCAO::addToScene(): Could not load mesh "<<m_prop.mesh<<std::endl; @@ -994,12 +994,16 @@ void GenericCAO::updateTextures(std::string mod) m_current_texture_modifier = mod; m_glow = m_prop.glow; + video::E_MATERIAL_TYPE material_type = (m_prop.use_texture_alpha) ? + video::EMT_TRANSPARENT_ALPHA_CHANNEL : video::EMT_TRANSPARENT_ALPHA_CHANNEL_REF; + if (m_spritenode) { if (m_prop.visual == "sprite") { std::string texturestring = "unknown_node.png"; if (!m_prop.textures.empty()) texturestring = m_prop.textures[0]; texturestring += mod; + m_spritenode->getMaterial(0).MaterialType = material_type; m_spritenode->setMaterialTexture(0, tsrc->getTextureForMesh(texturestring)); @@ -1034,9 +1038,11 @@ void GenericCAO::updateTextures(std::string mod) // Set material flags and texture video::SMaterial& material = m_animated_meshnode->getMaterial(i); + material.MaterialType = material_type; material.TextureLayer[0].Texture = 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); // don't filter low-res textures, makes them look blurry // player models have a res of 64 @@ -1078,6 +1084,7 @@ void GenericCAO::updateTextures(std::string mod) // Set material flags and texture video::SMaterial& material = m_meshnode->getMaterial(i); + material.MaterialType = material_type; material.setFlag(video::EMF_LIGHTING, false); material.setFlag(video::EMF_BILINEAR_FILTER, false); material.setTexture(0, |