From 225116fb6f969741e9c51913daf9d8cdfd0ce139 Mon Sep 17 00:00:00 2001 From: auria Date: Tue, 11 Jan 2011 21:09:00 +0000 Subject: [PATCH] Add new option to materials.xml : disable z-buffer writes git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@7364 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/graphics/material.cpp | 7 +++++++ src/graphics/material.hpp | 3 +++ 2 files changed, 10 insertions(+) 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;