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 --- .../freestyle/intern/view_map/ViewMapBuilder.cpp | 240 ++++++++++----------- 1 file changed, 120 insertions(+), 120 deletions(-) (limited to 'source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp') 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); } } } -- cgit v1.2.3