From ea99efeb2ca91b108bf3e86f4964e1a4555b46d8 Mon Sep 17 00:00:00 2001 From: Campbell Barton Date: Tue, 15 Apr 2014 19:21:29 +1000 Subject: Code cleanup: indentation --- .../intern/stroke/AdvancedStrokeShaders.cpp | 4 +- .../freestyle/intern/stroke/StrokeTesselator.cpp | 2 +- .../freestyle/intern/view_map/Functions0D.cpp | 6 +- .../freestyle/intern/view_map/ViewMapBuilder.cpp | 240 ++++++++++----------- .../freestyle/intern/winged_edge/WXEdge.cpp | 70 +++--- 5 files changed, 161 insertions(+), 161 deletions(-) (limited to 'source/blender/freestyle') diff --git a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp index d30a75d9e14..274e36a4c9b 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp +++ b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp @@ -301,7 +301,7 @@ void Smoother::computeCurvature() _curvature[i] = normalCurvature * _normal[i]; if (lba + lbc > M_EPSILON) - _curvature[i] /= (0.5 * lba + lbc); + _curvature[i] /= (0.5 * lba + lbc); } _curvature[0] = _curvature[1]; _curvature[_nbVertices - 1] = _curvature[_nbVertices - 2]; @@ -325,7 +325,7 @@ void Smoother::computeCurvature() _curvature[i] = normalCurvature * _normal[i]; if (lba + lbc > M_EPSILON) - _curvature[i] /= (0.5 * lba + lbc); + _curvature[i] /= (0.5 * lba + lbc); _normal[_nbVertices - 1] = _normal[0]; _curvature[_nbVertices - 1] = _curvature[0]; diff --git a/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp b/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp index 443e14bd0f3..fb221735fb1 100644 --- a/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp @@ -56,7 +56,7 @@ LineRep *StrokeTesselator::Tesselate(Stroke *iStroke) } else { if (_overloadFrsMaterial) - line->setFrsMaterial(_FrsMaterial); + line->setFrsMaterial(_FrsMaterial); line->setStyle(LineRep::LINE_STRIP); diff --git a/source/blender/freestyle/intern/view_map/Functions0D.cpp b/source/blender/freestyle/intern/view_map/Functions0D.cpp index f95690e6ff6..f47e5ff16d5 100644 --- a/source/blender/freestyle/intern/view_map/Functions0D.cpp +++ b/source/blender/freestyle/intern/view_map/Functions0D.cpp @@ -182,9 +182,9 @@ int VertexOrientation3DF0D::operator()(Interface0DIterator& iter) A = Vec3r(iter->getX(), iter->getY(), iter->getZ()); } else { - Interface0DIterator previous = iter; - --previous ; - A = Vec3r(previous->getX(), previous->getY(), previous->getZ()); + Interface0DIterator previous = iter; + --previous ; + A = Vec3r(previous->getX(), previous->getY(), previous->getZ()); } Interface0DIterator next = iter; ++next ; diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp index 6f4f1df4b47..a0a1282219c 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp @@ -138,28 +138,28 @@ static void findOccludee(FEdge *fe, G& grid, I& occluders, real epsilon, WFace * 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; - } + 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) { - *oaWFace = oface; - mint = t; - noIntersection = false; - fe->setOccludeeIntersection(Vec3r(A + t * v)); + if (fabs(v * p->getNormal()) > 0.0001) { + if ((t > 0.0)) { // && (t<1.0)) + if (t < mint) { + *oaWFace = oface; + mint = t; + noIntersection = false; + fe->setOccludeeIntersection(Vec3r(A + t * v)); #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\t\tIs occludee" << endl; - } + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\t\tIs occludee" << endl; + } #endif + } } } - } - occluders.reportDepth(A, v, t); + occluders.reportDepth(A, v, t); } } @@ -246,146 +246,146 @@ static int computeVisibility(ViewMap *viewMap, FEdge *fe, G& grid, real epsilon, I occluders(grid, center, epsilon); for (occluders.initBeforeTarget(); occluders.validBeforeTarget(); occluders.nextOccluder()) { - // 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 = 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 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 = occluders.getWFace(); + Polygon3r *p = occluders.getCameraSpacePolygon(); + real t, t_u, t_v; #if LOGGING - Vec3r v(vp - center); - real rl = v.norm(); - v.normalize(); - vector points; - // Iterate over vertices, storing projections in points - for (vector::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()); + 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 points; + // Iterate over vertices, storing projections in points + for (vector::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\tDetermining face adjacency..."; + 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 - skipFace = false; - if (face == oface) { + if (face) { #if LOGGING if (_global.debug & G_DEBUG_FREESTYLE) { - cout << " Rejecting occluder for face concurrency." << endl; + cout << "\t\tDetermining face adjacency..."; } #endif - continue; - } - + skipFace = false; - for (vector::iterator fv = faceVertices.begin(), fvend = faceVertices.end(); fv != fvend; ++fv) { - if ((*fv)->isBoundary()) + if (face == oface) { +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << " Rejecting occluder for face concurrency." << endl; + } +#endif continue; + } - WVertex::incoming_edge_iterator iebegin = (*fv)->incoming_edges_begin(); - WVertex::incoming_edge_iterator ieend = (*fv)->incoming_edges_end(); - for (ie = iebegin; ie != ieend; ++ie) { - if ((*ie) == 0) + + for (vector::iterator fv = faceVertices.begin(), fvend = faceVertices.end(); fv != fvend; ++fv) { + if ((*fv)->isBoundary()) continue; - WFace *sface = (*ie)->GetbFace(); - //WFace *sfacea = (*ie)->GetaFace(); - //if ((sface == oface) || (sfacea == oface)) - if (sface == oface) { - skipFace = true; - break; + WVertex::incoming_edge_iterator iebegin = (*fv)->incoming_edges_begin(); + WVertex::incoming_edge_iterator ieend = (*fv)->incoming_edges_end(); + for (ie = iebegin; ie != ieend; ++ie) { + if ((*ie) == 0) + continue; + + WFace *sface = (*ie)->GetbFace(); + //WFace *sfacea = (*ie)->GetaFace(); + //if ((sface == oface) || (sfacea == oface)) + if (sface == oface) { + skipFace = true; + break; + } } + if (skipFace) + break; } - if (skipFace) - break; - } - if (skipFace) { + if (skipFace) { #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << " Rejecting occluder for face adjacency." << endl; - } + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << " Rejecting occluder for face adjacency." << endl; + } #endif - continue; + continue; + } } - } - else { - // check whether the edge and the polygon plane are coincident: - //------------------------------------------------------------- - //first let us compute the plane equation. - if (GeomUtils::COINCIDENT == GeomUtils::intersectRayPlane(origin, edge, p->getNormal(), d, t, epsilon)) { + else { + // check whether the edge and the polygon plane are coincident: + //------------------------------------------------------------- + //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; - } + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\t\tRejecting occluder for target coincidence." << endl; + } #endif - continue; + 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 (_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 (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; - } + 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 (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; - } + 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); - } - ++qi; + if ( foundOccluders != NULL ) { + ViewShape *vshape = viewMap->viewShape(oface->GetVertex(0)->shape()->GetId()); + foundOccluders->insert(vshape); + } + ++qi; - if (! grid.enableQI()) - break; - } + if (! grid.enableQI()) + break; + } - occluders.reportDepth(center, u, t); + occluders.reportDepth(center, u, t); } } } diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp index 88da9cf9f80..84dbd5fbef8 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp +++ b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp @@ -197,43 +197,43 @@ WXSmoothEdge *WXFaceLayer::BuildSmoothEdge() WSFace *bface = (WSFace *)GetBordingFace(i); if (bface) { if ((front()) ^ (bface->front())) { // fA->front XOR fB->front (true if one is 0 and the other is 1) - // that means that the edge i of the face is a silhouette edge - // CHECK FIRST WHETHER THE EXACTSILHOUETTEEDGE HAS NOT YET BEEN BUILT ON THE OTHER FACE (1 is enough). - if (((WSExactFace *)bface)->exactSilhouetteEdge()) { - // that means that this silhouette edge has already been built - return ((WSExactFace *)bface)->exactSilhouetteEdge(); - } - // Else we must build it - WOEdge *woea, *woeb; - real ta, tb; - if (!front()) { // is it in the right order ? - // the order of the WOEdge index is wrong - woea = _OEdgeList[(i + 1) % numberOfEdges()]; - if (0 == i) - woeb = _OEdgeList[numberOfEdges() - 1]; - else - woeb = _OEdgeList[(i - 1)]; - ta = 0; - tb = 1; - } - else { - // the order of the WOEdge index is good - if (0 == i) - woea = _OEdgeList[numberOfEdges() - 1]; - else - woea = _OEdgeList[(i - 1)]; - woeb = _OEdgeList[(i + 1) % numberOfEdges()]; - ta = 1; - tb = 0; - } + // that means that the edge i of the face is a silhouette edge + // CHECK FIRST WHETHER THE EXACTSILHOUETTEEDGE HAS NOT YET BEEN BUILT ON THE OTHER FACE (1 is enough). + if (((WSExactFace *)bface)->exactSilhouetteEdge()) { + // that means that this silhouette edge has already been built + return ((WSExactFace *)bface)->exactSilhouetteEdge(); + } + // Else we must build it + WOEdge *woea, *woeb; + real ta, tb; + if (!front()) { // is it in the right order ? + // the order of the WOEdge index is wrong + woea = _OEdgeList[(i + 1) % numberOfEdges()]; + if (0 == i) + woeb = _OEdgeList[numberOfEdges() - 1]; + else + woeb = _OEdgeList[(i - 1)]; + ta = 0; + tb = 1; + } + else { + // the order of the WOEdge index is good + if (0 == i) + woea = _OEdgeList[numberOfEdges() - 1]; + else + woea = _OEdgeList[(i - 1)]; + woeb = _OEdgeList[(i + 1) % numberOfEdges()]; + ta = 1; + tb = 0; + } - _pSmoothEdge = new ExactSilhouetteEdge(ExactSilhouetteEdge::VERTEX_VERTEX); - _pSmoothEdge->setWOeA(woea); - _pSmoothEdge->setWOeA(woeb); - _pSmoothEdge->setTa(ta); - _pSmoothEdge->setTb(tb); + _pSmoothEdge = new ExactSilhouetteEdge(ExactSilhouetteEdge::VERTEX_VERTEX); + _pSmoothEdge->setWOeA(woea); + _pSmoothEdge->setWOeA(woeb); + _pSmoothEdge->setTa(ta); + _pSmoothEdge->setTb(tb); - return _pSmoothEdge; + return _pSmoothEdge; } } } -- cgit v1.2.3