From c013cddc929ee96addb94883f799e68854b8cd24 Mon Sep 17 00:00:00 2001 From: Josh Yelon Date: Wed, 30 Apr 2008 22:23:14 +0000 Subject: [PATCH] More support for negative glow --- panda/src/pgraph/materialAttrib.cxx | 2 +- panda/src/pgraph/shaderGenerator.cxx | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/panda/src/pgraph/materialAttrib.cxx b/panda/src/pgraph/materialAttrib.cxx index 7f9064eca3..53add60200 100644 --- a/panda/src/pgraph/materialAttrib.cxx +++ b/panda/src/pgraph/materialAttrib.cxx @@ -36,6 +36,7 @@ CPT(RenderAttrib) MaterialAttrib:: make(Material *material) { MaterialAttrib *attrib = new MaterialAttrib; attrib->_material = material; + material->set_attrib_lock(); return return_new(attrib); } @@ -181,7 +182,6 @@ make_from_bam(const FactoryParams ¶ms) { parse_params(params, scan, manager); attrib->fillin(scan, manager); - return attrib; } diff --git a/panda/src/pgraph/shaderGenerator.cxx b/panda/src/pgraph/shaderGenerator.cxx index 331f341f4c..f56fb83f9d 100644 --- a/panda/src/pgraph/shaderGenerator.cxx +++ b/panda/src/pgraph/shaderGenerator.cxx @@ -755,13 +755,13 @@ synthesize_shader(const RenderState *rs) { text << "\t // Begin model-space light summation\n"; if (_have_emission) { if (_map_index_glow >= 0) { - text << "\t result = attr_material[2] * tex" << _map_index_glow << ".a;\n"; + text << "\t result = attr_material[2] * saturate(2 * (tex" << _map_index_glow << ".a - 0.5));\n"; } else { text << "\t result = attr_material[2];\n"; } } else { if (_map_index_glow >= 0) { - text << "\t result = tex" << _map_index_glow << ".aaaa;\n"; + text << "\t result = saturate(2 * (tex" << _map_index_glow << ".a - 0.5));\n"; } else { text << "\t result = float4(0,0,0,0);\n"; }