diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-03-11 10:56:51 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-03-11 10:56:51 +0400 |
commit | 2d801f2bec3c4de663f33b0f0f198a12f09ef989 (patch) | |
tree | dfe16a3ca2213bd5b6579ed3bc2ac2902b678067 /source/blender/freestyle/intern/view_map/SphericalGrid.h | |
parent | 4a92d82626980d6d1690113b9d27aae282fd48eb (diff) |
Another big code clean-up patch from Bastien Montagne, thanks again!
Diffstat (limited to 'source/blender/freestyle/intern/view_map/SphericalGrid.h')
-rw-r--r-- | source/blender/freestyle/intern/view_map/SphericalGrid.h | 116 |
1 files changed, 58 insertions, 58 deletions
diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.h b/source/blender/freestyle/intern/view_map/SphericalGrid.h index 57ed117a935..774ec9ab517 100644 --- a/source/blender/freestyle/intern/view_map/SphericalGrid.h +++ b/source/blender/freestyle/intern/view_map/SphericalGrid.h @@ -193,21 +193,21 @@ inline void SphericalGrid::Iterator::initBeforeTarget() inline void SphericalGrid::Iterator::initAfterTarget() { if (_foundOccludee) { - #if SPHERICAL_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\tStarting occludee search from occludeeCandidate at depth " - << _occludeeDepth << std::endl; - } - #endif +#if SPHERICAL_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\tStarting occludee search from occludeeCandidate at depth " << + _occludeeDepth << std::endl; + } +#endif _current = _occludeeCandidate; return; } - #if SPHERICAL_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\tStarting occludee search from current position" << std::endl; - } - #endif +#if SPHERICAL_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\tStarting occludee search from current position" << std::endl; + } +#endif while (_current != _cell->faces.end() && !testOccluder(true)) { ++_current; @@ -222,23 +222,23 @@ inline bool SphericalGrid::Iterator::testOccluder(bool wantOccludee) // _current=_cell->face.end() will make the calling routine give up. return true; } - #if SPHERICAL_GRID_LOGGING - 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; +#if SPHERICAL_GRID_LOGGING + 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]; } - #endif + 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 SPHERICAL_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\t\tAborting: shallowest > occludeeCandidate->deepest" << std::endl; - } - #endif +#if SPHERICAL_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tAborting: shallowest > occludeeCandidate->deepest" << std::endl; + } +#endif _current = _cell->faces.end(); // See note above @@ -248,21 +248,21 @@ inline bool SphericalGrid::Iterator::testOccluder(bool wantOccludee) // Specific continue or stop conditions when searching for each type if (wantOccludee) { if ((*_current)->deepest < _target[2]) { - #if SPHERICAL_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\t\tSkipping: shallower than target while looking for occludee" << std::endl; - } - #endif +#if SPHERICAL_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tSkipping: shallower than target while looking for occludee" << std::endl; + } +#endif return false; } } else { if ((*_current)->shallowest > _target[2]) { - #if SPHERICAL_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\t\tStopping: deeper than target while looking for occluder" << std::endl; - } - #endif +#if SPHERICAL_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tStopping: deeper than target while looking for occluder" << std::endl; + } +#endif return true; } } @@ -273,11 +273,11 @@ inline bool SphericalGrid::Iterator::testOccluder(bool wantOccludee) Vec3r bbMin, bbMax; (*_current)->poly.getBBox(bbMin, bbMax); if (_target[0] < bbMin[0] || _target[0] > bbMax[0] || _target[1] < bbMin[1] || _target[1] > bbMax[1]) { - #if SPHERICAL_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\t\tSkipping: bounding box violation" << std::endl; - } - #endif +#if SPHERICAL_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tSkipping: bounding box violation" << std::endl; + } +#endif return false; } @@ -291,28 +291,28 @@ inline void SphericalGrid::Iterator::reportDepth(Vec3r origin, Vec3r u, real t) // If origin is the viewpoint, depth == t. A future optimization could allow the caller to tell us if origin is // viewponit or target, at the cost of changing the OptimizedGrid API. real depth = (origin + u * t).norm(); - #if SPHERICAL_GRID_LOGGING +#if SPHERICAL_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tReporting depth of occluder/ee: " << depth; + } +#endif + if (depth > _target[2]) { +#if SPHERICAL_GRID_LOGGING if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\t\tReporting depth of occluder/ee: " << depth; + std::cout << " is deeper than target" << std::endl; } - #endif - if (depth > _target[2]) { - #if SPHERICAL_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << " is deeper than target" << std::endl; - } - #endif +#endif // If the current occluder is the best occludee so far, save it. if (! _foundOccludee || _occludeeDepth > depth) { markCurrentOccludeeCandidate(depth); } } else { - #if SPHERICAL_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << std::endl; - } - #endif +#if SPHERICAL_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << std::endl; + } +#endif } } @@ -346,11 +346,11 @@ inline bool SphericalGrid::Iterator::validAfterTarget() inline void SphericalGrid::Iterator::markCurrentOccludeeCandidate(real depth) { - #if SPHERICAL_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\t\tFound occludeeCandidate at depth " << depth << std::endl; - } - #endif +#if SPHERICAL_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tFound occludeeCandidate at depth " << depth << std::endl; + } +#endif _occludeeCandidate = _current; _occludeeDepth = depth; _foundOccludee = true; |