diff --git a/panda/src/pgraph/config_pgraph.cxx b/panda/src/pgraph/config_pgraph.cxx index 9d4d35cc96..044e9e4a5c 100644 --- a/panda/src/pgraph/config_pgraph.cxx +++ b/panda/src/pgraph/config_pgraph.cxx @@ -121,6 +121,12 @@ ConfigVariableBool allow_portal_cull "renderer to cull more objects that are clipped if not in the " "current list of portals. This is still somewhat experimental.")); +ConfigVariableBool show_portal_debug +("show-portal-debug", true, + PRC_DESC("Set this true to show debug lines for portals. This will draw " + "lines from the screen corners to the portal corners, this can " + "be useful when debugging.")); + ConfigVariableBool unambiguous_graph ("unambiguous-graph", false, PRC_DESC("Set this true to make ambiguous path warning messages generate an " diff --git a/panda/src/pgraph/config_pgraph.h b/panda/src/pgraph/config_pgraph.h index 710cfc058e..7751a389cc 100644 --- a/panda/src/pgraph/config_pgraph.h +++ b/panda/src/pgraph/config_pgraph.h @@ -34,6 +34,7 @@ NotifyCategoryDecl(portal, EXPCL_PANDA_PGRAPH, EXPTP_PANDA_PGRAPH); extern ConfigVariableBool fake_view_frustum_cull; extern ConfigVariableBool clip_plane_cull; extern ConfigVariableBool allow_portal_cull; +extern ConfigVariableBool show_portal_debug; extern ConfigVariableBool unambiguous_graph; extern ConfigVariableBool detect_graph_cycles; extern ConfigVariableBool no_unsupported_copy; diff --git a/panda/src/pgraph/cullTraverser.cxx b/panda/src/pgraph/cullTraverser.cxx index 93fad004b0..fa984a6bb4 100644 --- a/panda/src/pgraph/cullTraverser.cxx +++ b/panda/src/pgraph/cullTraverser.cxx @@ -12,6 +12,7 @@ // //////////////////////////////////////////////////////////////////// +#include "config_pgraph.h" #include "cullTraverser.h" #include "cullTraverserData.h" #include "transformState.h" @@ -132,9 +133,11 @@ traverse(const NodePath &root) { // This local_frustum is in camera space PortalClipper portal_viewer(local_frustum, _scene_setup); - portal_viewer.draw_camera_frustum(); + if (show_portal_debug) { + portal_viewer.draw_camera_frustum(); + } - // store this pointer in this + // Store this pointer in this set_portal_clipper(&portal_viewer); CullTraverserData data(root, TransformState::make_identity(), @@ -143,8 +146,10 @@ traverse(const NodePath &root) { traverse(data); - // finally add the lines to be drawn - portal_viewer.draw_lines(); + // Finally add the lines to be drawn + if (show_portal_debug) { + portal_viewer.draw_lines(); + } // Render the frustum relative to the cull center. NodePath cull_center = _scene_setup->get_cull_center();