Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-01-04 03:27:20 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-01-04 03:27:20 +0400
commitec78eb353f71341f84999f47a7222becaadb8598 (patch)
tree0ae6937bcd59f93e0cec512f7b902686cf210e22 /source/blender/freestyle/intern/view_map
parent699da2fb0d9012cef5e45cc1b547a01fd92dbc1c (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')
-rw-r--r--source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp14
-rw-r--r--source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp18
-rw-r--r--source/blender/freestyle/intern/view_map/BoxGrid.cpp30
-rw-r--r--source/blender/freestyle/intern/view_map/BoxGrid.h53
-rw-r--r--source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp18
-rw-r--r--source/blender/freestyle/intern/view_map/Functions0D.cpp9
-rw-r--r--source/blender/freestyle/intern/view_map/GridDensityProvider.h16
-rw-r--r--source/blender/freestyle/intern/view_map/OccluderSource.cpp8
-rw-r--r--source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp14
-rw-r--r--source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp17
-rw-r--r--source/blender/freestyle/intern/view_map/SphericalGrid.cpp30
-rw-r--r--source/blender/freestyle/intern/view_map/SphericalGrid.h53
-rw-r--r--source/blender/freestyle/intern/view_map/SteerableViewMap.cpp10
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp331
14 files changed, 442 insertions, 179 deletions
diff --git a/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp
index c7925026cd5..24cef37f381 100644
--- a/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp
+++ b/source/blender/freestyle/intern/view_map/ArbitraryGridDensityProvider.cpp
@@ -34,6 +34,8 @@
#include "ArbitraryGridDensityProvider.h"
+#include "BKE_global.h"
+
ArbitraryGridDensityProvider::ArbitraryGridDensityProvider(OccluderSource& source, const real proscenium[4],
unsigned numCells)
: GridDensityProvider(source), numCells(numCells)
@@ -67,13 +69,17 @@ void ArbitraryGridDensityProvider::initialize(const real proscenium[4])
float prosceniumWidth = (proscenium[1] - proscenium[0]);
float prosceniumHeight = (proscenium[3] - proscenium[2]);
real cellArea = prosceniumWidth * prosceniumHeight / numCells;
- cout << prosceniumWidth << " x " << prosceniumHeight << " grid with cells of area " << cellArea << "." << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << prosceniumWidth << " x " << prosceniumHeight << " grid with cells of area " << cellArea << "." << endl;
+ }
_cellSize = sqrt(cellArea);
// Now we know how many cells make each side of our grid
_cellsX = ceil(prosceniumWidth / _cellSize);
_cellsY = ceil(prosceniumHeight / _cellSize);
- cout << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl;
+ }
// Make sure the grid exceeds the proscenium by a small amount
float safetyZone = 0.1f;
@@ -83,7 +89,9 @@ void ArbitraryGridDensityProvider::initialize(const real proscenium[4])
if (_cellsY * _cellSize < prosceniumHeight * (1.0 + safetyZone)) {
_cellsY = prosceniumHeight * (1.0 + safetyZone) / _cellSize;
}
- cout << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl;
+ }
// Find grid origin
_cellOrigin[0] = ((proscenium[0] + proscenium[1]) / 2.0) - (_cellsX / 2.0) * _cellSize;
diff --git a/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp
index 4832d08f2bc..d293ed8189f 100644
--- a/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp
+++ b/source/blender/freestyle/intern/view_map/AverageAreaGridDensityProvider.cpp
@@ -34,6 +34,8 @@
#include "AverageAreaGridDensityProvider.h"
+#include "BKE_global.h"
+
AverageAreaGridDensityProvider::AverageAreaGridDensityProvider(OccluderSource& source, const real proscenium[4],
real sizeFactor)
: GridDensityProvider(source)
@@ -76,16 +78,22 @@ void AverageAreaGridDensityProvider::initialize(const real proscenium[4], real s
cellArea += (max[0] - min[0]) * (max[1] - min[1]);
++numFaces;
}
- cout << "Total area: " << cellArea << ". Number of faces: " << numFaces << "." << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Total area: " << cellArea << ". Number of faces: " << numFaces << "." << endl;
+ }
cellArea /= numFaces;
cellArea *= sizeFactor;
- cout << "Building grid with average area " << cellArea << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Building grid with average area " << cellArea << endl;
+ }
_cellSize = sqrt(cellArea);
// Now we know how many cells make each side of our grid
_cellsX = ceil(prosceniumWidth / _cellSize);
_cellsY = ceil(prosceniumHeight / _cellSize);
- cout << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl;
+ }
// Make sure the grid exceeds the proscenium by a small amount
float safetyZone = 0.1f;
@@ -95,7 +103,9 @@ void AverageAreaGridDensityProvider::initialize(const real proscenium[4], real s
if (_cellsY * _cellSize < prosceniumHeight * (1.0 + safetyZone)) {
_cellsY = prosceniumHeight * (1.0 + safetyZone) / _cellSize;
}
- cout << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl;
+ }
// Find grid origin
_cellOrigin[0] = ((proscenium[0] + proscenium[1]) / 2.0) - (_cellsX / 2.0) * _cellSize;
diff --git a/source/blender/freestyle/intern/view_map/BoxGrid.cpp b/source/blender/freestyle/intern/view_map/BoxGrid.cpp
index 6b2804b17ce..c83ab44a259 100644
--- a/source/blender/freestyle/intern/view_map/BoxGrid.cpp
+++ b/source/blender/freestyle/intern/view_map/BoxGrid.cpp
@@ -37,6 +37,8 @@
#include "BoxGrid.h"
+#include "BKE_global.h"
+
using namespace std;
// Helper Classes
@@ -80,9 +82,11 @@ BoxGrid::Iterator::Iterator (BoxGrid& grid, Vec3r& center, real epsilon)
// Find target cell
_cell = grid.findCell(_target);
#if BOX_GRID_LOGGING
- cout << "Searching for occluders of edge centered at " << _target << " in cell ["
- << _cell->boundary[0] << ", " << _cell->boundary[1] << ", " << _cell->boundary[2]
- << ", " << _cell->boundary[3] << "] (" << _cell->faces.size() << " occluders)" << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Searching for occluders of edge centered at " << _target << " in cell ["
+ << _cell->boundary[0] << ", " << _cell->boundary[1] << ", " << _cell->boundary[2]
+ << ", " << _cell->boundary[3] << "] (" << _cell->faces.size() << " occluders)" << endl;
+ }
#endif
// Set iterator
@@ -99,18 +103,26 @@ BoxGrid::BoxGrid(OccluderSource& source, GridDensityProvider& density, ViewMap *
: _viewpoint(viewpoint), _enableQI(enableQI)
{
// Generate Cell structure
- cout << "Generate Cell structure" << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Generate Cell structure" << endl;
+ }
assignCells(source, density, viewMap);
// Fill Cells
- cout << "Distribute occluders" << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Distribute occluders" << endl;
+ }
distributePolygons(source);
// Reorganize Cells
- cout << "Reorganize cells" << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Reorganize cells" << endl;
+ }
reorganizeCells();
- cout << "Ready to use BoxGrid" << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Ready to use BoxGrid" << endl;
+ }
}
BoxGrid::~BoxGrid() {}
@@ -178,7 +190,9 @@ void BoxGrid::distributePolygons(OccluderSource& source)
}
++nFaces;
}
- cout << "Distributed " << nFaces << " occluders. Retained " << nKeptFaces << "." << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Distributed " << nFaces << " occluders. Retained " << nKeptFaces << "." << endl;
+ }
}
void BoxGrid::reorganizeCells()
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;
diff --git a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp
index 0e01a70181a..2c9a9def4fc 100644
--- a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp
+++ b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp
@@ -38,6 +38,8 @@
#include "../geometry/GridHelpers.h"
+#include "BKE_global.h"
+
CulledOccluderSource::CulledOccluderSource(const GridHelpers::Transform& t, WingedEdge& we, ViewMap& viewMap,
bool extensiveFEdgeSearch)
: OccluderSource(t, we), rejected(0), gridSpaceOccluderProsceniumInitialized(false)
@@ -73,7 +75,9 @@ bool CulledOccluderSource::next()
return true;
}
}
- std::cout << "Finished generating occluders. Rejected " << rejected << " faces." << std::endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ std::cout << "Finished generating occluders. Rejected " << rejected << " faces." << std::endl;
+ }
return false;
}
@@ -121,11 +125,13 @@ void CulledOccluderSource::cullViewEdges(ViewMap& viewMap, bool extensiveFEdgeSe
real prosceniumOrigin[2];
prosceniumOrigin[0] = (viewProscenium[1] - viewProscenium[0]) / 2.0;
prosceniumOrigin[1] = (viewProscenium[3] - viewProscenium[2]) / 2.0;
- cout << "Proscenium culling:" << endl;
- cout << "Proscenium: [" << viewProscenium[0] << ", " << viewProscenium[1] << ", " << viewProscenium[2]
- << ", " << viewProscenium[3] << "]"<< endl;
- cout << "Origin: [" << prosceniumOrigin[0] << ", " << prosceniumOrigin[1] << "]"<< endl;
-
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Proscenium culling:" << endl;
+ cout << "Proscenium: [" << viewProscenium[0] << ", " << viewProscenium[1] << ", " << viewProscenium[2]
+ << ", " << viewProscenium[3] << "]"<< endl;
+ cout << "Origin: [" << prosceniumOrigin[0] << ", " << prosceniumOrigin[1] << "]"<< endl;
+ }
+
// A separate occluder proscenium will also be maintained, starting out the same as the viewport proscenium, and
// expanding as necessary so that it encompasses the center point of at least one feature edge in each
// retained view edge.
diff --git a/source/blender/freestyle/intern/view_map/Functions0D.cpp b/source/blender/freestyle/intern/view_map/Functions0D.cpp
index b6821afcb93..9e8557b0fd3 100644
--- a/source/blender/freestyle/intern/view_map/Functions0D.cpp
+++ b/source/blender/freestyle/intern/view_map/Functions0D.cpp
@@ -36,6 +36,8 @@
#include "Functions0D.h"
#include "ViewMap.h"
+#include "BKE_global.h"
+
using namespace std;
namespace Functions0D {
@@ -325,8 +327,11 @@ int QuantitativeInvisibilityF0D::operator()(Interface0DIterator& iter)
qi1 = ve1->qi();
if (ve2 != NULL) {
qi2 = ve2->qi();
- if (qi2 != qi1)
- cout << "QuantitativeInvisibilityF0D: ambiguous evaluation for point " << iter->getId() << endl;
+ if (qi2 != qi1) {
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "QuantitativeInvisibilityF0D: ambiguous evaluation for point " << iter->getId() << endl;
+ }
+ }
}
result = qi1;
return 0;
diff --git a/source/blender/freestyle/intern/view_map/GridDensityProvider.h b/source/blender/freestyle/intern/view_map/GridDensityProvider.h
index cc711fedece..5fe7d095358 100644
--- a/source/blender/freestyle/intern/view_map/GridDensityProvider.h
+++ b/source/blender/freestyle/intern/view_map/GridDensityProvider.h
@@ -42,6 +42,8 @@
#include "../geometry/BBox.h"
+#include "BKE_global.h"
+
class GridDensityProvider
{
// Disallow copying and assignment
@@ -90,8 +92,10 @@ public:
source.next();
}
}
- cout << "Proscenium: (" << proscenium[0] << ", " << proscenium[1] << ", " << proscenium[2]
- << ", " << proscenium[3] << ")" << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Proscenium: (" << proscenium[0] << ", " << proscenium[1] << ", " << proscenium[2]
+ << ", " << proscenium[3] << ")" << endl;
+ }
}
static void calculateQuickProscenium(const GridHelpers::Transform& transform, const BBox<Vec3r>& bbox,
@@ -108,13 +112,15 @@ public:
// Now calculate the proscenium according to the min and max values of the x and y coordinates
Vec3r minPoint = transform(Vec3r(bbox.getMin()[0], bbox.getMin()[1], z));
Vec3r maxPoint = transform(Vec3r(bbox.getMax()[0], bbox.getMax()[1], z));
- cout << "Bounding box: " << minPoint << " to " << maxPoint << endl;
proscenium[0] = std::min(minPoint[0], maxPoint[0]);
proscenium[1] = std::max(minPoint[0], maxPoint[0]);
proscenium[2] = std::min(minPoint[1], maxPoint[1]);
proscenium[3] = std::max(minPoint[1], maxPoint[1]);
- cout << "Proscenium : " << proscenium[0] << ", " << proscenium[1] << ", " << proscenium[2] << ", "
- << proscenium[3] << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Bounding box: " << minPoint << " to " << maxPoint << endl;
+ cout << "Proscenium : " << proscenium[0] << ", " << proscenium[1] << ", " << proscenium[2] << ", "
+ << proscenium[3] << endl;
+ }
}
protected:
diff --git a/source/blender/freestyle/intern/view_map/OccluderSource.cpp b/source/blender/freestyle/intern/view_map/OccluderSource.cpp
index 5af618dd6f6..0cbad57b44a 100644
--- a/source/blender/freestyle/intern/view_map/OccluderSource.cpp
+++ b/source/blender/freestyle/intern/view_map/OccluderSource.cpp
@@ -36,6 +36,8 @@
#include "OccluderSource.h"
+#include "BKE_global.h"
+
OccluderSource::OccluderSource(const GridHelpers::Transform& t, WingedEdge& we)
: wingedEdge(we), valid(false), transform(t)
{
@@ -127,8 +129,10 @@ void OccluderSource::getOccluderProscenium(real proscenium[4])
GridHelpers::expandProscenium (proscenium, cachedPolygon);
next();
}
- cout << "Proscenium: (" << proscenium[0] << ", " << proscenium[1] << ", " << proscenium[2] << ", "
- << proscenium[3] << ")" << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Proscenium: (" << proscenium[0] << ", " << proscenium[1] << ", " << proscenium[2] << ", "
+ << proscenium[3] << ")" << endl;
+ }
}
real OccluderSource::averageOccluderArea()
diff --git a/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp b/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp
index 1a15fc849a6..10c6265ebb4 100644
--- a/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp
+++ b/source/blender/freestyle/intern/view_map/Pow23GridDensityProvider.cpp
@@ -34,6 +34,8 @@
#include "Pow23GridDensityProvider.h"
+#include "BKE_global.h"
+
Pow23GridDensityProvider::Pow23GridDensityProvider(OccluderSource& source, const real proscenium[4], unsigned numFaces)
: GridDensityProvider(source), numFaces(numFaces)
{
@@ -66,13 +68,17 @@ void Pow23GridDensityProvider::initialize(const real proscenium[4])
float prosceniumWidth = (proscenium[1] - proscenium[0]);
float prosceniumHeight = (proscenium[3] - proscenium[2]);
real cellArea = prosceniumWidth * prosceniumHeight / pow(numFaces, 2.0f / 3.0f);
- cout << prosceniumWidth << " x " << prosceniumHeight << " grid with cells of area " << cellArea << "." << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << prosceniumWidth << " x " << prosceniumHeight << " grid with cells of area " << cellArea << "." << endl;
+ }
_cellSize = sqrt(cellArea);
// Now we know how many cells make each side of our grid
_cellsX = ceil(prosceniumWidth / _cellSize);
_cellsY = ceil(prosceniumHeight / _cellSize);
- cout << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl;
+ }
// Make sure the grid exceeds the proscenium by a small amount
float safetyZone = 0.1;
@@ -82,7 +88,9 @@ void Pow23GridDensityProvider::initialize(const real proscenium[4])
if (_cellsY * _cellSize < prosceniumHeight * (1.0 + safetyZone)) {
_cellsY = prosceniumHeight * (1.0 + safetyZone) / _cellSize;
}
- cout << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << _cellsX << "x" << _cellsY << " cells of size " << _cellSize << " square." << endl;
+ }
// Find grid origin
_cellOrigin[0] = ((proscenium[0] + proscenium[1]) / 2.0) - (_cellsX / 2.0) * _cellSize;
diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp
index 06cbd85d863..2de6be4c68a 100644
--- a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp
+++ b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp
@@ -38,6 +38,8 @@
#include "../geometry/GeomUtils.h"
+#include "BKE_global.h"
+
using namespace std;
Vec3r SilhouetteGeomEngine::_Viewpoint = Vec3r(0, 0, 0);
@@ -196,9 +198,11 @@ real SilhouetteGeomEngine::ImageToWorldParameter(FEdge *fe, real t)
GeomUtils::fromWorldToCamera(Bw, Bc, _modelViewMatrix);
Vec3r ABc = Bc - Ac;
#if 0
- cout << "Ac " << Ac << endl;
- cout << "Bc " << Bc << endl;
- cout << "ABc " << ABc << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Ac " << Ac << endl;
+ cout << "Bc " << Bc << endl;
+ cout << "ABc " << ABc << endl;
+ }
#endif
Vec3r Ai = (fe)->vertexA()->point2D();
Vec3r Bi = (fe)->vertexB()->point2D();
@@ -295,10 +299,13 @@ iter:
}
}
#if 0
- printf("SilhouetteGeomEngine::ImageToWorldParameter(): #iters = %d, dist = %e\n", i, dist);
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ printf("SilhouetteGeomEngine::ImageToWorldParameter(): #iters = %d, dist = %e\n", i, dist);
+ }
#endif
- if (i == max_iters)
+ if (i == max_iters && G.debug & G_DEBUG_FREESTYLE) {
printf("SilhouetteGeomEngine::ImageToWorldParameter(): reached to max_iters (dist = %e)\n", dist);
+ }
}
return T;
diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp
index 1052965d472..4582fb40b61 100644
--- a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp
+++ b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp
@@ -37,6 +37,8 @@
#include "SphericalGrid.h"
+#include "BKE_global.h"
+
using namespace std;
// Helper Classes
@@ -81,9 +83,11 @@ SphericalGrid::Iterator::Iterator(SphericalGrid& grid, Vec3r& center, real epsil
// Find target cell
_cell = grid.findCell(_target);
#if SPHERICAL_GRID_LOGGING
- cout << "Searching for occluders of edge centered at " << _target << " in cell ["
- << _cell->boundary[0] << ", " << _cell->boundary[1] << ", " << _cell->boundary[2]
- << ", " << _cell->boundary[3] << "] (" << _cell->faces.size() << " occluders)" << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Searching for occluders of edge centered at " << _target << " in cell ["
+ << _cell->boundary[0] << ", " << _cell->boundary[1] << ", " << _cell->boundary[2]
+ << ", " << _cell->boundary[3] << "] (" << _cell->faces.size() << " occluders)" << endl;
+ }
#endif
// Set iterator
@@ -99,16 +103,24 @@ SphericalGrid::SphericalGrid(OccluderSource& source, GridDensityProvider& densit
Vec3r& viewpoint, bool enableQI)
: _viewpoint(viewpoint), _enableQI(enableQI)
{
- cout << "Generate Cell structure" << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Generate Cell structure" << endl;
+ }
// Generate Cell structure
assignCells(source, density, viewMap);
- cout << "Distribute occluders" << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Distribute occluders" << endl;
+ }
// Fill Cells
distributePolygons(source);
- cout << "Reorganize cells" << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Reorganize cells" << endl;
+ }
// Reorganize Cells
reorganizeCells();
- cout << "Ready to use SphericalGrid" << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Ready to use SphericalGrid" << endl;
+ }
}
SphericalGrid::~SphericalGrid() {}
@@ -175,7 +187,9 @@ void SphericalGrid::distributePolygons(OccluderSource& source)
}
++nFaces;
}
- cout << "Distributed " << nFaces << " occluders. Retained " << nKeptFaces << "." << endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Distributed " << nFaces << " occluders. Retained " << nKeptFaces << "." << endl;
+ }
}
void SphericalGrid::reorganizeCells()
diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.h b/source/blender/freestyle/intern/view_map/SphericalGrid.h
index 0f369b4b686..57ed117a935 100644
--- a/source/blender/freestyle/intern/view_map/SphericalGrid.h
+++ b/source/blender/freestyle/intern/view_map/SphericalGrid.h
@@ -54,6 +54,8 @@
#include "../winged_edge/WEdge.h"
+#include "BKE_global.h"
+
class SphericalGrid
{
public:
@@ -192,14 +194,19 @@ inline void SphericalGrid::Iterator::initAfterTarget()
{
if (_foundOccludee) {
#if SPHERICAL_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 SPHERICAL_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)) {
@@ -216,17 +223,21 @@ inline bool SphericalGrid::Iterator::testOccluder(bool wantOccludee)
return true;
}
#if SPHERICAL_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 SPHERICAL_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();
@@ -238,7 +249,9 @@ inline bool SphericalGrid::Iterator::testOccluder(bool wantOccludee)
if (wantOccludee) {
if ((*_current)->deepest < _target[2]) {
#if SPHERICAL_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;
}
@@ -246,7 +259,9 @@ inline bool SphericalGrid::Iterator::testOccluder(bool wantOccludee)
else {
if ((*_current)->shallowest > _target[2]) {
#if SPHERICAL_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;
}
@@ -259,7 +274,9 @@ inline bool SphericalGrid::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 SPHERICAL_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;
}
@@ -275,11 +292,15 @@ inline void SphericalGrid::Iterator::reportDepth(Vec3r origin, Vec3r u, real t)
// viewponit or target, at the cost of changing the OptimizedGrid API.
real depth = (origin + u * t).norm();
#if SPHERICAL_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 SPHERICAL_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) {
@@ -288,7 +309,9 @@ inline void SphericalGrid::Iterator::reportDepth(Vec3r origin, Vec3r u, real t)
}
else {
#if SPHERICAL_GRID_LOGGING
- std::cout << std::endl;
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ std::cout << std::endl;
+ }
#endif
}
}
@@ -324,7 +347,9 @@ inline bool SphericalGrid::Iterator::validAfterTarget()
inline void SphericalGrid::Iterator::markCurrentOccludeeCandidate(real depth)
{
#if SPHERICAL_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;
diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
index e39181e335d..120ef46667b 100644
--- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
+++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
@@ -45,6 +45,8 @@
#include "../image/ImagePyramid.h"
#include "../image/Image.h"
+#include "BKE_global.h"
+
extern "C" {
#include "IMB_imbuf.h"
#include "IMB_imbuf_types.h"
@@ -206,9 +208,11 @@ void SteerableViewMap::buildImagesPyramids(GrayImage **steerableBases, bool copy
float SteerableViewMap::readSteerableViewMapPixel(unsigned iOrientation, int iLevel, int x, int y)
{
ImagePyramid *pyramid = _imagesPyramids[iOrientation];
- if (pyramid == 0) {
- cout << "Warning: this steerable ViewMap level doesn't exist" << endl;
- return 0;
+ if (!pyramid) {
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ cout << "Warning: this steerable ViewMap level doesn't exist" << endl;
+ }
+ return 0.0f;
}
if ((x < 0) || (x >= pyramid->width()) || (y < 0) || (y >= pyramid->height()))
return 0;
diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
index 84cd166dca0..fc7da724e8f 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
@@ -50,6 +50,11 @@
#include "../winged_edge/WFillGrid.h"
+#include "BKE_global.h"
+
+// XXX Grmll... G is used as template's typename parameter :/
+const Global &_global = G;
+
#define LOGGING FALSE
using namespace std;
@@ -77,8 +82,10 @@ static void findOccludee(FEdge *fe, G& grid, I& occluders, real epsilon, WFace *
for (occluders.initAfterTarget(); occluders.validAfterTarget(); occluders.nextOccludee()) {
#if LOGGING
- cout << "\t\tEvaluating intersection for occludee " << occluders.getWFace() << " and ray " << A
- << " * " << u << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tEvaluating intersection for occludee " << occluders.getWFace() << " and ray " << A
+ << " * " << u << endl;
+ }
#endif
oface = occluders.getWFace();
Polygon3r *p = occluders.getCameraSpacePolygon();
@@ -125,7 +132,9 @@ static void findOccludee(FEdge *fe, G& grid, I& occluders, real epsilon, WFace *
if (GeomUtils::COINCIDENT == GeomUtils::intersectRayPlane(origin, edge, p->getNormal(), d, t, epsilon))
{
#if LOGGING
- cout << "\t\tRejecting occluder for target coincidence." << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tRejecting occluder for target coincidence." << endl;
+ }
#endif
continue;
}
@@ -133,8 +142,10 @@ static void findOccludee(FEdge *fe, G& grid, I& occluders, real epsilon, WFace *
if (p->rayIntersect(A, v, t, t_u, t_v)) {
#if LOGGING
- cout << "\t\tRay " << A << " * " << v << " intersects at time " << t << endl;
- cout << "\t\t(v * normal) == " << (v * p->getNormal()) << " for normal " << p->getNormal() << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tRay " << A << " * " << v << " intersects at time " << t << endl;
+ cout << "\t\t(v * normal) == " << (v * p->getNormal()) << " for normal " << p->getNormal() << endl;
+ }
#endif
if (fabs(v * p->getNormal()) > 0.0001) {
if ((t > 0.0)) { // && (t<1.0))
@@ -144,7 +155,9 @@ static void findOccludee(FEdge *fe, G& grid, I& occluders, real epsilon, WFace *
noIntersection = false;
fe->setOccludeeIntersection(Vec3r(A + t * v));
#if LOGGING
- cout << "\t\tIs occludee" << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tIs occludee" << endl;
+ }
#endif
}
}
@@ -244,9 +257,11 @@ static int computeVisibility(ViewMap *viewMap, FEdge *fe, G& grid, real epsilon,
Polygon3r *p = occluders.getCameraSpacePolygon();
real t, t_u, t_v;
#if LOGGING
- cout << "\t\tEvaluating intersection for occluder " << (p->getVertices())[0] << (p->getVertices())[1]
- << (p->getVertices())[2] << endl << "\t\t\tand ray " << vp << " * " << u << " (center " << center << ")"
- << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tEvaluating intersection for occluder " << (p->getVertices())[0] << (p->getVertices())[1]
+ << (p->getVertices())[2] << endl << "\t\t\tand ray " << vp << " * " << u << " (center " << center << ")"
+ << endl;
+ }
#endif
#if LOGGING
@@ -264,10 +279,12 @@ static int computeVisibility(ViewMap *viewMap, FEdge *fe, G& grid, real epsilon,
Polygon3r p1(points, oface->GetNormal());
Vec3r v1((p1.getVertices())[0]);
real d = -(v1 * p->getNormal());
- cout << "\t\tp: " << (p->getVertices())[0] << (p->getVertices())[1] << (p->getVertices())[2] << ", norm: "
- << p->getNormal() << endl;
- cout << "\t\tp1: " << (p1.getVertices())[0] << (p1.getVertices())[1] << (p1.getVertices())[2] << ", norm: "
- << p1.getNormal() << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tp: " << (p->getVertices())[0] << (p->getVertices())[1] << (p->getVertices())[2] << ", norm: "
+ << p->getNormal() << endl;
+ cout << "\t\tp1: " << (p1.getVertices())[0] << (p1.getVertices())[1] << (p1.getVertices())[2] << ", norm: "
+ << p1.getNormal() << endl;
+ }
#else
real d = -((p->getVertices())[0] * p->getNormal());
#endif
@@ -275,13 +292,17 @@ static int computeVisibility(ViewMap *viewMap, FEdge *fe, G& grid, real epsilon,
if (face)
{
#if LOGGING
- cout << "\t\tDetermining face adjacency...";
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tDetermining face adjacency...";
+ }
#endif
skipFace = false;
if (face == oface) {
#if LOGGING
- cout << " Rejecting occluder for face concurrency." << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << " Rejecting occluder for face concurrency." << endl;
+ }
#endif
continue;
}
@@ -310,7 +331,9 @@ static int computeVisibility(ViewMap *viewMap, FEdge *fe, G& grid, real epsilon,
}
if (skipFace) {
#if LOGGING
- cout << " Rejecting occluder for face adjacency." << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << " Rejecting occluder for face adjacency." << endl;
+ }
#endif
continue;
}
@@ -321,33 +344,41 @@ static int computeVisibility(ViewMap *viewMap, FEdge *fe, G& grid, real epsilon,
//first let us compute the plane equation.
if (GeomUtils::COINCIDENT == GeomUtils::intersectRayPlane(origin, edge, p->getNormal(), d, t, epsilon)) {
#if LOGGING
- cout << "\t\tRejecting occluder for target coincidence." << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tRejecting occluder for target coincidence." << endl;
+ }
#endif
continue;
}
}
#if LOGGING
- real x;
- if (p1.rayIntersect(center, v, x, t_u, t_v)) {
- cout << "\t\tRay should intersect at time " << (rl - x) << ". Center: " << center << ", V: " << v
- << ", RL: " << rl << ", T:" << x << endl;
- }
- else {
- cout << "\t\tRay should not intersect. Center: " << center << ", V: " << v << ", RL: " << rl << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ real x;
+ if (p1.rayIntersect(center, v, x, t_u, t_v)) {
+ cout << "\t\tRay should intersect at time " << (rl - x) << ". Center: " << center << ", V: " << v
+ << ", RL: " << rl << ", T:" << x << endl;
+ }
+ else {
+ cout << "\t\tRay should not intersect. Center: " << center << ", V: " << v << ", RL: " << rl << endl;
+ }
}
#endif
if (p->rayIntersect(center, u, t, t_u, t_v)) {
#if LOGGING
- cout << "\t\tRay " << center << " * " << u << " intersects at time " << t << " (raylength is "
- << raylength << ")" << endl;
- cout << "\t\t(u * normal) == " << (u * p->getNormal()) << " for normal " << p->getNormal() << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tRay " << center << " * " << u << " intersects at time " << t << " (raylength is "
+ << raylength << ")" << endl;
+ cout << "\t\t(u * normal) == " << (u * p->getNormal()) << " for normal " << p->getNormal() << endl;
+ }
#endif
if (fabs(u * p->getNormal()) > 0.0001) {
if ((t > 0.0) && (t < raylength)) {
#if LOGGING
- cout << "\t\tIs occluder" << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tIs occluder" << endl;
+ }
#endif
if ( foundOccluders != NULL ) {
ViewShape *vshape = viewMap->viewShape(oface->GetVertex(0)->shape()->GetId());
@@ -395,7 +426,9 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo
if (iRenderMonitor && iRenderMonitor->testBreak())
break;
#if LOGGING
- cout << "Processing ViewEdge " << (*ve)->getId() << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "Processing ViewEdge " << (*ve)->getId() << endl;
+ }
#endif
// Find an edge to test
if (!(*ve)->isInImage()) {
@@ -403,7 +436,9 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo
(*ve)->setQI(255);
(*ve)->setaShape(0);
#if LOGGING
- cout << "\tCulled." << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tCulled." << endl;
+ }
#endif
continue;
}
@@ -422,7 +457,9 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo
if (qiMajority == 0) {
// There are no occludable FEdges on this ViewEdge
// This should be impossible.
- cout << "View Edge in viewport without occludable FEdges: " << (*ve)->getId() << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "View Edge in viewport without occludable FEdges: " << (*ve)->getId() << endl;
+ }
// We can recover from this error:
// Treat this edge as fully visible with no occludee
(*ve)->setQI(0);
@@ -434,7 +471,9 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo
qiMajority >>= 1;
}
#if LOGGING
- cout << "\tqiMajority: " << qiMajority << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tqiMajority: " << qiMajority << endl;
+ }
#endif
tmpQI = 0;
@@ -454,7 +493,9 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo
//ARB: change &wFace to wFace and use reference in called function
tmpQI = computeVisibility<G, I>(ioViewMap, fe, grid, epsilon, *ve, &wFace, &foundOccluders);
#if LOGGING
- cout << "\tFEdge: visibility " << tmpQI << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFEdge: visibility " << tmpQI << endl;
+ }
#endif
//ARB: This is an error condition, not an alert condition.
@@ -475,7 +516,9 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo
//ARB: change &wFace to wFace and use reference in called function
findOccludee<G, I>(fe, grid, epsilon, *ve, &wFace);
#if LOGGING
- cout << "\tFEdge: occludee only (" << (wFace != NULL ? "found" : "not found") << ")" << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFEdge: occludee only (" << (wFace != NULL ? "found" : "not found") << ")" << endl;
+ }
#endif
}
@@ -491,7 +534,9 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo
wFaces.push_back(wFace);
fe->setOccludeeEmpty(false);
#if LOGGING
- cout << "\tFound occludee" << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFound occludee" << endl;
+ }
#endif
}
else {
@@ -503,7 +548,9 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo
} while ((maxCard < qiMajority) && (fe) && (fe != festart));
#if LOGGING
- cout << "\tFinished with " << nSamples << " samples, maxCard = " << maxCard << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFinished with " << nSamples << " samples, maxCard = " << maxCard << endl;
+ }
#endif
// ViewEdge
@@ -523,7 +570,9 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo
(*ve)->AddOccluder((*o));
}
#if LOGGING
- cout << "\tConclusion: QI = " << maxIndex << ", " << (*ve)->occluders_size() << " occluders." << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tConclusion: QI = " << maxIndex << ", " << (*ve)->occluders_size() << " occluders." << endl;
+ }
#endif
// occludee --
if (!wFaces.empty()) {
@@ -557,7 +606,9 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon,
if (iRenderMonitor && iRenderMonitor->testBreak())
break;
#if LOGGING
- cout << "Processing ViewEdge " << (*ve)->getId() << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "Processing ViewEdge " << (*ve)->getId() << endl;
+ }
#endif
// Find an edge to test
if (!(*ve)->isInImage()) {
@@ -565,7 +616,9 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon,
(*ve)->setQI(255);
(*ve)->setaShape(0);
#if LOGGING
- cout << "\tCulled." << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tCulled." << endl;
+ }
#endif
continue;
}
@@ -584,7 +637,9 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon,
if (qiMajority == 0) {
// There are no occludable FEdges on this ViewEdge
// This should be impossible.
- cout << "View Edge in viewport without occludable FEdges: " << (*ve)->getId() << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "View Edge in viewport without occludable FEdges: " << (*ve)->getId() << endl;
+ }
// We can recover from this error:
// Treat this edge as fully visible with no occludee
(*ve)->setQI(0);
@@ -596,7 +651,9 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon,
qiMajority >>= 1;
}
#if LOGGING
- cout << "\tqiMajority: " << qiMajority << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tqiMajority: " << qiMajority << endl;
+ }
#endif
tmpQI = 0;
@@ -616,7 +673,9 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon,
//ARB: change &wFace to wFace and use reference in called function
tmpQI = computeVisibility<G, I>(ioViewMap, fe, grid, epsilon, *ve, &wFace, &foundOccluders);
#if LOGGING
- cout << "\tFEdge: visibility " << tmpQI << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFEdge: visibility " << tmpQI << endl;
+ }
#endif
//ARB: This is an error condition, not an alert condition.
@@ -637,7 +696,9 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon,
//ARB: change &wFace to wFace and use reference in called function
findOccludee<G, I>(fe, grid, epsilon, *ve, &wFace);
#if LOGGING
- cout << "\tFEdge: occludee only (" << (wFace != NULL ? "found" : "not found") << ")" << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFEdge: occludee only (" << (wFace != NULL ? "found" : "not found") << ")" << endl;
+ }
#endif
}
@@ -653,7 +714,9 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon,
wFaces.push_back(wFace);
fe->setOccludeeEmpty(false);
#if LOGGING
- cout << "\tFound occludee" << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFound occludee" << endl;
+ }
#endif
}
else {
@@ -665,7 +728,9 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon,
} while ((maxCard < qiMajority) && (fe) && (fe != festart));
#if LOGGING
- cout << "\tFinished with " << nSamples << " samples, maxCard = " << maxCard << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFinished with " << nSamples << " samples, maxCard = " << maxCard << endl;
+ }
#endif
// ViewEdge
@@ -678,7 +743,9 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon,
(*ve)->AddOccluder((*o));
}
#if LOGGING
- cout << "\tConclusion: QI = " << maxIndex << ", " << (*ve)->occluders_size() << " occluders." << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tConclusion: QI = " << maxIndex << ", " << (*ve)->occluders_size() << " occluders." << endl;
+ }
#endif
// occludee --
if (!wFaces.empty()) {
@@ -735,7 +802,9 @@ static void computeFastVisibility(ViewMap *ioViewMap, G& grid, real epsilon)
if (qiMajority == 0 ) {
// There are no occludable FEdges on this ViewEdge
// This should be impossible.
- cout << "View Edge in viewport without occludable FEdges: " << (*ve)->getId() << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "View Edge in viewport without occludable FEdges: " << (*ve)->getId() << endl;
+ }
// We can recover from this error:
// Treat this edge as fully visible with no occludee
(*ve)->setQI(0);
@@ -852,7 +921,9 @@ static void computeVeryFastVisibility(ViewMap *ioViewMap, G& grid, real epsilon)
if (!fe || !fe->isInImage()) {
// There are no occludable FEdges on this ViewEdge
// This should be impossible.
- cout << "View Edge in viewport without occludable FEdges: " << (*ve)->getId() << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "View Edge in viewport without occludable FEdges: " << (*ve)->getId() << endl;
+ }
// We can recover from this error:
// Treat this edge as fully visible with no occludee
qi = 0;
@@ -889,7 +960,9 @@ void ViewMapBuilder::BuildGrid(WingedEdge& we, const BBox<Vec3r>& bbox, unsigned
size[i] = fabs(bbox.getMax()[i] - bbox.getMin()[i]);
size[i] += size[i]/10.0; // let make the grid 1/10 bigger to avoid numerical errors while computing triangles/cells intersections
if (size[i] == 0) {
- cout << "Warning: the bbox size is 0 in dimension " << i << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "Warning: the bbox size is 0 in dimension " << i << endl;
+ }
}
}
_Grid->configure(Vec3r(bbox.getMin() - size / 20.0), size, sceneNumFaces);
@@ -962,10 +1035,12 @@ void ViewMapBuilder::CullViewEdges(ViewMap *ioViewMap, real viewProscenium[4], r
real prosceniumOrigin[2];
prosceniumOrigin[0] = (viewProscenium[1] - viewProscenium[0]) / 2.0;
prosceniumOrigin[1] = (viewProscenium[3] - viewProscenium[2]) / 2.0;
- cout << "Proscenium culling:" << endl;
- cout << "Proscenium: [" << viewProscenium[0] << ", " << viewProscenium[1] << ", " << viewProscenium[2]
- << ", " << viewProscenium[3] << "]"<< endl;
- cout << "Origin: [" << prosceniumOrigin[0] << ", " << prosceniumOrigin[1] << "]"<< endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "Proscenium culling:" << endl;
+ cout << "Proscenium: [" << viewProscenium[0] << ", " << viewProscenium[1] << ", " << viewProscenium[2]
+ << ", " << viewProscenium[3] << "]"<< endl;
+ cout << "Origin: [" << prosceniumOrigin[0] << ", " << prosceniumOrigin[1] << "]"<< endl;
+ }
// A separate occluder proscenium will also be maintained, starting out the same as the viewport proscenium, and
// expanding as necessary so that it encompasses the center point of at least one feature edge in each retained view
@@ -1276,22 +1351,30 @@ void ViewMapBuilder::ComputeEdgesVisibility(ViewMap *ioViewMap, WingedEdge& we,
{
switch(iAlgo) {
case ray_casting:
- cout << "Using ordinary ray casting" << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "Using ordinary ray casting" << endl;
+ }
BuildGrid(we, bbox, sceneNumFaces);
ComputeRayCastingVisibility(ioViewMap, epsilon);
break;
case ray_casting_fast:
- cout << "Using fast ray casting" << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "Using fast ray casting" << endl;
+ }
BuildGrid(we, bbox, sceneNumFaces);
ComputeFastRayCastingVisibility(ioViewMap, epsilon);
break;
case ray_casting_very_fast:
- cout << "Using very fast ray casting" << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "Using very fast ray casting" << endl;
+ }
BuildGrid(we, bbox, sceneNumFaces);
ComputeVeryFastRayCastingVisibility(ioViewMap, epsilon);
break;
case ray_casting_culled_adaptive_traditional:
- cout << "Using culled adaptive grid with heuristic density and traditional QI calculation" << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "Using culled adaptive grid with heuristic density and traditional QI calculation" << endl;
+ }
try {
HeuristicGridDensityProviderFactory factory(0.5f, sceneNumFaces);
ComputeDetailedVisibility(ioViewMap, we, bbox, epsilon, true, factory);
@@ -1310,7 +1393,9 @@ void ViewMapBuilder::ComputeEdgesVisibility(ViewMap *ioViewMap, WingedEdge& we,
}
break;
case ray_casting_adaptive_traditional:
- cout << "Using unculled adaptive grid with heuristic density and traditional QI calculation" << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "Using unculled adaptive grid with heuristic density and traditional QI calculation" << endl;
+ }
try {
HeuristicGridDensityProviderFactory factory(0.5f, sceneNumFaces);
ComputeDetailedVisibility(ioViewMap, we, bbox, epsilon, false, factory);
@@ -1320,7 +1405,9 @@ void ViewMapBuilder::ComputeEdgesVisibility(ViewMap *ioViewMap, WingedEdge& we,
}
break;
case ray_casting_culled_adaptive_cumulative:
- cout << "Using culled adaptive grid with heuristic density and cumulative QI calculation" << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "Using culled adaptive grid with heuristic density and cumulative QI calculation" << endl;
+ }
try {
HeuristicGridDensityProviderFactory factory(0.5f, sceneNumFaces);
ComputeCumulativeVisibility(ioViewMap, we, bbox, epsilon, true, factory);
@@ -1330,7 +1417,9 @@ void ViewMapBuilder::ComputeEdgesVisibility(ViewMap *ioViewMap, WingedEdge& we,
}
break;
case ray_casting_adaptive_cumulative:
- cout << "Using unculled adaptive grid with heuristic density and cumulative QI calculation" << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "Using unculled adaptive grid with heuristic density and cumulative QI calculation" << endl;
+ }
try {
HeuristicGridDensityProviderFactory factory(0.5f, sceneNumFaces);
ComputeCumulativeVisibility(ioViewMap, we, bbox, epsilon, false, factory);
@@ -1379,7 +1468,9 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo
if (_pRenderMonitor && _pRenderMonitor->testBreak())
break;
#if LOGGING
- cout << "Processing ViewEdge " << (*ve)->getId() << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "Processing ViewEdge " << (*ve)->getId() << endl;
+ }
#endif
festart = (*ve)->fedgeA();
fe = (*ve)->fedgeA();
@@ -1390,7 +1481,9 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo
} while (fe && fe != festart);
qiMajority >>= 1;
#if LOGGING
- cout << "\tqiMajority: " << qiMajority << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tqiMajority: " << qiMajority << endl;
+ }
#endif
tmpQI = 0;
@@ -1405,7 +1498,9 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo
tmpQI = ComputeRayCastingVisibility(fe, _Grid, epsilon, occluders, &aFace, timestamp++);
#if LOGGING
- cout << "\tFEdge: visibility " << tmpQI << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFEdge: visibility " << tmpQI << endl;
+ }
#endif
//ARB: This is an error condition, not an alert condition.
// Some sort of recovery or abort is necessary.
@@ -1424,7 +1519,9 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo
//ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called
FindOccludee(fe, _Grid, epsilon, &aFace, timestamp++);
#if LOGGING
- cout << "\tFEdge: occludee only (" << (aFace != NULL ? "found" : "not found") << ")" << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFEdge: occludee only (" << (aFace != NULL ? "found" : "not found") << ")" << endl;
+ }
#endif
}
@@ -1433,7 +1530,9 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo
aFaces.push_back(aFace);
fe->setOccludeeEmpty(false);
#if LOGGING
- cout << "\tFound occludee" << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFound occludee" << endl;
+ }
#endif
}
else {
@@ -1447,7 +1546,9 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo
fe = fe->nextEdge();
} while ((maxCard < qiMajority) && (fe) && (fe != festart));
#if LOGGING
- cout << "\tFinished with " << nSamples << " samples, maxCard = " << maxCard << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFinished with " << nSamples << " samples, maxCard = " << maxCard << endl;
+ }
#endif
// ViewEdge
@@ -1457,7 +1558,9 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo
for (set<ViewShape*>::iterator o = occluders.begin(), oend = occluders.end(); o != oend; ++o)
(*ve)->AddOccluder((*o));
#if LOGGING
- cout << "\tConclusion: QI = " << maxIndex << ", " << (*ve)->occluders_size() << " occluders." << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tConclusion: QI = " << maxIndex << ", " << (*ve)->occluders_size() << " occluders." << endl;
+ }
#endif
// occludee --
if (!aFaces.empty()) {
@@ -1837,9 +1940,11 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, Grid *iGrid, real eps
real raylength = u.norm();
u.normalize();
#if 0
- cout << "grid origin " << iGrid->getOrigin().x() << "," << iGrid->getOrigin().y() << ","
- << iGrid->getOrigin().z() << endl;
- cout << "center " << center.x() << "," << center.y() << "," << center.z() << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "grid origin " << iGrid->getOrigin().x() << "," << iGrid->getOrigin().y() << ","
+ << iGrid->getOrigin().z() << endl;
+ cout << "center " << center.x() << "," << center.y() << "," << center.z() << endl;
+ }
#endif
iGrid->castRay(center, vp, occluders, timestamp);
@@ -1864,9 +1969,11 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, Grid *iGrid, real eps
//-----------
oface = (WFace*)(*p)->userdata;
#if LOGGING
- cout << "\t\tEvaluating intersection for occluder " << ((*p)->getVertices())[0] << ((*p)->getVertices())[1]
- << ((*p)->getVertices())[2] << endl << "\t\t\tand ray " << vp << " * " << u << " (center " << center
- << ")" << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tEvaluating intersection for occluder " << ((*p)->getVertices())[0] << ((*p)->getVertices())[1]
+ << ((*p)->getVertices())[2] << endl << "\t\t\tand ray " << vp << " * " << u << " (center " << center
+ << ")" << endl;
+ }
#endif
Vec3r v1(((*p)->getVertices())[0]);
Vec3r normal((*p)->getNormal());
@@ -1874,19 +1981,25 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, Grid *iGrid, real eps
real t, t_u, t_v;
#if LOGGING
- cout << "\t\tp: " << ((*p)->getVertices())[0] << ((*p)->getVertices())[1] << ((*p)->getVertices())[2]
- << ", norm: " << (*p)->getNormal() << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tp: " << ((*p)->getVertices())[0] << ((*p)->getVertices())[1] << ((*p)->getVertices())[2]
+ << ", norm: " << (*p)->getNormal() << endl;
+ }
#endif
if (face) {
#if LOGGING
- cout << "\t\tDetermining face adjacency...";
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tDetermining face adjacency...";
+ }
#endif
skipFace = false;
if (face == oface) {
#if LOGGING
- cout << " Rejecting occluder for face concurrency." << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << " Rejecting occluder for face concurrency." << endl;
+ }
#endif
continue;
}
@@ -1917,7 +2030,9 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, Grid *iGrid, real eps
}
if (skipFace) {
#if LOGGING
- cout << " Rejecting occluder for face adjacency." << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << " Rejecting occluder for face adjacency." << endl;
+ }
#endif
continue;
}
@@ -1929,7 +2044,9 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, Grid *iGrid, real eps
if (GeomUtils::COINCIDENT == GeomUtils::intersectRayPlane(origin, edge, normal, d, t, epsilon)) {
#if LOGGING
- cout << "\t\tRejecting occluder for target coincidence." << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tRejecting occluder for target coincidence." << endl;
+ }
#endif
continue;
}
@@ -1937,14 +2054,18 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, Grid *iGrid, real eps
if ((*p)->rayIntersect(center, u, t, t_u, t_v)) {
#if LOGGING
- cout << "\t\tRay " << vp << " * " << u << " intersects at time " << t << " (raylength is "
- << raylength << ")" << endl;
- cout << "\t\t(u * normal) == " << (u * normal) << " for normal " << normal << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tRay " << vp << " * " << u << " intersects at time " << t << " (raylength is "
+ << raylength << ")" << endl;
+ cout << "\t\t(u * normal) == " << (u * normal) << " for normal " << normal << endl;
+ }
#endif
if (fabs(u * normal) > 0.0001) {
if ((t>0.0) && (t<raylength)) {
#if LOGGING
- cout << "\t\tIs occluder" << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tIs occluder" << endl;
+ }
#endif
WFace *f = (WFace*)((*p)->userdata);
ViewShape *vshape = _ViewMap->viewShape(f->GetVertex(0)->shape()->GetId());
@@ -1979,11 +2100,13 @@ void ViewMapBuilder::ComputeIntersections(ViewMap *ioViewMap, intersection_algo
{
if ((*vv)->getNature() == Nature::T_VERTEX) {
TVertex *tvertex = (TVertex*)(*vv);
- cout << "TVertex " << tvertex->getId() << " has :" << endl;
- cout << "FrontEdgeA: " << tvertex->frontEdgeA().first << endl;
- cout << "FrontEdgeB: " << tvertex->frontEdgeB().first << endl;
- cout << "BackEdgeA: " << tvertex->backEdgeA().first << endl;
- cout << "BackEdgeB: " << tvertex->backEdgeB().first << endl << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "TVertex " << tvertex->getId() << " has :" << endl;
+ cout << "FrontEdgeA: " << tvertex->frontEdgeA().first << endl;
+ cout << "FrontEdgeB: " << tvertex->frontEdgeB().first << endl;
+ cout << "BackEdgeA: " << tvertex->backEdgeA().first << endl;
+ cout << "BackEdgeB: " << tvertex->backEdgeB().first << endl << endl;
+ }
}
}
}
@@ -2061,9 +2184,11 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi
unsigned sVerticesSize = svertices.size();
unsigned fEdgesSize = ioViewMap->FEdges().size();
#if 0
- ViewMap::fedges_container& fedges = ioViewMap->FEdges();
- for (ViewMap::fedges_container::const_iterator f = fedges.begin(), end = fedges.end(); f != end; ++f) {
- cout << (*f)->aMaterialIndex() << "-" << (*f)->bMaterialIndex() << endl;
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ ViewMap::fedges_container& fedges = ioViewMap->FEdges();
+ for (ViewMap::fedges_container::const_iterator f = fedges.begin(), end = fedges.end(); f != end; ++f) {
+ cout << (*f)->aMaterialIndex() << "-" << (*f)->bMaterialIndex() << endl;
+ }
}
#endif
unsigned progressBarStep = 0;
@@ -2184,17 +2309,19 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi
<< fB->vertexB()->getId() << endl;
#if 0
- if ((Ta < -epsilon) || (Ta > 1 + epsilon) || (Tb < -epsilon) || (Tb > 1 + epsilon)) {
- printf("ta %.12e\n", ta);
- printf("tb %.12e\n", tb);
- printf("a1 %e, %e -- b1 %e, %e\n", a1[0], a1[1], b1[0], b1[1]);
- printf("a2 %e, %e -- b2 %e, %e\n", a2[0], a2[1], b2[0], b2[1]);
- if ((Ta < -epsilon) || (Ta > 1 + epsilon))
- printf("Ta %.12e\n", Ta);
- if ((Tb < -epsilon) || (Tb > 1 + epsilon))
- printf("Tb %.12e\n", Tb);
- printf("A1 %e, %e, %e -- B1 %e, %e, %e\n", A1[0], A1[1], A1[2], B1[0], B1[1], B1[2]);
- printf("A2 %e, %e, %e -- B2 %e, %e, %e\n", A2[0], A2[1], A2[2], B2[0], B2[1], B2[2]);
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ if ((Ta < -epsilon) || (Ta > 1 + epsilon) || (Tb < -epsilon) || (Tb > 1 + epsilon)) {
+ printf("ta %.12e\n", ta);
+ printf("tb %.12e\n", tb);
+ printf("a1 %e, %e -- b1 %e, %e\n", a1[0], a1[1], b1[0], b1[1]);
+ printf("a2 %e, %e -- b2 %e, %e\n", a2[0], a2[1], b2[0], b2[1]);
+ if ((Ta < -epsilon) || (Ta > 1 + epsilon))
+ printf("Ta %.12e\n", Ta);
+ if ((Tb < -epsilon) || (Tb > 1 + epsilon))
+ printf("Tb %.12e\n", Tb);
+ printf("A1 %e, %e, %e -- B1 %e, %e, %e\n", A1[0], A1[1], A1[2], B1[0], B1[1], B1[2]);
+ printf("A2 %e, %e, %e -- B2 %e, %e, %e\n", A2[0], A2[1], A2[2], B2[0], B2[1], B2[2]);
+ }
}
#endif