From 0ae156cf5135f6e1ef8187ba8d438f51ce5c4cfa Mon Sep 17 00:00:00 2001 From: spog Date: Sat, 25 Mar 2006 18:39:50 +0000 Subject: [PATCH] fixed blended-decal rendering in textured mode git-svn-id: svn://svn.icculus.org/gtkradiant/GtkRadiant/trunk@38 8a3a26a2-13c4-0310-b231-cf6edde360e5 --- CHANGES | 1 + plugins/shaders/shaders.cpp | 68 +++++++++++++++++++------------------ 2 files changed, 36 insertions(+), 33 deletions(-) diff --git a/CHANGES b/CHANGES index 815e28d..b7ce75a 100644 --- a/CHANGES +++ b/CHANGES @@ -5,6 +5,7 @@ that we distribute with the binaries. (see changelog) SPoG - Fixed crash when resetting preferences after startup failure. - Fixed crash on next-leak-spot with build-monitoring enabled. +- Fixed doom3/quake4 blended-decal rendering when toggling lighting mode. 20/03/2006 SPoG diff --git a/plugins/shaders/shaders.cpp b/plugins/shaders/shaders.cpp index 3a7fae2..ba9b578 100644 --- a/plugins/shaders/shaders.cpp +++ b/plugins/shaders/shaders.cpp @@ -1093,39 +1093,6 @@ public: } realiseLighting(); - - if(m_layers.size() == 1) - { - const BlendFuncExpression& blendFunc = m_template.m_layers.front().blendFunc(); - if(!string_empty(blendFunc.second.c_str())) - { - m_blendFunc = BlendFunc( - evaluateBlendFactor(blendFunc.first.c_str(), m_template.m_params, m_args), - evaluateBlendFactor(blendFunc.second.c_str(), m_template.m_params, m_args) - ); - } - else - { - const char* blend = evaluateShaderValue(blendFunc.first.c_str(), m_template.m_params, m_args); - - if(string_equal_nocase(blend, "add")) - { - m_blendFunc = BlendFunc(BLEND_ONE, BLEND_ONE); - } - else if(string_equal_nocase(blend, "filter")) - { - m_blendFunc = BlendFunc(BLEND_DST_COLOUR, BLEND_ZERO); - } - else if(string_equal_nocase(blend, "blend")) - { - m_blendFunc = BlendFunc(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA); - } - else - { - globalErrorStream() << "parsing blend value failed: " << makeQuoted(blend) << "\n"; - } - } - } } void unrealise() @@ -1159,6 +1126,39 @@ public: { m_layers.push_back(evaluateLayer(*i, m_template.m_params, m_args)); } + + if(m_layers.size() == 1) + { + const BlendFuncExpression& blendFunc = m_template.m_layers.front().blendFunc(); + if(!string_empty(blendFunc.second.c_str())) + { + m_blendFunc = BlendFunc( + evaluateBlendFactor(blendFunc.first.c_str(), m_template.m_params, m_args), + evaluateBlendFactor(blendFunc.second.c_str(), m_template.m_params, m_args) + ); + } + else + { + const char* blend = evaluateShaderValue(blendFunc.first.c_str(), m_template.m_params, m_args); + + if(string_equal_nocase(blend, "add")) + { + m_blendFunc = BlendFunc(BLEND_ONE, BLEND_ONE); + } + else if(string_equal_nocase(blend, "filter")) + { + m_blendFunc = BlendFunc(BLEND_DST_COLOUR, BLEND_ZERO); + } + else if(string_equal_nocase(blend, "blend")) + { + m_blendFunc = BlendFunc(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA); + } + else + { + globalErrorStream() << "parsing blend value failed: " << makeQuoted(blend) << "\n"; + } + } + } } } @@ -1177,6 +1177,8 @@ public: GlobalTexturesCache().release((*i).texture()); } m_layers.clear(); + + m_blendFunc = BlendFunc(BLEND_SRC_ALPHA, BLEND_ONE_MINUS_SRC_ALPHA); } }