diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-01-04 03:27:20 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-01-04 03:27:20 +0400 |
commit | ec78eb353f71341f84999f47a7222becaadb8598 (patch) | |
tree | 0ae6937bcd59f93e0cec512f7b902686cf210e22 /source/blender/freestyle/intern/view_map/BoxGrid.h | |
parent | 699da2fb0d9012cef5e45cc1b547a01fd92dbc1c (diff) |
New command-line option --debug-freestyle to enable verbose debug messages
on the console during Freestyle rendering. The debug prints are turned off
by default now. Errors are still printed on the console.
A patch set implementing this functionality was provided by Bastien Montagne.
Many thanks! :)
Diffstat (limited to 'source/blender/freestyle/intern/view_map/BoxGrid.h')
-rw-r--r-- | source/blender/freestyle/intern/view_map/BoxGrid.h | 53 |
1 files changed, 39 insertions, 14 deletions
diff --git a/source/blender/freestyle/intern/view_map/BoxGrid.h b/source/blender/freestyle/intern/view_map/BoxGrid.h index 9c8875865ef..50ca1622e99 100644 --- a/source/blender/freestyle/intern/view_map/BoxGrid.h +++ b/source/blender/freestyle/intern/view_map/BoxGrid.h @@ -55,6 +55,8 @@ #include "../winged_edge/WEdge.h" +#include "BKE_global.h" + class BoxGrid { public: @@ -193,14 +195,19 @@ inline void BoxGrid::Iterator::initAfterTarget() { if (_foundOccludee) { #if BOX_GRID_LOGGING - std::cout << "\tStarting occludee search from occludeeCandidate at depth " << _occludeeDepth << std::endl; + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\tStarting occludee search from occludeeCandidate at depth " + << _occludeeDepth << std::endl; + } #endif _current = _occludeeCandidate; return; } #if BOX_GRID_LOGGING - std::cout << "\tStarting occludee search from current position" << std::endl; + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\tStarting occludee search from current position" << std::endl; + } #endif while (_current != _cell->faces.end() && !testOccluder(true)) { @@ -217,17 +224,21 @@ inline bool BoxGrid::Iterator::testOccluder(bool wantOccludee) return true; } #if BOX_GRID_LOGGING - std::cout << "\tTesting occluder " << (*_current)->poly.getVertices()[0]; - for (unsigned int i = 1; i < (*_current)->poly.getVertices().size(); ++i) { - std::cout << ", " << (*_current)->poly.getVertices()[i]; + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\tTesting occluder " << (*_current)->poly.getVertices()[0]; + for (unsigned int i = 1; i < (*_current)->poly.getVertices().size(); ++i) { + std::cout << ", " << (*_current)->poly.getVertices()[i]; + } + std::cout << " from shape " << (*_current)->face->GetVertex(0)->shape()->GetId() << std::endl; } - std::cout << " from shape " << (*_current)->face->GetVertex(0)->shape()->GetId() << std::endl; #endif // If we have an occluder candidate and we are unambiguously after it, abort if (_foundOccludee && (*_current)->shallowest > _occludeeDepth) { #if BOX_GRID_LOGGING - std::cout << "\t\tAborting: shallowest > occludeeCandidate->deepest" << std::endl; + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tAborting: shallowest > occludeeCandidate->deepest" << std::endl; + } #endif _current = _cell->faces.end(); @@ -239,7 +250,9 @@ inline bool BoxGrid::Iterator::testOccluder(bool wantOccludee) if (wantOccludee) { if ((*_current)->deepest < _target[2]) { #if BOX_GRID_LOGGING - std::cout << "\t\tSkipping: shallower than target while looking for occludee" << std::endl; + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tSkipping: shallower than target while looking for occludee" << std::endl; + } #endif return false; } @@ -247,7 +260,9 @@ inline bool BoxGrid::Iterator::testOccluder(bool wantOccludee) else { if ((*_current)->shallowest > _target[2]) { #if BOX_GRID_LOGGING - std::cout << "\t\tStopping: deeper than target while looking for occluder" << std::endl; + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tStopping: deeper than target while looking for occluder" << std::endl; + } #endif return true; } @@ -260,7 +275,9 @@ inline bool BoxGrid::Iterator::testOccluder(bool wantOccludee) (*_current)->poly.getBBox(bbMin, bbMax); if (_target[0] < bbMin[0] || _target[0] > bbMax[0] || _target[1] < bbMin[1] || _target[1] > bbMax[1]) { #if BOX_GRID_LOGGING - std::cout << "\t\tSkipping: bounding box violation" << std::endl; + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tSkipping: bounding box violation" << std::endl; + } #endif return false; } @@ -276,11 +293,15 @@ inline void BoxGrid::Iterator::reportDepth(Vec3r origin, Vec3r u, real t) // We need to convert it into a Z-value in grid space real depth = -(origin + (u * t))[2]; #if BOX_GRID_LOGGING - std::cout << "\t\tReporting depth of occluder/ee: " << depth; + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tReporting depth of occluder/ee: " << depth; + } #endif if (depth > _target[2]) { #if BOX_GRID_LOGGING - std::cout << " is deeper than target" << std::endl; + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << " is deeper than target" << std::endl; + } #endif // If the current occluder is the best occludee so far, save it. if (! _foundOccludee || _occludeeDepth > depth) { @@ -289,7 +310,9 @@ inline void BoxGrid::Iterator::reportDepth(Vec3r origin, Vec3r u, real t) } else { #if BOX_GRID_LOGGING - std::cout << std::endl; + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << std::endl; + } #endif } } @@ -325,7 +348,9 @@ inline bool BoxGrid::Iterator::validAfterTarget() inline void BoxGrid::Iterator::markCurrentOccludeeCandidate(real depth) { #if BOX_GRID_LOGGING - std::cout << "\t\tFound occludeeCandidate at depth " << depth << std::endl; + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tFound occludeeCandidate at depth " << depth << std::endl; + } #endif _occludeeCandidate = _current; _occludeeDepth = depth; |