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-03-11 10:56:51 +0400
committerTamito Kajiyama <rd6t-kjym@asahi-net.or.jp>2013-03-11 10:56:51 +0400
commit2d801f2bec3c4de663f33b0f0f198a12f09ef989 (patch)
treedfe16a3ca2213bd5b6579ed3bc2ac2902b678067 /source/blender/freestyle/intern/view_map
parent4a92d82626980d6d1690113b9d27aae282fd48eb (diff)
Another big code clean-up patch from Bastien Montagne, thanks again!
Diffstat (limited to 'source/blender/freestyle/intern/view_map')
-rw-r--r--source/blender/freestyle/intern/view_map/BoxGrid.cpp10
-rw-r--r--source/blender/freestyle/intern/view_map/BoxGrid.h114
-rw-r--r--source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp4
-rw-r--r--source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp37
-rw-r--r--source/blender/freestyle/intern/view_map/FEdgeXDetector.h6
-rw-r--r--source/blender/freestyle/intern/view_map/Functions0D.cpp4
-rw-r--r--source/blender/freestyle/intern/view_map/Functions1D.cpp2
-rw-r--r--source/blender/freestyle/intern/view_map/GridDensityProvider.h12
-rw-r--r--source/blender/freestyle/intern/view_map/Interface0D.h12
-rw-r--r--source/blender/freestyle/intern/view_map/OccluderSource.cpp7
-rw-r--r--source/blender/freestyle/intern/view_map/Silhouette.cpp6
-rw-r--r--source/blender/freestyle/intern/view_map/Silhouette.h26
-rw-r--r--source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h2
-rw-r--r--source/blender/freestyle/intern/view_map/SphericalGrid.cpp8
-rw-r--r--source/blender/freestyle/intern/view_map/SphericalGrid.h116
-rw-r--r--source/blender/freestyle/intern/view_map/SteerableViewMap.cpp20
-rw-r--r--source/blender/freestyle/intern/view_map/SteerableViewMap.h2
-rw-r--r--source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp22
-rw-r--r--source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h2
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMap.cpp15
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMap.h28
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h16
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp613
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapIO.cpp4
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapIO.h4
25 files changed, 551 insertions, 541 deletions
diff --git a/source/blender/freestyle/intern/view_map/BoxGrid.cpp b/source/blender/freestyle/intern/view_map/BoxGrid.cpp
index c83ab44a259..2be2fe2cb5a 100644
--- a/source/blender/freestyle/intern/view_map/BoxGrid.cpp
+++ b/source/blender/freestyle/intern/view_map/BoxGrid.cpp
@@ -83,9 +83,9 @@ BoxGrid::Iterator::Iterator (BoxGrid& grid, Vec3r& center, real epsilon)
_cell = grid.findCell(_target);
#if BOX_GRID_LOGGING
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;
+ cout << "Searching for occluders of edge centered at " << _target << " in cell [" <<
+ 1_cell->boundary[0] << ", " << _cell->boundary[1] << ", " << _cell->boundary[2] <<
+ ", " << _cell->boundary[3] << "] (" << _cell->faces.size() << " occluders)" << endl;
}
#endif
@@ -159,7 +159,7 @@ void BoxGrid::assignCells (OccluderSource& source, GridDensityProvider& density,
height = _cellSize;
// Initialize cell
- Cell* b = _cells[i * _cellsY + j] = new Cell();
+ Cell *b = _cells[i * _cellsY + j] = new Cell();
b->setDimensions(x, y, width, height);
}
}
@@ -211,7 +211,7 @@ void BoxGrid::getCellCoordinates(const Vec3r& point, unsigned& x, unsigned& y)
y = min(_cellsY - 1, (unsigned) floor (max((double) 0.0f, point[1] - _cellOrigin[1]) / _cellSize));
}
-BoxGrid::Cell* BoxGrid::findCell(const Vec3r& point)
+BoxGrid::Cell *BoxGrid::findCell(const Vec3r& point)
{
unsigned int x, y;
getCellCoordinates(point, x, y);
diff --git a/source/blender/freestyle/intern/view_map/BoxGrid.h b/source/blender/freestyle/intern/view_map/BoxGrid.h
index 50ca1622e99..22f3b6fa698 100644
--- a/source/blender/freestyle/intern/view_map/BoxGrid.h
+++ b/source/blender/freestyle/intern/view_map/BoxGrid.h
@@ -70,7 +70,7 @@ public:
// N.B. We could, of course, store face in poly's userdata member, like the old ViewMapBuilder code does.
// However, code comments make it clear that userdata is deprecated, so we avoid the temptation
// to save 4 or 8 bytes.
- WFace* face;
+ WFace *face;
};
private:
@@ -194,21 +194,21 @@ inline void BoxGrid::Iterator::initBeforeTarget()
inline void BoxGrid::Iterator::initAfterTarget()
{
if (_foundOccludee) {
- #if BOX_GRID_LOGGING
- if (G.debug & G_DEBUG_FREESTYLE) {
- std::cout << "\tStarting occludee search from occludeeCandidate at depth "
- << _occludeeDepth << std::endl;
- }
- #endif
+#if BOX_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 BOX_GRID_LOGGING
- if (G.debug & G_DEBUG_FREESTYLE) {
- std::cout << "\tStarting occludee search from current position" << std::endl;
- }
- #endif
+#if BOX_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;
@@ -223,23 +223,23 @@ inline bool BoxGrid::Iterator::testOccluder(bool wantOccludee)
// and _current = _cell->face.end() will make the calling routine give up.
return true;
}
- #if BOX_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 BOX_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 BOX_GRID_LOGGING
- if (G.debug & G_DEBUG_FREESTYLE) {
- std::cout << "\t\tAborting: shallowest > occludeeCandidate->deepest" << std::endl;
- }
- #endif
+#if BOX_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
@@ -249,21 +249,21 @@ inline bool BoxGrid::Iterator::testOccluder(bool wantOccludee)
// Specific continue or stop conditions when searching for each type
if (wantOccludee) {
if ((*_current)->deepest < _target[2]) {
- #if BOX_GRID_LOGGING
- if (G.debug & G_DEBUG_FREESTYLE) {
- std::cout << "\t\tSkipping: shallower than target while looking for occludee" << std::endl;
- }
- #endif
+#if BOX_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 BOX_GRID_LOGGING
- if (G.debug & G_DEBUG_FREESTYLE) {
- std::cout << "\t\tStopping: deeper than target while looking for occluder" << std::endl;
- }
- #endif
+#if BOX_GRID_LOGGING
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ std::cout << "\t\tStopping: deeper than target while looking for occluder" << std::endl;
+ }
+#endif
return true;
}
}
@@ -274,11 +274,11 @@ inline bool BoxGrid::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 BOX_GRID_LOGGING
- if (G.debug & G_DEBUG_FREESTYLE) {
- std::cout << "\t\tSkipping: bounding box violation" << std::endl;
- }
- #endif
+#if BOX_GRID_LOGGING
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ std::cout << "\t\tSkipping: bounding box violation" << std::endl;
+ }
+#endif
return false;
}
@@ -298,22 +298,22 @@ inline void BoxGrid::Iterator::reportDepth(Vec3r origin, Vec3r u, real t)
}
#endif
if (depth > _target[2]) {
- #if BOX_GRID_LOGGING
- if (G.debug & G_DEBUG_FREESTYLE) {
- std::cout << " is deeper than target" << std::endl;
- }
- #endif
+#if BOX_GRID_LOGGING
+ 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) {
markCurrentOccludeeCandidate(depth);
}
}
else {
- #if BOX_GRID_LOGGING
- if (G.debug & G_DEBUG_FREESTYLE) {
- std::cout << std::endl;
- }
- #endif
+#if BOX_GRID_LOGGING
+ if (G.debug & G_DEBUG_FREESTYLE) {
+ std::cout << std::endl;
+ }
+#endif
}
}
@@ -347,22 +347,22 @@ inline bool BoxGrid::Iterator::validAfterTarget()
inline void BoxGrid::Iterator::markCurrentOccludeeCandidate(real depth)
{
- #if BOX_GRID_LOGGING
- if (G.debug & G_DEBUG_FREESTYLE) {
- std::cout << "\t\tFound occludeeCandidate at depth " << depth << std::endl;
- }
- #endif
+#if BOX_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;
}
-inline WFace* BoxGrid::Iterator::getWFace() const
+inline WFace *BoxGrid::Iterator::getWFace() const
{
return (*_current)->face;
}
-inline Polygon3r* BoxGrid::Iterator::getCameraSpacePolygon()
+inline Polygon3r *BoxGrid::Iterator::getCameraSpacePolygon()
{
return &((*_current)->cameraSpacePolygon);
}
diff --git a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp
index 2c9a9def4fc..53bd76b81f2 100644
--- a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp
+++ b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp
@@ -127,8 +127,8 @@ void CulledOccluderSource::cullViewEdges(ViewMap& viewMap, bool extensiveFEdgeSe
prosceniumOrigin[1] = (viewProscenium[3] - viewProscenium[2]) / 2.0;
if (G.debug & G_DEBUG_FREESTYLE) {
cout << "Proscenium culling:" << endl;
- cout << "Proscenium: [" << viewProscenium[0] << ", " << viewProscenium[1] << ", " << viewProscenium[2]
- << ", " << viewProscenium[3] << "]"<< endl;
+ cout << "Proscenium: [" << viewProscenium[0] << ", " << viewProscenium[1] << ", " << viewProscenium[2] <<
+ ", " << viewProscenium[3] << "]"<< endl;
cout << "Origin: [" << prosceniumOrigin[0] << ", " << prosceniumOrigin[1] << "]"<< endl;
}
diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
index 2ded242e9ea..e95bbe44627 100644
--- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
+++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp
@@ -129,7 +129,7 @@ void FEdgeXDetector::preProcessShape(WXShape *iWShape)
vector<WFace*>::iterator f, fend;
// view dependant stuff
for (f = wfaces.begin(), fend = wfaces.end(); f != fend; ++f) {
- preProcessFace((WXFace*)(*f));
+ preProcessFace((WXFace *)(*f));
}
if (_computeRidgesAndValleys || _computeSuggestiveContours) {
@@ -257,14 +257,14 @@ void FEdgeXDetector::processSilhouetteShape(WXShape *iWShape)
vector<WFace*>& wfaces = iWShape->GetFaceList();
vector<WFace*>::iterator f, fend;
for (f = wfaces.begin(), fend = wfaces.end(); f != fend; ++f) {
- ProcessSilhouetteFace((WXFace*)(*f));
+ ProcessSilhouetteFace((WXFace *)(*f));
}
// Make a pass on the edges to detect the silhouette edges that are not smooth
vector<WEdge*>::iterator we, weend;
vector<WEdge*> &wedges = iWShape->getEdgeList();
for (we = wedges.begin(), weend = wedges.end(); we != weend; ++we) {
- ProcessSilhouetteEdge((WXEdge*)(*we));
+ ProcessSilhouetteEdge((WXEdge *)(*we));
}
}
@@ -321,8 +321,8 @@ void FEdgeXDetector::ProcessSilhouetteEdge(WXEdge *iEdge)
WXFace *fB = (WXFace *)iEdge->GetaOEdge()->GetbFace();
if ((fA->front()) ^ (fB->front())) { // fA->visible XOR fB->visible (true if one is 0 and the other is 1)
- // The only edges we want to set as silhouette edges in this way are the ones with 2 different normals for 1 vertex
- // for these two faces
+ // The only edges we want to set as silhouette edges in this way are the ones with 2 different normals
+ // for 1 vertex for these two faces
//--------------------
// In reality we only test the normals for 1 of the 2 vertices.
if (fA->GetVertexNormal(iEdge->GetaVertex()) == fB->GetVertexNormal(iEdge->GetaVertex()))
@@ -403,7 +403,7 @@ void FEdgeXDetector::processRidgesAndValleysShape(WXShape *iWShape)
vector<WFace*>& wfaces = iWShape->GetFaceList();
vector<WFace*>::iterator f, fend;
for (f = wfaces.begin(), fend = wfaces.end(); f != fend; ++f) {
- ProcessRidgeFace((WXFace*)(*f));
+ ProcessRidgeFace((WXFace *)(*f));
}
}
@@ -412,7 +412,7 @@ void FEdgeXDetector::processRidgesAndValleysShape(WXShape *iWShape)
/////////
void FEdgeXDetector::ProcessRidgeFace(WXFace *iFace)
{
- WXFaceLayer *flayer = new WXFaceLayer(iFace, Nature::RIDGE|Nature::VALLEY, false);
+ WXFaceLayer *flayer = new WXFaceLayer(iFace, Nature::RIDGE | Nature::VALLEY, false);
iFace->AddSmoothLayer(flayer);
unsigned int numVertices = iFace->numberOfVertices();
@@ -549,7 +549,7 @@ void FEdgeXDetector::processSuggestiveContourShape(WXShape *iWShape)
vector<WFace*>& wfaces = iWShape->GetFaceList();
vector<WFace*>::iterator f, fend;
for (f = wfaces.begin(), fend = wfaces.end(); f != fend; ++f) {
- ProcessSuggestiveContourFace((WXFace*)(*f));
+ ProcessSuggestiveContourFace((WXFace *)(*f));
}
}
@@ -583,13 +583,14 @@ void FEdgeXDetector::postProcessSuggestiveContourShape(WXShape *iShape)
vector<WFace*>& wfaces = iShape->GetFaceList();
vector<WFace*>::iterator f, fend;
for (f = wfaces.begin(), fend = wfaces.end(); f != fend; ++f) {
- postProcessSuggestiveContourFace((WXFace*)(*f));
+ postProcessSuggestiveContourFace((WXFace *)(*f));
}
}
void FEdgeXDetector::postProcessSuggestiveContourFace(WXFace *iFace)
{
- // Compute the derivative of the radial curvature in the radial direction, at the two extremities of the smooth edge.
+ // Compute the derivative of the radial curvature in the radial direction, at the two extremities
+ // of the smooth edge.
// If the derivative is smaller than a given threshold _kr_derivative_epsilon, discard the edge.
// Find the suggestive contour layer of the face (zero or one edge).
@@ -613,7 +614,7 @@ void FEdgeXDetector::postProcessSuggestiveContourFace(WXFace *iFace)
real kr(0), kr1(0), kr2(0), t;
for (unsigned int i = 0; i < vertices_nb; ++i) {
- v = (WXVertex*)(iFace->GetVertex(i));
+ v = (WXVertex *)(iFace->GetVertex(i));
// v is a singular vertex, skip it.
if (v->isBoundary()) {
@@ -695,7 +696,7 @@ void FEdgeXDetector::processMaterialBoundaryShape(WXShape *iWShape)
vector<WEdge*>::iterator we, weend;
vector<WEdge*> &wedges = iWShape->getEdgeList();
for (we = wedges.begin(), weend = wedges.end(); we != weend; ++we) {
- ProcessMaterialBoundaryEdge((WXEdge*)(*we));
+ ProcessMaterialBoundaryEdge((WXEdge *)(*we));
}
}
@@ -717,7 +718,7 @@ void FEdgeXDetector::processEdgeMarksShape(WXShape *iShape)
vector<WEdge*>::iterator we, weend;
vector<WEdge*> &wedges = iShape->getEdgeList();
for (we = wedges.begin(), weend = wedges.end(); we != weend; ++we) {
- ProcessEdgeMarks((WXEdge*)(*we));
+ ProcessEdgeMarks((WXEdge *)(*we));
}
}
@@ -737,9 +738,9 @@ void FEdgeXDetector::buildSmoothEdges(WXShape *iShape)
// Make a last pass to build smooth edges from the previous stored values:
//--------------------------------------------------------------------------
vector<WFace*>& wfaces = iShape->GetFaceList();
- for (vector<WFace*>::iterator f = wfaces.begin(), fend = wfaces.end(); f != fend; ++f) {
- vector<WXFaceLayer*>& faceLayers = ((WXFace*)(*f))->getSmoothLayers();
- for (vector<WXFaceLayer*>::iterator wxfl = faceLayers.begin(), wxflend = faceLayers.end();
+ for (vector<WFace *>::iterator f = wfaces.begin(), fend = wfaces.end(); f != fend; ++f) {
+ vector<WXFaceLayer *>& faceLayers = ((WXFace *)(*f))->getSmoothLayers();
+ for (vector<WXFaceLayer *>::iterator wxfl = faceLayers.begin(), wxflend = faceLayers.end();
wxfl != wxflend;
++wxfl)
{
@@ -749,10 +750,10 @@ void FEdgeXDetector::buildSmoothEdges(WXShape *iShape)
}
if (hasSmoothEdges && !_computeRidgesAndValleys && !_computeSuggestiveContours) {
- vector<WVertex*>& wvertices = iShape->getVertexList();
+ vector<WVertex *>& wvertices = iShape->getVertexList();
for (vector<WVertex*>::iterator wv = wvertices.begin(), wvend = wvertices.end(); wv != wvend; ++wv) {
// Compute curvatures
- WXVertex *wxv = dynamic_cast<WXVertex*>(*wv);
+ WXVertex *wxv = dynamic_cast<WXVertex *>(*wv);
computeCurvatures(wxv);
}
_meanK1 /= (real)(_nPoints);
diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
index 1b211264402..5df9423b4cf 100644
--- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
+++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h
@@ -174,7 +174,7 @@ public:
{
if (b != _faceSmoothness) {
_faceSmoothness = b;
- _changes=true;
+ _changes = true;
}
}
@@ -182,7 +182,7 @@ public:
{
if (b != _faceMarks) {
_faceMarks = b;
- _changes=true;
+ _changes = true;
}
}
@@ -194,7 +194,7 @@ public:
{
if (r != _sphereRadius) {
_sphereRadius = r;
- _changes=true;
+ _changes = true;
}
}
diff --git a/source/blender/freestyle/intern/view_map/Functions0D.cpp b/source/blender/freestyle/intern/view_map/Functions0D.cpp
index 9e8557b0fd3..527d67cee2a 100644
--- a/source/blender/freestyle/intern/view_map/Functions0D.cpp
+++ b/source/blender/freestyle/intern/view_map/Functions0D.cpp
@@ -302,9 +302,9 @@ int MaterialF0D::operator()(Interface0DIterator& iter)
if (fe1 == NULL)
return -1;
if (fe1->isSmooth())
- result = ((FEdgeSmooth*)fe1)->frs_material();
+ result = ((FEdgeSmooth *)fe1)->frs_material();
else
- result = ((FEdgeSharp*)fe1)->bFrsMaterial();
+ result = ((FEdgeSharp *)fe1)->bFrsMaterial();
#if 0
const SShape *sshape = getShapeF0D(iter);
return sshape->material();
diff --git a/source/blender/freestyle/intern/view_map/Functions1D.cpp b/source/blender/freestyle/intern/view_map/Functions1D.cpp
index f17a568ffee..e8f18fe8077 100644
--- a/source/blender/freestyle/intern/view_map/Functions1D.cpp
+++ b/source/blender/freestyle/intern/view_map/Functions1D.cpp
@@ -155,7 +155,7 @@ int IncrementChainingTimeStampF1D::operator()(Interface1D& inter)
{
ViewEdge *ve = dynamic_cast<ViewEdge*>(&inter);
if (ve)
- ve->setChainingTimeStamp(ve->getChainingTimeStamp()+1);
+ ve->setChainingTimeStamp(ve->getChainingTimeStamp() + 1);
return 0;
}
diff --git a/source/blender/freestyle/intern/view_map/GridDensityProvider.h b/source/blender/freestyle/intern/view_map/GridDensityProvider.h
index 5fe7d095358..930bb0af200 100644
--- a/source/blender/freestyle/intern/view_map/GridDensityProvider.h
+++ b/source/blender/freestyle/intern/view_map/GridDensityProvider.h
@@ -93,8 +93,8 @@ public:
}
}
if (G.debug & G_DEBUG_FREESTYLE) {
- cout << "Proscenium: (" << proscenium[0] << ", " << proscenium[1] << ", " << proscenium[2]
- << ", " << proscenium[3] << ")" << endl;
+ cout << "Proscenium: (" << proscenium[0] << ", " << proscenium[1] << ", " << proscenium[2] <<
+ ", " << proscenium[3] << ")" << endl;
}
}
@@ -118,8 +118,8 @@ public:
proscenium[3] = std::max(minPoint[1], maxPoint[1]);
if (G.debug & G_DEBUG_FREESTYLE) {
cout << "Bounding box: " << minPoint << " to " << maxPoint << endl;
- cout << "Proscenium : " << proscenium[0] << ", " << proscenium[1] << ", " << proscenium[2] << ", "
- << proscenium[3] << endl;
+ cout << "Proscenium : " << proscenium[0] << ", " << proscenium[1] << ", " << proscenium[2] << ", " <<
+ proscenium[3] << endl;
}
}
@@ -133,8 +133,8 @@ protected:
class GridDensityProviderFactory
{
// Disallow copying and assignment
- GridDensityProviderFactory (const GridDensityProviderFactory& other);
- GridDensityProviderFactory& operator= (const GridDensityProviderFactory& other);
+ GridDensityProviderFactory(const GridDensityProviderFactory& other);
+ GridDensityProviderFactory& operator=(const GridDensityProviderFactory& other);
public:
GridDensityProviderFactory() {}
diff --git a/source/blender/freestyle/intern/view_map/Interface0D.h b/source/blender/freestyle/intern/view_map/Interface0D.h
index bbf93deadb7..f7c814a63d8 100644
--- a/source/blender/freestyle/intern/view_map/Interface0D.h
+++ b/source/blender/freestyle/intern/view_map/Interface0D.h
@@ -133,7 +133,7 @@ public:
}
/*! Returns the FEdge that lies between this Interface0D and the Interface0D given as argument. */
- virtual FEdge* getFEdge(Interface0D&)
+ virtual FEdge *getFEdge(Interface0D&)
{
PyErr_SetString(PyExc_TypeError, "method getFEdge() not properly overridden");
return 0;
@@ -162,7 +162,7 @@ public:
}
/*! Cast the Interface0D in ViewVertex if it can be. */
- virtual ViewVertex * castToViewVertex()
+ virtual ViewVertex *castToViewVertex()
{
PyErr_SetString(PyExc_TypeError, "method castToViewVertex() not properly overridden");
return 0;
@@ -201,7 +201,7 @@ public:
virtual Interface0D& operator*() = 0;
- virtual Interface0D* operator->()
+ virtual Interface0D *operator->()
{
return &(operator*());
}
@@ -227,7 +227,7 @@ public:
/*! Returns the point parameter 0<u<1 */
virtual float u() const = 0;
- virtual Interface0DIteratorNested* copy() const = 0;
+ virtual Interface0DIteratorNested *copy() const = 0;
};
@@ -245,7 +245,7 @@ public:
class Interface0DIterator : public Iterator
{
public:
- Interface0DIterator(Interface0DIteratorNested* it = NULL)
+ Interface0DIterator(Interface0DIteratorNested *it = NULL)
{
_iterator = it;
}
@@ -270,7 +270,7 @@ public:
*/
Interface0DIterator& operator=(const Interface0DIterator& it)
{
- if(_iterator)
+ if (_iterator)
delete _iterator;
_iterator = it._iterator->copy();
return *this;
diff --git a/source/blender/freestyle/intern/view_map/OccluderSource.cpp b/source/blender/freestyle/intern/view_map/OccluderSource.cpp
index 0cbad57b44a..b9fd5a3ebff 100644
--- a/source/blender/freestyle/intern/view_map/OccluderSource.cpp
+++ b/source/blender/freestyle/intern/view_map/OccluderSource.cpp
@@ -76,7 +76,8 @@ void OccluderSource::begin()
}
}
-bool OccluderSource::next() {
+bool OccluderSource::next()
+{
if (valid) {
++currentFace;
while (currentFace == facesEnd) {
@@ -130,8 +131,8 @@ void OccluderSource::getOccluderProscenium(real proscenium[4])
next();
}
if (G.debug & G_DEBUG_FREESTYLE) {
- cout << "Proscenium: (" << proscenium[0] << ", " << proscenium[1] << ", " << proscenium[2] << ", "
- << proscenium[3] << ")" << endl;
+ cout << "Proscenium: (" << proscenium[0] << ", " << proscenium[1] << ", " << proscenium[2] << ", " <<
+ proscenium[3] << ")" << endl;
}
}
diff --git a/source/blender/freestyle/intern/view_map/Silhouette.cpp b/source/blender/freestyle/intern/view_map/Silhouette.cpp
index 104040fd2a5..f71c58c320c 100644
--- a/source/blender/freestyle/intern/view_map/Silhouette.cpp
+++ b/source/blender/freestyle/intern/view_map/Silhouette.cpp
@@ -173,7 +173,9 @@ FEdge *SVertex::getFEdge(Interface0D& inter)
for (; fe != feend; ++fe) {
if ((((*fe)->vertexA() == this) && ((*fe)->vertexB() == iVertexB)) ||
(((*fe)->vertexB() == this) && ((*fe)->vertexA() == iVertexB)))
+ {
result = (*fe);
+ }
}
if ((result == 0) && (getNature() & Nature::T_VERTEX)) {
SVertex *brother;
@@ -187,7 +189,9 @@ FEdge *SVertex::getFEdge(Interface0D& inter)
for (fe = fedges.begin(), feend = fedges.end(); fe != feend; ++fe) {
if ((((*fe)->vertexA() == brother) && ((*fe)->vertexB() == iVertexB)) ||
(((*fe)->vertexB() == brother) && ((*fe)->vertexA() == iVertexB)))
+ {
result = (*fe);
+ }
}
}
}
@@ -202,7 +206,9 @@ FEdge *SVertex::getFEdge(Interface0D& inter)
for (fe = _FEdges.begin(), feend = _FEdges.end(); fe != feend; ++fe) {
if ((((*fe)->vertexA() == this) && ((*fe)->vertexB() == brother)) ||
(((*fe)->vertexB() == this) && ((*fe)->vertexA() == brother)))
+ {
result = (*fe);
+ }
}
}
}
diff --git a/source/blender/freestyle/intern/view_map/Silhouette.h b/source/blender/freestyle/intern/view_map/Silhouette.h
index 2efe111add5..8f37532191e 100644
--- a/source/blender/freestyle/intern/view_map/Silhouette.h
+++ b/source/blender/freestyle/intern/view_map/Silhouette.h
@@ -377,8 +377,8 @@ public:
/* replaces edge 1 by edge 2 in the list of edges */
inline void Replace(FEdge *e1, FEdge *e2)
{
- vector<FEdge*>::iterator insertedfe;
- for (vector<FEdge*>::iterator fe = _FEdges.begin(),fend = _FEdges.end(); fe != fend; fe++) {
+ vector<FEdge *>::iterator insertedfe;
+ for (vector<FEdge *>::iterator fe = _FEdges.begin(), fend = _FEdges.end(); fe != fend; fe++) {
if ((*fe) == e1) {
insertedfe = _FEdges.insert(fe, e2);// inserts e2 before fe.
// returns an iterator pointing toward e2. fe is invalidated.
@@ -591,13 +591,13 @@ public:
}
/*! Returns the second SVertex. */
- inline SVertex* vertexB()
+ inline SVertex *vertexB()
{
return _VertexB;
}
/*! Returns the first SVertex if i=0, the seccond SVertex if i=1. */
- inline SVertex* operator[](const unsigned short int& i) const
+ inline SVertex *operator[](const unsigned short int& i) const
{
return (i % 2 == 0) ? _VertexA : _VertexB;
}
@@ -1429,7 +1429,7 @@ public:
vector<FEdge*>::iterator fe, fend;
vector<FEdge*>& fedges = iBrother.getChains();
for (fe = fedges.begin(), fend = fedges.end(); fe != fend; fe++) {
- _chains.push_back((FEdge*)((*fe)->userdata));
+ _chains.push_back((FEdge *)((*fe)->userdata));
}
//-------------------------
@@ -1443,7 +1443,7 @@ public:
fed++)
{
FEdge *current = *fed;
- newfedgelist.push_back((FEdge*)current->userdata);
+ newfedgelist.push_back((FEdge *)current->userdata);
}
(*sv)->setFEdges(newfedgelist);
}
@@ -1452,10 +1452,10 @@ public:
// remap vertices and nextedge in edges:
//-------------------------------------
for (e = _edgesList.begin(), eend = _edgesList.end(); e != eend; e++) {
- (*e)->setVertexA((SVertex*)((*e)->vertexA()->userdata));
- (*e)->setVertexB((SVertex*)((*e)->vertexB()->userdata));
- (*e)->setNextEdge((FEdge*)((*e)->nextEdge()->userdata));
- (*e)->setPreviousEdge((FEdge*)((*e)->previousEdge()->userdata));
+ (*e)->setVertexA((SVertex *)((*e)->vertexA()->userdata));
+ (*e)->setVertexB((SVertex *)((*e)->vertexB()->userdata));
+ (*e)->setNextEdge((FEdge *)((*e)->nextEdge()->userdata));
+ (*e)->setPreviousEdge((FEdge *)((*e)->previousEdge()->userdata));
}
// reset all brothers userdata to NULL:
@@ -1476,7 +1476,7 @@ public:
}
/*! Cloning method. */
- virtual SShape * duplicate()
+ virtual SShape *duplicate()
{
SShape *clone = new SShape(*this);
return clone;
@@ -1564,7 +1564,7 @@ public:
Vec3r a = ioA->point2D();
Vec3r b = ioB->point2D();
- Vec3r newpoint3d,newpoint2d;
+ Vec3r newpoint3d, newpoint2d;
vector<SVertex*> intersections;
real t, T;
for (vector<Vec2r>::const_iterator p = iParameters.begin(), pend = iParameters.end(); p != pend; p++) {
@@ -1709,7 +1709,7 @@ public:
ioEdge->setVertexB(ioNewVertex);
if (ioEdge->isSmooth()) {
- ((FEdgeSmooth*)newEdge)->setFace(((FEdgeSmooth*)ioEdge)->face());
+ ((FEdgeSmooth *)newEdge)->setFace(((FEdgeSmooth *)ioEdge)->face());
}
return newEdge;
diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h
index d6ee159fe88..f1c6b25c49e 100644
--- a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h
+++ b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h
@@ -80,7 +80,7 @@ public:
/*! retrieves an instance on the singleton */
static SilhouetteGeomEngine *getInstance()
{
- if(0 == _pInstance) {
+ if (_pInstance == NULL) {
_pInstance = new SilhouetteGeomEngine;
}
return _pInstance;
diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp
index 4582fb40b61..2cd8e5ebe66 100644
--- a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp
+++ b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp
@@ -84,9 +84,9 @@ SphericalGrid::Iterator::Iterator(SphericalGrid& grid, Vec3r& center, real epsil
_cell = grid.findCell(_target);
#if SPHERICAL_GRID_LOGGING
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;
+ 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
@@ -157,7 +157,7 @@ void SphericalGrid::assignCells(OccluderSource& source, GridDensityProvider& den
height = _cellSize;
// Initialize cell
- Cell* b = _cells[i * _cellsY + j] = new Cell();
+ Cell *b = _cells[i * _cellsY + j] = new Cell();
b->setDimensions(x, y, width, height);
}
}
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;
diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
index 120ef46667b..98345b396f4 100644
--- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
+++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
@@ -25,7 +25,7 @@
* ***** END GPL LICENSE BLOCK *****
*/
-/** \file blender/freestyle/intern/view_map/SteerbaleViewMap.cpp
+/** \file blender/freestyle/intern/view_map/SteerableViewMap.cpp
* \ingroup freestyle
* \brief Convenient access to the steerable ViewMap to which any element of the ViewMap belongs to.
* \author Stephane Grabli
@@ -57,7 +57,7 @@ using namespace Geometry;
SteerableViewMap::SteerableViewMap(unsigned int nbOrientations)
{
_nbOrientations = nbOrientations;
- _bound = cos(M_PI/(float)_nbOrientations);
+ _bound = cos(M_PI / (float)_nbOrientations);
for (unsigned int i = 0; i < _nbOrientations; ++i) {
_directions.push_back(Vec2d(cos((float)i * M_PI / (float)_nbOrientations),
sin((float)i * M_PI / (float)_nbOrientations)));
@@ -67,7 +67,7 @@ SteerableViewMap::SteerableViewMap(unsigned int nbOrientations)
void SteerableViewMap::Build()
{
- _imagesPyramids = new ImagePyramid * [_nbOrientations + 1]; // one more map to store the complete visible VM
+ _imagesPyramids = new ImagePyramid *[_nbOrientations + 1]; // one more map to store the complete visible VM
memset((_imagesPyramids), 0, (_nbOrientations + 1) * sizeof(ImagePyramid *));
}
@@ -78,7 +78,7 @@ SteerableViewMap::SteerableViewMap(const SteerableViewMap& iBrother)
_bound = iBrother._bound;
_directions = iBrother._directions;
_mapping = iBrother._mapping;
- _imagesPyramids = new ImagePyramid * [_nbOrientations + 1]; // one more map to store the complete visible VM
+ _imagesPyramids = new ImagePyramid *[_nbOrientations + 1]; // one more map to store the complete visible VM
for (i = 0; i < _nbOrientations + 1; ++i)
_imagesPyramids[i] = new GaussianPyramid(*(dynamic_cast<GaussianPyramid*>(iBrother._imagesPyramids[i])));
}
@@ -128,7 +128,7 @@ double *SteerableViewMap::AddFEdge(FEdge *iFEdge)
{
unsigned i;
unsigned id = iFEdge->getId().getFirst();
- map<unsigned int, double* >::iterator o = _mapping.find(id);
+ map<unsigned int, double *>::iterator o = _mapping.find(id);
if (o != _mapping.end()) {
return (*o).second;
}
@@ -174,7 +174,7 @@ unsigned SteerableViewMap::getSVMNumber(const Vec2f& orient)
unsigned SteerableViewMap::getSVMNumber(unsigned id)
{
- map<unsigned int, double* >::iterator o = _mapping.find(id);
+ map<unsigned int, double *>::iterator o = _mapping.find(id);
if (o != _mapping.end()) {
double *wvalues = (*o).second;
double maxw = 0.0;
@@ -241,8 +241,8 @@ void SteerableViewMap::saveSteerableViewMap() const
{
for (unsigned int i = 0; i <= _nbOrientations; ++i) {
if (_imagesPyramids[i] == 0) {
- cerr << "SteerableViewMap warning: orientation " << i
- << " of steerable View Map whas not been computed yet" << endl;
+ cerr << "SteerableViewMap warning: orientation " << i <<
+ " of steerable View Map whas not been computed yet" << endl;
continue;
}
int ow = _imagesPyramids[i]->width(0);
@@ -267,8 +267,8 @@ void SteerableViewMap::saveSteerableViewMap() const
//int c = (int)(_imagesPyramids[i]->pixel(x, y, j));
//soc qtmp.setPixel(x, y, qRgb(c, c, c));
- pix = (char*)ibuf->rect + y * rowbytes + x * 4;
- pix[0] = pix [1] = pix[2] = c;
+ pix = (char *)ibuf->rect + y * rowbytes + x * 4;
+ pix[0] = pix[1] = pix[2] = c;
}
}
diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.h b/source/blender/freestyle/intern/view_map/SteerableViewMap.h
index a4a67c3fa7e..28504350ac5 100644
--- a/source/blender/freestyle/intern/view_map/SteerableViewMap.h
+++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.h
@@ -28,7 +28,7 @@
#ifndef __FREESTYLE_STEERABLE_VIEW_MAP_H__
#define __FREESTYLE_STEERABLE_VIEW_MAP_H__
-/** \file blender/freestyle/intern/view_map/SteerbaleViewMap.h
+/** \file blender/freestyle/intern/view_map/SteerableViewMap.h
* \ingroup freestyle
* \brief Convenient access to the steerable ViewMap to which any element of the ViewMap belongs to.
* \author Stephane Grabli
diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
index 56c32d8e134..537688e4c44 100644
--- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp
@@ -203,8 +203,8 @@ ViewEdge *ViewEdgeXBuilder::BuildSmoothViewEdge(const OWXFaceLayer& iFaceLayer)
ViewVertex *vva = MakeViewVertex(fefirst->vertexA());
ViewVertex *vvb = MakeViewVertex(fe->vertexB());
- ((NonTVertex*)vva)->AddOutgoingViewEdge(newVEdge);
- ((NonTVertex*)vvb)->AddIncomingViewEdge(newVEdge);
+ ((NonTVertex *)vva)->AddOutgoingViewEdge(newVEdge);
+ ((NonTVertex *)vvb)->AddIncomingViewEdge(newVEdge);
newVEdge->setA(vva);
newVEdge->setB(vvb);
@@ -284,8 +284,8 @@ ViewEdge *ViewEdgeXBuilder::BuildSharpViewEdge(const OWXEdge& iWEdge)
ViewVertex *vva = MakeViewVertex(fefirst->vertexA());
ViewVertex *vvb = MakeViewVertex(fe->vertexB());
- ((NonTVertex*)vva)->AddOutgoingViewEdge(newVEdge);
- ((NonTVertex*)vvb)->AddIncomingViewEdge(newVEdge);
+ ((NonTVertex *)vva)->AddOutgoingViewEdge(newVEdge);
+ ((NonTVertex *)vvb)->AddIncomingViewEdge(newVEdge);
newVEdge->setA(vva);
newVEdge->setB(vvb);
@@ -345,7 +345,7 @@ OWXFaceLayer ViewEdgeXBuilder::FindNextFaceLayer(const OWXFaceLayer& iFaceLayer)
return OWXFaceLayer(NULL, true);
// if the next face layer has either no smooth edge or no smooth edge of same nature, no next face
if (!nextFace->hasSmoothEdges())
- return OWXFaceLayer(NULL,true);
+ return OWXFaceLayer(NULL, true);
vector<WXFaceLayer*> sameNatureLayers;
nextFace->retrieveSmoothEdgesLayers(iFaceLayer.fl->nature(), sameNatureLayers);
// don't know how to deal with several edges of same nature on a single face
@@ -394,7 +394,7 @@ OWXFaceLayer ViewEdgeXBuilder::FindPreviousFaceLayer(const OWXFaceLayer& iFaceLa
WVertex::face_iterator fend = previousVertex->faces_end();
for (; (!found) && (f != fend); ++f) {
previousFace = dynamic_cast<WXFace*>(*f);
- if ((0 != previousFace) && (previousFace!=iFaceLayer.fl->getFace())) {
+ if ((0 != previousFace) && (previousFace != iFaceLayer.fl->getFace())) {
vector<WXFaceLayer*> sameNatureLayers;
previousFace->retrieveSmoothEdgesLayers(iFaceLayer.fl->nature(), sameNatureLayers);
// don't know... Maybe should test whether this face has also a vertex_edge configuration
@@ -562,7 +562,7 @@ OWXEdge ViewEdgeXBuilder::FindNextWEdge(const OWXEdge& iEdge)
else
v = iEdge.e->GetaVertex();
- if (((WXVertex*)v)->isFeature())
+ if (((WXVertex *)v)->isFeature())
return 0; /* XXX eeek? NULL? OWXEdge(NULL, true/false)?*/
int faceMarks = retrieveFaceMarks(iEdge.e);
@@ -605,13 +605,13 @@ OWXEdge ViewEdgeXBuilder::FindPreviousWEdge(const OWXEdge& iEdge)
else
v = iEdge.e->GetbVertex();
- if (((WXVertex*)v)->isFeature())
+ if (((WXVertex *)v)->isFeature())
return 0;
int faceMarks = retrieveFaceMarks(iEdge.e);
- vector<WEdge*>& vEdges = (v)->GetEdges();
- for (vector<WEdge*>::iterator ve = vEdges.begin(), veend = vEdges.end(); ve != veend; ve++) {
- WXEdge *wxe = dynamic_cast<WXEdge*>(*ve);
+ vector<WEdge *>& vEdges = (v)->GetEdges();
+ for (vector<WEdge *>::iterator ve = vEdges.begin(), veend = vEdges.end(); ve != veend; ve++) {
+ WXEdge *wxe = dynamic_cast<WXEdge *>(*ve);
if (wxe == iEdge.e)
continue; // same edge as the one processed
diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h
index 2883919a852..024ab7eac5f 100644
--- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h
+++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h
@@ -86,7 +86,7 @@ struct epsilonEquals
// typedef hash_map<Vec3r, SVertex*, SVertexHasher, epsilonEquals> SVertexMap;
-typedef map<Vec3r , SVertex*> SVertexMap;
+typedef map<Vec3r, SVertex *> SVertexMap;
class WXFaceLayer;
diff --git a/source/blender/freestyle/intern/view_map/ViewMap.cpp b/source/blender/freestyle/intern/view_map/ViewMap.cpp
index 9f8b5e08200..7f8c797b5b9 100644
--- a/source/blender/freestyle/intern/view_map/ViewMap.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewMap.cpp
@@ -162,24 +162,24 @@ ViewVertex *ViewMap::InsertViewVertex(SVertex *iVertex, vector<ViewEdge*>& newVi
return vva;
// because it is not already a ViewVertex, this SVertex must have only 2 FEdges. The incoming one still belongs
// to ioEdge, the outgoing one now belongs to newVEdge
- const vector<FEdge*>& fedges = iVertex->fedges();
+ const vector<FEdge *>& fedges = iVertex->fedges();
if (fedges.size() != 2) {
cerr << "ViewMap warning: Can't split the ViewEdge" << endl;
return NULL;
}
- FEdge *fend(0), *fbegin(0);
- for (vector<FEdge*>::const_iterator fe = fedges.begin(), feend = fedges.end(); fe != feend; ++fe) {
+ FEdge *fend(NULL), *fbegin(NULL);
+ for (vector<FEdge *>::const_iterator fe = fedges.begin(), feend = fedges.end(); fe != feend; ++fe) {
if ((*fe)->vertexB() == iVertex) {
fend = (*fe);
}
if ((*fe)->vertexA() == iVertex) {
fbegin = (*fe);
}
- if ((fbegin!=0) && (fend!=0))
+ if ((fbegin != NULL) && (fend != NULL))
break;
}
ViewEdge *ioEdge = fbegin->viewedge();
- ViewShape * vshape = ioEdge->viewShape();
+ ViewShape *vshape = ioEdge->viewShape();
vva = new NonTVertex(iVertex);
// if the ViewEdge is a closed loop, we don't create a new VEdge
if (ioEdge->A() == 0) {
@@ -482,7 +482,8 @@ ViewVertexInternal::orientedViewEdgeIterator TVertex::edgesIterator(ViewEdge *iE
/* */
/**********************************/
-void NonTVertex::AddOutgoingViewEdge(ViewEdge *iVEdge){
+void NonTVertex::AddOutgoingViewEdge(ViewEdge *iVEdge)
+{
// let's keep the viewedges ordered in CCW order in the 2D image plan
directedViewEdge idve(iVEdge, false);
if (!_ViewEdges.empty()) {
@@ -597,7 +598,7 @@ ViewEdge::edge_iterator ViewEdge::ViewEdge_iterator()
ViewEdge::const_edge_iterator ViewEdge::ViewEdge_iterator() const
{
- return const_edge_iterator((ViewEdge*)this);
+ return const_edge_iterator((ViewEdge *)this);
}
//! feature edge iterator
diff --git a/source/blender/freestyle/intern/view_map/ViewMap.h b/source/blender/freestyle/intern/view_map/ViewMap.h
index e29b2ae7cd6..1dce71051ee 100644
--- a/source/blender/freestyle/intern/view_map/ViewMap.h
+++ b/source/blender/freestyle/intern/view_map/ViewMap.h
@@ -276,7 +276,7 @@ public: // Implementation of Interface0D
public:
friend class ViewShape;
- typedef pair<ViewEdge*, bool> directedViewEdge; // if bool = true, the ViewEdge is incoming
+ typedef pair<ViewEdge *, bool> directedViewEdge; // if bool = true, the ViewEdge is incoming
typedef vector<directedViewEdge> edges_container;
@@ -744,7 +744,7 @@ public:
}
/*! Builds a NonTVertex from a SVertex. */
- inline NonTVertex(SVertex* iSVertex) : ViewVertex(Nature::NON_T_VERTEX)
+ inline NonTVertex(SVertex *iSVertex) : ViewVertex(Nature::NON_T_VERTEX)
{
_SVertex = iSVertex;
_SVertex->setViewVertex(this);
@@ -1401,8 +1401,8 @@ public:
inline ViewShape(ViewShape& iBrother)
{
userdata = NULL;
- vector<ViewVertex*>::iterator vv,vvend;
- vector<ViewEdge*>::iterator ve, veend;
+ vector<ViewVertex *>::iterator vv, vvend;
+ vector<ViewEdge *>::iterator ve, veend;
_SShape = iBrother._SShape;
@@ -1427,11 +1427,11 @@ public:
switch ((*vv)->getNature()) {
case Nature::T_VERTEX:
{
- TVertex *v = (TVertex*)(*vv);
- ViewEdge *veFrontA = (ViewEdge*)(v)->frontEdgeA().first->userdata;
- ViewEdge *veFrontB = (ViewEdge*)(v)->frontEdgeB().first->userdata;
- ViewEdge *veBackA = (ViewEdge*)(v)->backEdgeA().first->userdata;
- ViewEdge *veBackB = (ViewEdge*)(v)->backEdgeB().first->userdata;
+ TVertex *v = (TVertex *)(*vv);
+ ViewEdge *veFrontA = (ViewEdge *)(v)->frontEdgeA().first->userdata;
+ ViewEdge *veFrontB = (ViewEdge *)(v)->frontEdgeB().first->userdata;
+ ViewEdge *veBackA = (ViewEdge *)(v)->backEdgeA().first->userdata;
+ ViewEdge *veBackB = (ViewEdge *)(v)->backEdgeB().first->userdata;
v->setFrontEdgeA(veFrontA, v->frontEdgeA().second);
v->setFrontEdgeB(veFrontB, v->frontEdgeB().second);
@@ -1441,14 +1441,14 @@ public:
break;
case Nature::NON_T_VERTEX:
{
- NonTVertex *v = (NonTVertex*)(*vv);
+ NonTVertex *v = (NonTVertex *)(*vv);
vector<ViewVertex::directedViewEdge>& vedges = (v)->viewedges();
vector<ViewVertex::directedViewEdge> newEdges;
for (vector<ViewVertex::directedViewEdge>::iterator ve = vedges.begin(), veend = vedges.end();
ve != veend;
ve++)
{
- ViewEdge *current = (ViewEdge*)((ve)->first)->userdata;
+ ViewEdge *current = (ViewEdge *)((ve)->first)->userdata;
newEdges.push_back(ViewVertex::directedViewEdge(current, ve->second));
}
(v)->setViewEdges(newEdges);
@@ -1463,8 +1463,8 @@ public:
// remap vertices in edges:
//-------------------------------------
for (ve = _Edges.begin(), veend = _Edges.end(); ve != veend; ve++) {
- (*ve)->setA((ViewVertex*)((*ve)->A()->userdata));
- (*ve)->setB((ViewVertex*)((*ve)->B()->userdata));
+ (*ve)->setA((ViewVertex *)((*ve)->A()->userdata));
+ (*ve)->setB((ViewVertex *)((*ve)->B()->userdata));
//---------------------------------------
// Update all embedded FEdges
//---------------------------------------
@@ -1757,7 +1757,7 @@ inline real ViewEdge::local_average_density(float sigma, int iCombination) const
}
#endif
-inline const SShape * ViewEdge::occluded_shape() const
+inline const SShape *ViewEdge::occluded_shape() const
{
if (0 == _aShape)
return 0;
diff --git a/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h b/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h
index ff6557b7d86..d7ed73ed795 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h
+++ b/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h
@@ -77,7 +77,7 @@ public:
};
template<class Traits>
-class edge_iterator_base : public IteratorBase<Traits,InputIteratorTag_Traits>
+class edge_iterator_base : public IteratorBase<Traits, InputIteratorTag_Traits>
{
public:
typedef typename Traits::value_type value_type;
@@ -117,7 +117,7 @@ protected:
edges_container_iterator _end;
edges_container_iterator _nontvertex_iter;
- typedef IteratorBase<Traits,InputIteratorTag_Traits> parent_class;
+ typedef IteratorBase<Traits, InputIteratorTag_Traits> parent_class;
public:
inline edge_iterator_base() : parent_class() {}
@@ -357,7 +357,7 @@ namespace ViewEdgeInternal {
/*! Iterators definition */
/*!----------------------*/
template<class Traits>
-class edge_iterator_base : public IteratorBase<Traits,BidirectionalIteratorTag_Traits>
+class edge_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTag_Traits>
{
public:
typedef typename Traits::value_type value_type;
@@ -372,7 +372,7 @@ public:
//friend class edge_iterator_base<Const_traits<ViewEdge*> >;
value_type _first;
bool _orientation;
- typedef IteratorBase<Traits,BidirectionalIteratorTag_Traits> parent_class;
+ typedef IteratorBase<Traits, BidirectionalIteratorTag_Traits> parent_class;
public:
friend class ViewEdge;
@@ -510,7 +510,7 @@ protected:
};
template<class Traits>
-class fedge_iterator_base : public IteratorBase<Traits,BidirectionalIteratorTag_Traits>
+class fedge_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTag_Traits>
{
public:
typedef typename Traits::value_type value_type;
@@ -520,7 +520,7 @@ public:
typedef fedge_iterator_base<Traits> Self;
public:
- typedef IteratorBase<Traits,BidirectionalIteratorTag_Traits> parent_class;
+ typedef IteratorBase<Traits, BidirectionalIteratorTag_Traits> parent_class;
mutable value_type _FEdge;
value_type _first;
value_type _FEdgeB; // last fedge of the view edge
@@ -640,7 +640,7 @@ protected:
};
template<class Traits>
-class vertex_iterator_base : public IteratorBase<Traits,BidirectionalIteratorTag_Traits>
+class vertex_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTag_Traits>
{
public:
typedef typename Traits::value_type value_type;
@@ -650,7 +650,7 @@ public:
typedef vertex_iterator_base<Traits> Self;
protected:
- typedef IteratorBase<Traits,BidirectionalIteratorTag_Traits> parent_class;
+ typedef IteratorBase<Traits, BidirectionalIteratorTag_Traits> parent_class;
public:
mutable value_type _SVertex;
diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
index ea959bfd81d..6727a44465a 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
@@ -66,7 +66,7 @@ static void findOccludee(FEdge *fe, G& grid, I& occluders, real epsilon, WFace *
WFace *face = NULL;
if (fe->isSmooth()) {
FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth*>(fe);
- face = (WFace*)fes->face();
+ face = (WFace *)fes->face();
}
WFace *oface;
bool skipFace;
@@ -81,12 +81,12 @@ static void findOccludee(FEdge *fe, G& grid, I& occluders, real epsilon, WFace *
real mint = FLT_MAX;
for (occluders.initAfterTarget(); occluders.validAfterTarget(); occluders.nextOccludee()) {
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\t\tEvaluating intersection for occludee " << occluders.getWFace() << " and ray " << A
- << " * " << u << endl;
- }
- #endif
+#if LOGGING
+ 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();
real d = -((p->getVertices())[0] * p->getNormal());
@@ -131,22 +131,22 @@ static void findOccludee(FEdge *fe, G& grid, I& occluders, real epsilon, WFace *
//first let us compute the plane equation.
if (GeomUtils::COINCIDENT == GeomUtils::intersectRayPlane(origin, edge, p->getNormal(), d, t, epsilon))
{
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\t\tRejecting occluder for target coincidence." << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tRejecting occluder for target coincidence." << endl;
+ }
+#endif
continue;
}
}
if (p->rayIntersect(A, v, t, t_u, t_v)) {
- #if LOGGING
- 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 LOGGING
+ 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))
if (t < mint) {
@@ -154,11 +154,11 @@ static void findOccludee(FEdge *fe, G& grid, I& occluders, real epsilon, WFace *
mint = t;
noIntersection = false;
fe->setOccludeeIntersection(Vec3r(A + t * v));
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\t\tIs occludee" << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tIs occludee" << endl;
+ }
+#endif
}
}
}
@@ -195,7 +195,7 @@ static void findOccludee(FEdge *fe, G& grid, real epsilon, ViewEdge *ve, WFace *
WFace *face = NULL;
if (fe->isSmooth()) {
FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth*>(fe);
- face = (WFace*)fes->face();
+ face = (WFace *)fes->face();
}
if (face) {
@@ -236,7 +236,7 @@ static int computeVisibility(ViewMap *viewMap, FEdge *fe, G& grid, real epsilon,
WFace *face = NULL;
if (fe->isSmooth()) {
FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth*>(fe);
- face = (WFace*)fes->face();
+ face = (WFace *)fes->face();
}
vector<WVertex*> faceVertices;
WVertex::incoming_edge_iterator ie;
@@ -256,54 +256,53 @@ static int computeVisibility(ViewMap *viewMap, FEdge *fe, G& grid, real epsilon,
oface = occluders.getWFace();
Polygon3r *p = occluders.getCameraSpacePolygon();
real t, t_u, t_v;
- #if LOGGING
- 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
- Vec3r v(vp - center);
- real rl = v.norm();
- v.normalize();
- vector<Vec3r> points;
- // Iterate over vertices, storing projections in points
- for (vector<WOEdge*>::const_iterator woe = oface->getEdgeList().begin(), woend = oface->getEdgeList().end();
- woe != woend;
- woe++)
- {
- points.push_back(Vec3r((*woe)->GetaVertex()->GetVertex()));
- }
- Polygon3r p1(points, oface->GetNormal());
- Vec3r v1((p1.getVertices())[0]);
- real d = -(v1 * p->getNormal());
- 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
+#if LOGGING
+ 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 (face)
+#if LOGGING
+ Vec3r v(vp - center);
+ real rl = v.norm();
+ v.normalize();
+ vector<Vec3r> points;
+ // Iterate over vertices, storing projections in points
+ for (vector<WOEdge*>::const_iterator woe = oface->getEdgeList().begin(), woend = oface->getEdgeList().end();
+ woe != woend;
+ woe++)
{
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\t\tDetermining face adjacency...";
- }
- #endif
+ points.push_back(Vec3r((*woe)->GetaVertex()->GetVertex()));
+ }
+ Polygon3r p1(points, oface->GetNormal());
+ Vec3r v1((p1.getVertices())[0]);
+ real d = -(v1 * p->getNormal());
+ 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
+
+ if (face) {
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tDetermining face adjacency...";
+ }
+#endif
skipFace = false;
if (face == oface) {
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << " Rejecting occluder for face concurrency." << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << " Rejecting occluder for face concurrency." << endl;
+ }
+#endif
continue;
}
@@ -330,11 +329,11 @@ static int computeVisibility(ViewMap *viewMap, FEdge *fe, G& grid, real epsilon,
break;
}
if (skipFace) {
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << " Rejecting occluder for face adjacency." << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << " Rejecting occluder for face adjacency." << endl;
+ }
+#endif
continue;
}
}
@@ -343,43 +342,43 @@ 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
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\t\tRejecting occluder for target coincidence." << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tRejecting occluder for target coincidence." << endl;
+ }
+#endif
continue;
}
}
- #if LOGGING
- 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;
- }
+#if LOGGING
+ 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
+ }
+#endif
if (p->rayIntersect(center, u, t, t_u, t_v)) {
- #if LOGGING
- 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 LOGGING
+ 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
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\t\tIs occluder" << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tIs occluder" << endl;
+ }
+#endif
if ( foundOccluders != NULL ) {
ViewShape *vshape = viewMap->viewShape(oface->GetVertex(0)->shape()->GetId());
foundOccluders->insert(vshape);
@@ -425,21 +424,21 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo
for (vector<ViewEdge*>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) {
if (iRenderMonitor && iRenderMonitor->testBreak())
break;
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "Processing ViewEdge " << (*ve)->getId() << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "Processing ViewEdge " << (*ve)->getId() << endl;
+ }
+#endif
// Find an edge to test
if (!(*ve)->isInImage()) {
// This view edge has been proscenium culled
(*ve)->setQI(255);
(*ve)->setaShape(0);
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\tCulled." << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tCulled." << endl;
+ }
+#endif
continue;
}
@@ -470,11 +469,11 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo
++qiMajority;
qiMajority >>= 1;
}
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\tqiMajority: " << qiMajority << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tqiMajority: " << qiMajority << endl;
+ }
+#endif
tmpQI = 0;
maxIndex = 0;
@@ -492,11 +491,11 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo
if ((maxCard < qiMajority)) {
//ARB: change &wFace to wFace and use reference in called function
tmpQI = computeVisibility<G, I>(ioViewMap, fe, grid, epsilon, *ve, &wFace, &foundOccluders);
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\tFEdge: visibility " << tmpQI << endl;
- }
- #endif
+#if LOGGING
+ 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.
@@ -515,11 +514,11 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo
//ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called
//ARB: change &wFace to wFace and use reference in called function
findOccludee<G, I>(fe, grid, epsilon, *ve, &wFace);
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\tFEdge: occludee only (" << (wFace != NULL ? "found" : "not found") << ")" << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFEdge: occludee only (" << (wFace != NULL ? "found" : "not found") << ")" << endl;
+ }
+#endif
}
// Store test results
@@ -533,11 +532,11 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo
fe->setaFace(poly);
wFaces.push_back(wFace);
fe->setOccludeeEmpty(false);
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\tFound occludee" << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFound occludee" << endl;
+ }
+#endif
}
else {
fe->setOccludeeEmpty(true);
@@ -547,11 +546,11 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo
fe = fe->nextEdge();
} while ((maxCard < qiMajority) && (fe) && (fe != festart));
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\tFinished with " << nSamples << " samples, maxCard = " << maxCard << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFinished with " << nSamples << " samples, maxCard = " << maxCard << endl;
+ }
+#endif
// ViewEdge
// qi --
@@ -569,13 +568,13 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo
for (set<ViewShape*>::iterator o = foundOccluders.begin(), oend = foundOccluders.end(); o != oend; ++o) {
(*ve)->AddOccluder((*o));
}
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\tConclusion: QI = " << maxIndex << ", " << (*ve)->occluders_size() << " occluders." << endl;
- }
- #else
- (void)maxIndex;
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tConclusion: QI = " << maxIndex << ", " << (*ve)->occluders_size() << " occluders." << endl;
+ }
+#else
+ (void)maxIndex;
+#endif
// occludee --
if (!wFaces.empty()) {
if (wFaces.size() <= (float)nSamples / 2.0f) {
@@ -607,21 +606,21 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon,
for (vector<ViewEdge*>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) {
if (iRenderMonitor && iRenderMonitor->testBreak())
break;
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "Processing ViewEdge " << (*ve)->getId() << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "Processing ViewEdge " << (*ve)->getId() << endl;
+ }
+#endif
// Find an edge to test
if (!(*ve)->isInImage()) {
// This view edge has been proscenium culled
(*ve)->setQI(255);
(*ve)->setaShape(0);
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\tCulled." << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tCulled." << endl;
+ }
+#endif
continue;
}
@@ -652,11 +651,11 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon,
++qiMajority;
qiMajority >>= 1;
}
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\tqiMajority: " << qiMajority << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tqiMajority: " << qiMajority << endl;
+ }
+#endif
tmpQI = 0;
maxIndex = 0;
@@ -674,11 +673,11 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon,
if ((maxCard < qiMajority)) {
//ARB: change &wFace to wFace and use reference in called function
tmpQI = computeVisibility<G, I>(ioViewMap, fe, grid, epsilon, *ve, &wFace, &foundOccluders);
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\tFEdge: visibility " << tmpQI << endl;
- }
- #endif
+#if LOGGING
+ 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.
@@ -697,11 +696,11 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon,
//ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called
//ARB: change &wFace to wFace and use reference in called function
findOccludee<G, I>(fe, grid, epsilon, *ve, &wFace);
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\tFEdge: occludee only (" << (wFace != NULL ? "found" : "not found") << ")" << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFEdge: occludee only (" << (wFace != NULL ? "found" : "not found") << ")" << endl;
+ }
+#endif
}
// Store test results
@@ -715,11 +714,11 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon,
fe->setaFace(poly);
wFaces.push_back(wFace);
fe->setOccludeeEmpty(false);
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\tFound occludee" << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFound occludee" << endl;
+ }
+#endif
}
else {
fe->setOccludeeEmpty(true);
@@ -729,11 +728,11 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon,
fe = fe->nextEdge();
} while ((maxCard < qiMajority) && (fe) && (fe != festart));
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\tFinished with " << nSamples << " samples, maxCard = " << maxCard << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFinished with " << nSamples << " samples, maxCard = " << maxCard << endl;
+ }
+#endif
// ViewEdge
// qi --
@@ -744,11 +743,11 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon,
for (set<ViewShape*>::iterator o = foundOccluders.begin(), oend = foundOccluders.end(); o != oend; ++o) {
(*ve)->AddOccluder((*o));
}
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\tConclusion: QI = " << maxIndex << ", " << (*ve)->occluders_size() << " occluders." << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tConclusion: QI = " << maxIndex << ", " << (*ve)->occluders_size() << " occluders." << endl;
+ }
+#endif
// occludee --
if (!wFaces.empty()) {
if (wFaces.size() <= (float)nSamples / 2.0f) {
@@ -960,7 +959,8 @@ void ViewMapBuilder::BuildGrid(WingedEdge& we, const BBox<Vec3r>& bbox, unsigned
Vec3r size;
for (unsigned int i = 0; i < 3; i++) {
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
+ // let make the grid 1/10 bigger to avoid numerical errors while computing triangles/cells intersections.
+ size[i] += size[i] / 10.0;
if (size[i] == 0) {
if (_global.debug & G_DEBUG_FREESTYLE) {
cout << "Warning: the bbox size is 0 in dimension " << i << endl;
@@ -1039,8 +1039,8 @@ void ViewMapBuilder::CullViewEdges(ViewMap *ioViewMap, real viewProscenium[4], r
prosceniumOrigin[1] = (viewProscenium[3] - viewProscenium[2]) / 2.0;
if (_global.debug & G_DEBUG_FREESTYLE) {
cout << "Proscenium culling:" << endl;
- cout << "Proscenium: [" << viewProscenium[0] << ", " << viewProscenium[1] << ", " << viewProscenium[2]
- << ", " << viewProscenium[3] << "]"<< endl;
+ cout << "Proscenium: [" << viewProscenium[0] << ", " << viewProscenium[1] << ", " << viewProscenium[2] <<
+ ", " << viewProscenium[3] << "]"<< endl;
cout << "Origin: [" << prosceniumOrigin[0] << ", " << prosceniumOrigin[1] << "]"<< endl;
}
@@ -1263,7 +1263,7 @@ void ViewMapBuilder::computeCusps(ViewMap *ioViewMap)
// creates and insert cusp
cusp = dynamic_cast<NonTVertex*>(ioViewMap->InsertViewVertex(fes->vertexA(), newVEdges));
if (cusp)
- cusp->setNature(cusp->getNature()|Nature::CUSP);
+ cusp->setNature(cusp->getNature() | Nature::CUSP);
}
}
else {
@@ -1272,7 +1272,7 @@ void ViewMapBuilder::computeCusps(ViewMap *ioViewMap)
positive = true;
cusp = dynamic_cast<NonTVertex*>(ioViewMap->InsertViewVertex(fes->vertexA(), newVEdges));
if (cusp)
- cusp->setNature(cusp->getNature()|Nature::CUSP);
+ cusp->setNature(cusp->getNature() | Nature::CUSP);
}
}
fe = fe->nextEdge();
@@ -1351,7 +1351,7 @@ void ViewMapBuilder::ComputeDetailedVisibility(ViewMap *ioViewMap, WingedEdge& w
void ViewMapBuilder::ComputeEdgesVisibility(ViewMap *ioViewMap, WingedEdge& we, const BBox<Vec3r>& bbox,
unsigned int sceneNumFaces, visibility_algo iAlgo, real epsilon)
{
- switch(iAlgo) {
+ switch (iAlgo) {
case ray_casting:
if (_global.debug & G_DEBUG_FREESTYLE) {
cout << "Using ordinary ray casting" << endl;
@@ -1469,11 +1469,11 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo
for (vector<ViewEdge*>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) {
if (_pRenderMonitor && _pRenderMonitor->testBreak())
break;
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "Processing ViewEdge " << (*ve)->getId() << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "Processing ViewEdge " << (*ve)->getId() << endl;
+ }
+#endif
festart = (*ve)->fedgeA();
fe = (*ve)->fedgeA();
qiMajority = 1;
@@ -1482,11 +1482,11 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo
fe = fe->nextEdge();
} while (fe && fe != festart);
qiMajority >>= 1;
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\tqiMajority: " << qiMajority << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tqiMajority: " << qiMajority << endl;
+ }
+#endif
tmpQI = 0;
maxIndex = 0;
@@ -1499,11 +1499,11 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo
if ((maxCard < qiMajority)) {
tmpQI = ComputeRayCastingVisibility(fe, _Grid, epsilon, occluders, &aFace, timestamp++);
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\tFEdge: visibility " << tmpQI << endl;
- }
- #endif
+#if LOGGING
+ 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.
if (tmpQI >= 256) {
@@ -1520,22 +1520,22 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo
else {
//ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called
FindOccludee(fe, _Grid, epsilon, &aFace, timestamp++);
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\tFEdge: occludee only (" << (aFace != NULL ? "found" : "not found") << ")" << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFEdge: occludee only (" << (aFace != NULL ? "found" : "not found") << ")" << endl;
+ }
+#endif
}
if (aFace) {
fe->setaFace(*aFace);
aFaces.push_back(aFace);
fe->setOccludeeEmpty(false);
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\tFound occludee" << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFound occludee" << endl;
+ }
+#endif
}
else {
//ARB: We are arbitrarily using the last observed value for occludee (almost always the value observed
@@ -1547,11 +1547,11 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo
++nSamples;
fe = fe->nextEdge();
} while ((maxCard < qiMajority) && (fe) && (fe != festart));
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\tFinished with " << nSamples << " samples, maxCard = " << maxCard << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tFinished with " << nSamples << " samples, maxCard = " << maxCard << endl;
+ }
+#endif
// ViewEdge
// qi --
@@ -1559,11 +1559,11 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo
// occluders --
for (set<ViewShape*>::iterator o = occluders.begin(), oend = occluders.end(); o != oend; ++o)
(*ve)->AddOccluder((*o));
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\tConclusion: QI = " << maxIndex << ", " << (*ve)->occluders_size() << " occluders." << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\tConclusion: QI = " << maxIndex << ", " << (*ve)->occluders_size() << " occluders." << endl;
+ }
+#endif
// occludee --
if (!aFaces.empty()) {
if (aFaces.size() <= (float)nSamples / 2.0f) {
@@ -1571,7 +1571,7 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo
}
else {
vector<Polygon3r*>::iterator p = aFaces.begin();
- WFace *wface = (WFace*)((*p)->userdata);
+ WFace *wface = (WFace *)((*p)->userdata);
ViewShape *vshape = ioViewMap->viewShape(wface->GetVertex(0)->shape()->GetId());
++p;
(*ve)->setaShape(vshape);
@@ -1686,7 +1686,7 @@ void ViewMapBuilder::ComputeFastRayCastingVisibility(ViewMap *ioViewMap, real ep
}
else {
vector<Polygon3r*>::iterator p = aFaces.begin();
- WFace *wface = (WFace*)((*p)->userdata);
+ WFace *wface = (WFace *)((*p)->userdata);
ViewShape *vshape = ioViewMap->viewShape(wface->GetVertex(0)->shape()->GetId());
++p;
#if 0
@@ -1750,7 +1750,7 @@ void ViewMapBuilder::ComputeVeryFastRayCastingVisibility(ViewMap *ioViewMap, rea
qi = ComputeRayCastingVisibility(fe, _Grid, epsilon, occluders, &aFace, timestamp++);
if (aFace) {
fe->setaFace(*aFace);
- WFace *wface = (WFace*)(aFace->userdata);
+ WFace *wface = (WFace *)(aFace->userdata);
ViewShape *vshape = ioViewMap->viewShape(wface->GetVertex(0)->shape()->GetId());
(*ve)->setaShape(vshape);
}
@@ -1776,7 +1776,7 @@ void ViewMapBuilder::FindOccludee(FEdge *fe, Grid *iGrid, real epsilon, Polygon3
WFace *face = NULL;
if (fe->isSmooth()) {
FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth*>(fe);
- face = (WFace*)fes->face();
+ face = (WFace *)fes->face();
}
OccludersSet occluders;
WFace *oface;
@@ -1799,7 +1799,7 @@ void ViewMapBuilder::FindOccludee(FEdge *fe, Grid *iGrid, real epsilon, Polygon3
// check whether the edge and the polygon plane are coincident:
//-------------------------------------------------------------
//first let us compute the plane equation.
- oface = (WFace*)(*p)->userdata;
+ oface = (WFace *)(*p)->userdata;
Vec3r v1(((*p)->getVertices())[0]);
Vec3r normal((*p)->getNormal());
real d = -(v1 * normal);
@@ -1880,15 +1880,15 @@ void ViewMapBuilder::FindOccludee(FEdge *fe, Grid *iGrid, real epsilon, Polygon3
}
u.normalize();
if (A < iGrid->getOrigin())
- cerr << "Warning: point is out of the grid for fedge " << fe->getId().getFirst() << "-"
- << fe->getId().getSecond() << endl;
+ cerr << "Warning: point is out of the grid for fedge " << fe->getId().getFirst() << "-" <<
+ fe->getId().getSecond() << endl;
vector<WVertex*> faceVertices;
WFace *face = NULL;
if (fe->isSmooth()) {
FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth*>(fe);
- face = (WFace*)fes->face();
+ face = (WFace *)fes->face();
}
if (face)
face->RetrieveVertexList(faceVertices);
@@ -1914,7 +1914,8 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, Grid *iGrid, real eps
Vec3r gridExtremity(iGrid->getOrigin() + iGrid->gridSize());
if ((center.x() < gridOrigin.x()) || (center.y() < gridOrigin.y()) || (center.z() < gridOrigin.z()) ||
- (center.x() > gridExtremity.x()) || (center.y() > gridExtremity.y()) || (center.z() > gridExtremity.z())) {
+ (center.x() > gridExtremity.x()) || (center.y() > gridExtremity.y()) || (center.z() > gridExtremity.z()))
+ {
cerr << "Warning: point is out of the grid for fedge " << fe->getId() << endl;
//return 0;
}
@@ -1953,10 +1954,10 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, Grid *iGrid, real eps
WFace *face = NULL;
if (fe->isSmooth()) {
- FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth*>(fe);
- face = (WFace*)fes->face();
+ FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth *>(fe);
+ face = (WFace *)fes->face();
}
- vector<WVertex*> faceVertices;
+ vector<WVertex *> faceVertices;
WVertex::incoming_edge_iterator ie;
WFace *oface;
@@ -1969,40 +1970,40 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, Grid *iGrid, real eps
// If we're dealing with an exact silhouette, check whether we must take care of this occluder of not.
// (Indeed, we don't consider the occluders that share at least one vertex with the face containing this edge).
//-----------
- oface = (WFace*)(*p)->userdata;
- #if LOGGING
- 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
+ oface = (WFace *)(*p)->userdata;
+#if LOGGING
+ 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());
real d = -(v1 * normal);
real t, t_u, t_v;
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\t\tp: " << ((*p)->getVertices())[0] << ((*p)->getVertices())[1] << ((*p)->getVertices())[2]
- << ", norm: " << (*p)->getNormal() << endl;
- }
- #endif
+#if LOGGING
+ 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
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\t\tDetermining face adjacency...";
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tDetermining face adjacency...";
+ }
+#endif
skipFace = false;
if (face == oface) {
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << " Rejecting occluder for face concurrency." << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << " Rejecting occluder for face concurrency." << endl;
+ }
+#endif
continue;
}
@@ -2031,11 +2032,11 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, Grid *iGrid, real eps
break;
}
if (skipFace) {
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << " Rejecting occluder for face adjacency." << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << " Rejecting occluder for face adjacency." << endl;
+ }
+#endif
continue;
}
}
@@ -2045,31 +2046,31 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, Grid *iGrid, real eps
//first let us compute the plane equation.
if (GeomUtils::COINCIDENT == GeomUtils::intersectRayPlane(origin, edge, normal, d, t, epsilon)) {
- #if LOGGING
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\t\tRejecting occluder for target coincidence." << endl;
- }
- #endif
+#if LOGGING
+ if (_global.debug & G_DEBUG_FREESTYLE) {
+ cout << "\t\tRejecting occluder for target coincidence." << endl;
+ }
+#endif
continue;
}
}
if ((*p)->rayIntersect(center, u, t, t_u, t_v)) {
- #if LOGGING
- 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 LOGGING
+ 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
- if (_global.debug & G_DEBUG_FREESTYLE) {
- cout << "\t\tIs occluder" << endl;
- }
- #endif
- WFace *f = (WFace*)((*p)->userdata);
+#if LOGGING
+ 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());
oOccluders.insert(vshape);
++qi;
@@ -2101,7 +2102,7 @@ void ViewMapBuilder::ComputeIntersections(ViewMap *ioViewMap, intersection_algo
++vv)
{
if ((*vv)->getNature() == Nature::T_VERTEX) {
- TVertex *tvertex = (TVertex*)(*vv);
+ TVertex *tvertex = (TVertex *)(*vv);
if (_global.debug & G_DEBUG_FREESTYLE) {
cout << "TVertex " << tvertex->getId() << " has :" << endl;
cout << "FrontEdgeA: " << tvertex->frontEdgeA().first << endl;
@@ -2113,11 +2114,11 @@ void ViewMapBuilder::ComputeIntersections(ViewMap *ioViewMap, intersection_algo
}
}
-struct less_SVertex2D : public binary_function<SVertex*, SVertex*, bool>
+struct less_SVertex2D : public binary_function<SVertex *, SVertex *, bool>
{
real epsilon;
- less_SVertex2D(real eps) : binary_function<SVertex*, SVertex*, bool>()
+ less_SVertex2D(real eps) : binary_function<SVertex *, SVertex *, bool>()
{
epsilon = eps;
}
@@ -2138,14 +2139,14 @@ struct less_SVertex2D : public binary_function<SVertex*, SVertex*, bool>
}
};
-typedef Segment<FEdge*, Vec3r> segment;
+typedef Segment<FEdge *, Vec3r> segment;
typedef Intersection<segment> intersection;
-struct less_Intersection : public binary_function<intersection*, intersection*, bool>
+struct less_Intersection : public binary_function<intersection *, intersection *, bool>
{
segment *edge;
- less_Intersection(segment *iEdge) : binary_function<intersection*, intersection*, bool>()
+ less_Intersection(segment *iEdge) : binary_function<intersection *, intersection *, bool>()
{
edge = iEdge;
}
@@ -2162,7 +2163,7 @@ struct less_Intersection : public binary_function<intersection*, intersection*,
struct silhouette_binary_rule : public binary_rule<segment, segment>
{
- silhouette_binary_rule() : binary_rule<segment,segment>() {}
+ silhouette_binary_rule() : binary_rule<segment, segment>() {}
virtual bool operator()(segment& s1, segment& s2)
{
@@ -2181,7 +2182,7 @@ struct silhouette_binary_rule : public binary_rule<segment, segment>
void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsilon)
{
- vector<SVertex*>& svertices = ioViewMap->SVertices();
+ vector<SVertex *>& svertices = ioViewMap->SVertices();
bool progressBarDisplay = false;
unsigned sVerticesSize = svertices.size();
unsigned fEdgesSize = ioViewMap->FEdges().size();
@@ -2209,9 +2210,9 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi
sort(svertices.begin(), svertices.end(), less_SVertex2D(epsilon));
- SweepLine<FEdge*, Vec3r> SL;
+ SweepLine<FEdge *, Vec3r> SL;
- vector<FEdge*>& ioEdges = ioViewMap->FEdges();
+ vector<FEdge *>& ioEdges = ioViewMap->FEdges();
vector<segment*> segments;
@@ -2230,8 +2231,8 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi
const vector<FEdge*>& vedges = (*sv)->fedges();
- for (vector<FEdge*>::const_iterator sve = vedges.begin(), sveend = vedges.end(); sve != sveend; sve++) {
- vsegments.push_back((segment*)((*sve)->userdata));
+ for (vector<FEdge *>::const_iterator sve = vedges.begin(), sveend = vedges.end(); sve != sveend; sve++) {
+ vsegments.push_back((segment *)((*sve)->userdata));
}
Vec3r evt((*sv)->point2D());
@@ -2291,24 +2292,24 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi
real ta = (*i)->tA;
real tb = (*i)->tB;
- if ((ta < -epsilon) || (ta > 1+epsilon))
- cerr << "Warning: 2D intersection out of range for edge " << fA->vertexA()->getId() << " - "
- << fA->vertexB()->getId() << endl;
+ if ((ta < -epsilon) || (ta > 1 + epsilon))
+ cerr << "Warning: 2D intersection out of range for edge " << fA->vertexA()->getId() << " - " <<
+ fA->vertexB()->getId() << endl;
- if ((tb < -epsilon) || (tb > 1+epsilon))
- cerr << "Warning: 2D intersection out of range for edge " << fB->vertexA()->getId() << " - "
- << fB->vertexB()->getId() << endl;
+ if ((tb < -epsilon) || (tb > 1 + epsilon))
+ cerr << "Warning: 2D intersection out of range for edge " << fB->vertexA()->getId() << " - " <<
+ fB->vertexB()->getId() << endl;
real Ta = SilhouetteGeomEngine::ImageToWorldParameter(fA, ta);
real Tb = SilhouetteGeomEngine::ImageToWorldParameter(fB, tb);
if ((Ta < -epsilon) || (Ta > 1 + epsilon))
- cerr << "Warning: 3D intersection out of range for edge " << fA->vertexA()->getId() << " - "
- << fA->vertexB()->getId() << endl;
+ cerr << "Warning: 3D intersection out of range for edge " << fA->vertexA()->getId() << " - " <<
+ fA->vertexB()->getId() << endl;
if ((Tb < -epsilon) || (Tb > 1 + epsilon))
- cerr << "Warning: 3D intersection out of range for edge " << fB->vertexA()->getId() << " - "
- << fB->vertexB()->getId() << endl;
+ cerr << "Warning: 3D intersection out of range for edge " << fB->vertexA()->getId() << " - " <<
+ fB->vertexB()->getId() << endl;
#if 0
if (G.debug & G_DEBUG_FREESTYLE) {
@@ -2364,7 +2365,7 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi
// we first need to sort these intersections from farther to closer to A
sort(eIntersections.begin(), eIntersections.end(), less_Intersection(*s));
for (i = eIntersections.begin(), iend = eIntersections.end(); i != iend; i++)
- edgeVVertices.push_back((TVertex*)(*i)->userdata);
+ edgeVVertices.push_back((TVertex *)(*i)->userdata);
shape->SplitEdge(fedge, edgeVVertices, ioViewMap->FEdges(), ioViewMap->ViewEdges());
diff --git a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp
index 0e0e02dcaee..33daf5a7886 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp
@@ -63,7 +63,7 @@ namespace ViewMapIO {
namespace Internal {
-ViewMap* g_vm;
+ViewMap *g_vm;
//////////////////// 'load' Functions ////////////////////
@@ -1073,7 +1073,7 @@ int load(istream& in, ViewMap *vm, ProgressBar *pb)
// Read the shape id to index mapping
unsigned map_s;
READ(map_s);
- unsigned id,index;
+ unsigned id, index;
for (unsigned int i4 = 0; i4 < map_s; ++i4) {
READ(id);
READ(index);
diff --git a/source/blender/freestyle/intern/view_map/ViewMapIO.h b/source/blender/freestyle/intern/view_map/ViewMapIO.h
index 44521f03317..6a7268a71a9 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapIO.h
+++ b/source/blender/freestyle/intern/view_map/ViewMapIO.h
@@ -96,7 +96,7 @@ ostream& write<1>(ostream& out, const char *str)
}
template<>
-ostream& write<0>(ostream& out, const char*)
+ostream& write<0>(ostream& out, const char *)
{
return out;
}
@@ -115,7 +115,7 @@ istream& read<1>(istream& in, char *str)
}
template<>
-istream& read<0>(istream& in, char*)
+istream& read<0>(istream& in, char *)
{
return in;
}