Selaa lähdekoodia

Commit patch by Technologicat (closes LP #1214782)

rdb 11 vuotta sitten
vanhempi
sitoutus
bce1f2dd5a

+ 1 - 1
panda/src/pgraph/lightRampAttrib.cxx

@@ -96,7 +96,7 @@ make_single_threshold(PN_stdfloat thresh0, PN_stdfloat val0) {
 CPT(RenderAttrib) LightRampAttrib::
 make_double_threshold(PN_stdfloat thresh0, PN_stdfloat val0, PN_stdfloat thresh1, PN_stdfloat val1) {
   LightRampAttrib *attrib = new LightRampAttrib();
-  attrib->_mode = LRT_single_threshold;
+  attrib->_mode = LRT_double_threshold;
   attrib->_threshold[0] = thresh0;
   attrib->_level[0] = val0;
   attrib->_threshold[1] = thresh1;

+ 3 - 4
panda/src/pgraphnodes/shaderGenerator.cxx

@@ -1178,12 +1178,11 @@ synthesize_shader(const RenderState *rs) {
           PN_stdfloat t1 = light_ramp->get_threshold(1);
           PN_stdfloat l0 = light_ramp->get_level(0);
           PN_stdfloat l1 = light_ramp->get_level(1);
-          PN_stdfloat l2 = light_ramp->get_level(2);
           text << "\t // Double-threshold light ramp\n";
           text << "\t float lr_in = dot(tot_diffuse.rgb, float3(0.33,0.34,0.33));\n";
-          text << "\t float lr_out = " << l0 << "\n";
-          text << "\t if (lr_in > " << t0 << ") lr_out=" << l1 << ";\n";
-          text << "\t if (lr_in > " << t1 << ") lr_out=" << l2 << ";\n";
+          text << "\t float lr_out = 0.0;\n";
+          text << "\t if (lr_in > " << t0 << ") lr_out=" << l0 << ";\n";
+          text << "\t if (lr_in > " << t1 << ") lr_out=" << l1 << ";\n";
           text << "\t tot_diffuse = tot_diffuse * (lr_out / lr_in);\n";
           break;
         }