diff --git a/src/graphics/material.cpp b/src/graphics/material.cpp index 0537954e7..9f2b477fd 100644 --- a/src/graphics/material.cpp +++ b/src/graphics/material.cpp @@ -67,6 +67,7 @@ Material::Material(const XMLNode *node, int index) node->get("slowdown-time", &m_slowdown_time ); node->get("anisotropic", &m_anisotropic ); node->get("backface-culling", &m_backface_culling ); + node->get("disable-z-write", &m_disable_z_write ); std::string s(""); node->get("graphical-effect", &s ); if(s=="water") @@ -149,6 +150,7 @@ void Material::init(unsigned int index) m_ignore = false; m_resetter = false; m_add = false; + m_disable_z_write = false; m_max_speed_fraction = 1.0f; m_slowdown_time = 1.0f; m_sfx_name = ""; @@ -362,6 +364,11 @@ void Material::setMaterialProperties(video::SMaterial *m) const modes++; } + if (m_disable_z_write) + { + m->ZWriteEnable = false; + } + if (modes > 1) { std::cerr << "[Material::setMaterialProperties] More than one main mode set for " << m_texname.c_str() << "\n"; diff --git a/src/graphics/material.hpp b/src/graphics/material.hpp index b21cb8277..f6682c27b 100644 --- a/src/graphics/material.hpp +++ b/src/graphics/material.hpp @@ -75,6 +75,9 @@ private: /** Whether to use anisotropic filtering for this texture */ bool m_anisotropic; + /** Set to true to disable writing to the Z buffer. Usually to be used with alpha blending */ + bool m_disable_z_write; + /** True if lightmapping is enabled for this material. */ bool m_lightmap; float m_friction;