diff --git a/panda/src/pgraph/config_pgraph.cxx b/panda/src/pgraph/config_pgraph.cxx index 9db180d3c6..8206bef13b 100644 --- a/panda/src/pgraph/config_pgraph.cxx +++ b/panda/src/pgraph/config_pgraph.cxx @@ -127,6 +127,10 @@ const bool paranoid_compose = config_pgraph.GetBool("paranoid-compose", false); // by matrix. const bool compose_componentwise = config_pgraph.GetBool("compose-componentwise", true); +// Set this true to view some info statements regarding the polylight +// It is helpful for debugging +const bool polylight_info = config_pgraph.GetBool("polylight-info", false); + // Set this false to disable TransparencyAttrib::M_dual altogether // (and use M_alpha in its place). const bool m_dual = config_pgraph.GetBool("m-dual", true); diff --git a/panda/src/pgraph/config_pgraph.h b/panda/src/pgraph/config_pgraph.h index e8fef5b703..2c4017d91b 100644 --- a/panda/src/pgraph/config_pgraph.h +++ b/panda/src/pgraph/config_pgraph.h @@ -36,6 +36,8 @@ extern const bool allow_unrelated_wrt; extern const bool paranoid_compose; extern const bool compose_componentwise; +extern const bool polylight_info; + extern const bool m_dual; extern const bool m_dual_opaque; extern const bool m_dual_transparent; diff --git a/panda/src/pgraph/polylightEffect.cxx b/panda/src/pgraph/polylightEffect.cxx index 6d02fa8ac6..096dd01b54 100755 --- a/panda/src/pgraph/polylightEffect.cxx +++ b/panda/src/pgraph/polylightEffect.cxx @@ -156,10 +156,13 @@ do_poly_light(const CullTraverserData *data, const TransformState *node_transfor } if (dist <= light_radius) { // If node is in range of this light - pgraph_cat.debug() << "light's position = " << light->get_pos() << endl; - pgraph_cat.debug() << "relative position = " << point << endl; - pgraph_cat.debug() << "effect center = " << _effect_center << endl; - pgraph_cat.debug() << "close to this light = " << light->get_name() << endl; + if (polylight_info) { + pgraph_cat.info() << "light's position = " << light->get_pos() << endl; + pgraph_cat.info() << "relative position = " << point << endl; + pgraph_cat.info() << "effect center = " << _effect_center << endl; + //pgraph_cat.info() << "close to this light = " << light->get_name() << endl; + pgraph_cat.info() << "dist = " << dist << ";radius = " << light_radius << endl; + } PolylightNode::Attenuation_Type light_attenuation = light->get_attenuation(); Colorf light_color; @@ -189,16 +192,16 @@ do_poly_light(const CullTraverserData *data, const TransformState *node_transfor light_scale = 1.0; } - pgraph_cat.debug() << "dist = " << dist << ";radius = " << light_radius << endl; - // Keep accumulating each lights contribution... // we have to prevent color snap, so factor in the weight. // weight becomes negligent as you are closer to the light // and opposite otherwise weight_scale = _weight * (1.0 - light_scale); - pgraph_cat.debug() << "weight_scale = " << weight_scale - << "; light_scale " << light_scale << endl; + if (polylight_info) { + pgraph_cat.debug() << "weight_scale = " << weight_scale + << "; light_scale " << light_scale << endl; + } Rcollect += light_color[0] * light_scale + weight_scale; Gcollect += light_color[1] * light_scale + weight_scale; @@ -222,7 +225,8 @@ do_poly_light(const CullTraverserData *data, const TransformState *node_transfor r = Rcollect / num_lights; g = Gcollect / num_lights; b = Bcollect / num_lights; - pgraph_cat.debug() << "r=" << r << "; g=" << g << "; b=" << b << endl; + if (polylight_info) + pgraph_cat.info() << "r=" << r << "; g=" << g << "; b=" << b << endl; } return ColorScaleAttrib::make(LVecBase4f(r, g, b, 1.0)); diff --git a/panda/src/pgraph/polylightNode.cxx b/panda/src/pgraph/polylightNode.cxx index be52dfbc2d..4062b18d72 100755 --- a/panda/src/pgraph/polylightNode.cxx +++ b/panda/src/pgraph/polylightNode.cxx @@ -93,11 +93,13 @@ Colorf PolylightNode::flicker() const { //srand((int)ClockObject::get_global_clock()->get_frame_time()); variation = (rand()%100); // a value between 0-99 variation /= 100.0; - pgraph_cat.debug() << "Random Variation: " << variation << endl; + if (polylight_info) + pgraph_cat.info() << "Random Variation: " << variation << endl; } else if (_flicker_type == FSIN) { double now = ClockObject::get_global_clock()->get_frame_time(); variation = sinf(now*_sin_freq); - pgraph_cat.debug() << "Variation: " << variation << endl; + if (polylight_info) + pgraph_cat.info() << "Variation: " << variation << endl; // can't use negative variation, so make it positive if (variation < 0.0) variation *= -1.0;