From c966c121c94b3e6c53ebdc30387d84288a0f5cb7 Mon Sep 17 00:00:00 2001 From: hikerstk Date: Wed, 24 Mar 2010 10:29:41 +0000 Subject: [PATCH] Added setting to disable backface culling. git-svn-id: svn+ssh://svn.code.sf.net/p/supertuxkart/code/main/trunk@5055 178a84e3-b1eb-0310-8ba1-8eac791a3b58 --- src/graphics/material.cpp | 8 +++++++- src/graphics/material.hpp | 3 +++ 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/graphics/material.cpp b/src/graphics/material.cpp index 81dbcd817..d2e47ccea 100644 --- a/src/graphics/material.cpp +++ b/src/graphics/material.cpp @@ -2,6 +2,7 @@ // // SuperTuxKart - a fun racing game with go-kart // Copyright (C) 2004 Steve Baker +// 2010 Steve Baker, Joerg Henrichs // // This program is free software; you can redistribute it and/or // modify it under the terms of the GNU General Public License @@ -62,6 +63,7 @@ Material::Material(const XMLNode *node, int index) node->get("max-speed", &m_max_speed_fraction); node->get("slowdown", &m_slowdown ); node->get("anisotropic", &m_anisotropic ); + node->get("backface-culling", &m_backface_culling ); std::string s(""); node->get("graphical-effect", &s ); if(s=="water") @@ -105,6 +107,7 @@ void Material::init(unsigned int index) m_alpha_blending = false; m_lighting = true; m_anisotropic = false; + m_backface_culling = true; m_sphere_map = false; m_friction = 1.0f; m_ignore = false; @@ -199,5 +202,8 @@ void Material::setMaterialProperties(video::SMaterial *m) const } #endif - // FIXME: more parameters need to be set! + + if(!m_backface_culling) + m->setFlag(video::EMF_BACK_FACE_CULLING, false); + } // setMaterialProperties diff --git a/src/graphics/material.hpp b/src/graphics/material.hpp index 07ad6f314..076b7ce70 100644 --- a/src/graphics/material.hpp +++ b/src/graphics/material.hpp @@ -46,6 +46,9 @@ private: bool m_sphere_map; bool m_alpha_testing; bool m_alpha_blending; + + /** True if backface culliing should be enabled. */ + bool m_backface_culling; /** Whether to use anisotropic filtering for this texture */ bool m_anisotropic;