diff options
Diffstat (limited to 'source/blender/freestyle/intern/view_map')
28 files changed, 476 insertions, 445 deletions
diff --git a/source/blender/freestyle/intern/view_map/BoxGrid.h b/source/blender/freestyle/intern/view_map/BoxGrid.h index 83c379102f5..35b5e4d6b55 100644 --- a/source/blender/freestyle/intern/view_map/BoxGrid.h +++ b/source/blender/freestyle/intern/view_map/BoxGrid.h @@ -58,9 +58,9 @@ class BoxGrid { Polygon3r poly; Polygon3r cameraSpacePolygon; real shallowest, deepest; - // 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. + // 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; #ifdef WITH_CXX_GUARDEDALLOC @@ -84,24 +84,27 @@ class BoxGrid { void indexPolygons(); real boundary[4]; - //deque<OccluderData*> faces; + // deque<OccluderData*> faces; vector<OccluderData *> faces; }; public: /* Iterator needs to allow the user to avoid full 3D comparison in two cases: * - * (1) Where (*current)->deepest < target[2], where the occluder is unambiguously in front of the target point. + * (1) Where (*current)->deepest < target[2], where the occluder is unambiguously in front of the + * target point. * - * (2) Where (*current)->shallowest > target[2], where the occluder is unambiguously in back of the target point. + * (2) Where (*current)->shallowest > target[2], where the occluder is unambiguously in back of + * the target point. * - * In addition, when used by OptimizedFindOccludee, Iterator should stop iterating as soon as it has an - * occludee candidate and (*current)->shallowest > candidate[2], because at that point forward no new occluder - * could possibly be a better occludee. + * In addition, when used by OptimizedFindOccludee, Iterator should stop iterating as soon as it + * has an occludee candidate and (*current)->shallowest > candidate[2], because at that point + * forward no new occluder could possibly be a better occludee. */ class Iterator { public: - // epsilon is not used in this class, but other grids with the same interface may need an epsilon + // epsilon is not used in this class, but other grids with the same interface may need an + // epsilon explicit Iterator(BoxGrid &grid, Vec3r ¢er, real epsilon = 1.0e-06); ~Iterator(); void initBeforeTarget(); @@ -122,7 +125,7 @@ class BoxGrid { Vec3r _target; bool _foundOccludee; real _occludeeDepth; - //deque<OccluderData*>::iterator _current, _occludeeCandidate; + // deque<OccluderData*>::iterator _current, _occludeeCandidate; vector<OccluderData *>::iterator _current, _occludeeCandidate; #ifdef WITH_CXX_GUARDEDALLOC @@ -171,7 +174,7 @@ class BoxGrid { void getCellCoordinates(const Vec3r &point, unsigned &x, unsigned &y); typedef PointerSequence<vector<Cell *>, Cell *> cellContainer; - //typedef PointerSequence<deque<OccluderData*>, OccluderData*> occluderContainer; + // typedef PointerSequence<deque<OccluderData*>, OccluderData*> occluderContainer; typedef PointerSequence<vector<OccluderData *>, OccluderData *> occluderContainer; unsigned _cellsX, _cellsY; float _cellSize; @@ -222,8 +225,8 @@ inline bool BoxGrid::Iterator::testOccluder(bool wantOccludee) { // End-of-list is not even a valid iterator position if (_current == _cell->faces.end()) { - // Returning true seems strange, but it will break us out of whatever loop is calling testOccluder, - // and _current = _cell->face.end() will make the calling routine give up. + // Returning true seems strange, but it will break us out of whatever loop is calling + // testOccluder, and _current = _cell->face.end() will make the calling routine give up. return true; } #if BOX_GRID_LOGGING diff --git a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp index 214852001b6..8e10d06d623 100644 --- a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp +++ b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp @@ -35,8 +35,8 @@ CulledOccluderSource::CulledOccluderSource(const GridHelpers::Transform &t, { cullViewEdges(viewMap, extensiveFEdgeSearch); - // If we have not found any visible FEdges during our cull, then there is nothing to iterate over. - // Short-circuit everything. + // If we have not found any visible FEdges during our cull, then there is nothing to iterate + // over. Short-circuit everything. valid = gridSpaceOccluderProsceniumInitialized; if (valid && !testCurrent()) { @@ -107,8 +107,8 @@ void CulledOccluderSource::cullViewEdges(ViewMap &viewMap, bool extensiveFEdgeSe // Non-displayable view edges will be skipped over during visibility calculation. - // View edges will be culled according to their position w.r.t. the viewport proscenium (viewport + 5% border, - // or some such). + // View edges will be culled according to their position w.r.t. the viewport proscenium (viewport + // + 5% border, or some such). // Get proscenium boundary for culling real viewProscenium[4]; @@ -123,17 +123,16 @@ void CulledOccluderSource::cullViewEdges(ViewMap &viewMap, bool extensiveFEdgeSe cout << "Origin: [" << prosceniumOrigin[0] << ", " << prosceniumOrigin[1] << "]" << endl; } - // A separate occluder proscenium will also be maintained, starting out the same as the viewport proscenium, and - // expanding as necessary so that it encompasses the center point of at least one feature edge in each - // retained view edge. - // The occluder proscenium will be used later to cull occluding triangles before they are inserted into the Grid. - // The occluder proscenium starts out the same size as the view proscenium + // A separate occluder proscenium will also be maintained, starting out the same as the viewport + // proscenium, and expanding as necessary so that it encompasses the center point of at least one + // feature edge in each retained view edge. The occluder proscenium will be used later to cull + // occluding triangles before they are inserted into the Grid. The occluder proscenium starts out + // the same size as the view proscenium GridHelpers::getDefaultViewProscenium(occluderProscenium); - // XXX Freestyle is inconsistent in its use of ViewMap::viewedges_container and vector<ViewEdge*>::iterator. - // Probably all occurences of vector<ViewEdge*>::iterator should be replaced ViewMap::viewedges_container - // throughout the code. - // For each view edge + // XXX Freestyle is inconsistent in its use of ViewMap::viewedges_container and + // vector<ViewEdge*>::iterator. Probably all occurences of vector<ViewEdge*>::iterator should be + // replaced ViewMap::viewedges_container throughout the code. For each view edge ViewMap::viewedges_container::iterator ve, veend; for (ve = viewMap.ViewEdges().begin(), veend = viewMap.ViewEdges().end(); ve != veend; ve++) { @@ -154,8 +153,8 @@ void CulledOccluderSource::cullViewEdges(ViewMap &viewMap, bool extensiveFEdgeSe // All ViewEdges start culled (*ve)->setIsInImage(false); - // For simple visibility calculation: mark a feature edge that is known to have a center point inside - // the occluder proscenium. Cull all other feature edges. + // For simple visibility calculation: mark a feature edge that is known to have a center point + // inside the occluder proscenium. Cull all other feature edges. do { // All FEdges start culled fe->setIsInImage(false); @@ -190,8 +189,8 @@ void CulledOccluderSource::cullViewEdges(ViewMap &viewMap, bool extensiveFEdgeSe fe = fe->nextEdge(); } while (fe != NULL && fe != festart && !(bestOccluderTargetFound && (*ve)->isInImage())); - // Either we have run out of FEdges, or we already have the one edge we need to determine visibility - // Cull all remaining edges. + // Either we have run out of FEdges, or we already have the one edge we need to determine + // visibility Cull all remaining edges. while (fe != NULL && fe != festart) { fe->setIsInImage(false); fe = fe->nextEdge(); @@ -229,14 +228,14 @@ void CulledOccluderSource::cullViewEdges(ViewMap &viewMap, bool extensiveFEdgeSe // For "Normal" or "Fast" style visibility computation only: - // For more detailed visibility calculation, make a second pass through the view map, marking all feature edges - // with center points inside the final occluder proscenium. All of these feature edges can be considered during - // visibility calculation. + // For more detailed visibility calculation, make a second pass through the view map, marking all + // feature edges with center points inside the final occluder proscenium. All of these feature + // edges can be considered during visibility calculation. - // So far we have only found one FEdge per ViewEdge. The "Normal" and "Fast" styles of visibility computation - // want to consider many FEdges for each ViewEdge. - // Here we re-scan the view map to find any usable FEdges that we skipped on the first pass, or that have become - // usable because the occluder proscenium has been expanded since the edge was visited on the first pass. + // So far we have only found one FEdge per ViewEdge. The "Normal" and "Fast" styles of visibility + // computation want to consider many FEdges for each ViewEdge. Here we re-scan the view map to + // find any usable FEdges that we skipped on the first pass, or that have become usable because + // the occluder proscenium has been expanded since the edge was visited on the first pass. if (extensiveFEdgeSearch) { // For each view edge, for (ve = viewMap.ViewEdges().begin(), veend = viewMap.ViewEdges().end(); ve != veend; ve++) { @@ -259,9 +258,9 @@ void CulledOccluderSource::cullViewEdges(ViewMap &viewMap, bool extensiveFEdgeSe } // Up until now, all calculations have been done in camera space. - // However, the occluder source's iteration and the grid that consumes the occluders both work in gridspace, - // so we need a version of the occluder proscenium in gridspace. - // Set the gridspace occlude proscenium + // However, the occluder source's iteration and the grid that consumes the occluders both work in + // gridspace, so we need a version of the occluder proscenium in gridspace. Set the gridspace + // occlude proscenium } void CulledOccluderSource::expandGridSpaceOccluderProscenium(FEdge *fe) diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp index 1de4a87886c..6c144807e35 100644 --- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp +++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp @@ -184,7 +184,7 @@ void FEdgeXDetector::computeCurvatures(WXVertex *vertex) // CURVATURE LAYER // store all the curvature datas for each vertex - //soc unused - real K1, K2 + // soc unused - real K1, K2 real cos2theta, sin2theta; Vec3r e1, n, v; // one vertex curvature info : @@ -206,8 +206,8 @@ void FEdgeXDetector::computeCurvatures(WXVertex *vertex) ncycle.end(); C->K1 = ncycle.kmin(); C->K2 = ncycle.kmax(); - C->e1 = ncycle.Kmax(); //ncycle.kmin() * ncycle.Kmax(); - C->e2 = ncycle.Kmin(); //ncycle.kmax() * ncycle.Kmin(); + C->e1 = ncycle.Kmax(); // ncycle.kmin() * ncycle.Kmax(); + C->e2 = ncycle.Kmin(); // ncycle.kmax() * ncycle.Kmin(); real absK1 = fabs(C->K1); _meanK1 += absK1; @@ -320,8 +320,8 @@ void FEdgeXDetector::ProcessSilhouetteEdge(WXEdge *iEdge) 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())) @@ -392,7 +392,7 @@ void FEdgeXDetector::ProcessCreaseEdge(WXEdge *iEdge) void FEdgeXDetector::processRidgesAndValleysShape(WXShape *iWShape) { // Don't forget to add the built layer to the face at the end of the ProcessFace: - //iFace->AddSmoothLayer(faceLayer); + // iFace->AddSmoothLayer(faceLayer); if (!_computeViewIndependent) return; @@ -671,7 +671,8 @@ void FEdgeXDetector::postProcessSuggestiveContourFace(WXFace *iFace) } // At that point, we have the derivatives for each vertex of iFace. - // All we have to do now is to use linear interpolation to compute the values at the extremities of the smooth edge. + // All we have to do now is to use linear interpolation to compute the values at the extremities + // of the smooth edge. WXSmoothEdge *sc_edge = sc_layer->getSmoothEdge(); WOEdge *sc_oedge = sc_edge->woea(); t = sc_edge->ta(); diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h index fafc391aa8f..9df0b4bb4bd 100644 --- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h +++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h @@ -89,8 +89,9 @@ class FEdgeXDetector { /*! Sets the minimum angle for detecting crease edges * \param angle: - * The angular threshold in degrees (between 0 and 180) for detecting crease edges. An edge is considered - * a crease edge if the angle between two faces sharing the edge is smaller than the given threshold. + * The angular threshold in degrees (between 0 and 180) for detecting crease edges. An edge is + * considered a crease edge if the angle between two faces sharing the edge is smaller than the + * given threshold. */ // XXX angle should be in radian... inline void setCreaseAngle(float angle) @@ -211,7 +212,7 @@ class FEdgeXDetector { #if 0 real _bbox_diagonal; // diagonal of the current processed shape bbox #endif - //oldtmp values + // oldtmp values bool _computeViewIndependent; real _meanK1; real _meanKr; diff --git a/source/blender/freestyle/intern/view_map/Functions0D.cpp b/source/blender/freestyle/intern/view_map/Functions0D.cpp index 5b04b66eeeb..2a9a654981a 100644 --- a/source/blender/freestyle/intern/view_map/Functions0D.cpp +++ b/source/blender/freestyle/intern/view_map/Functions0D.cpp @@ -343,7 +343,7 @@ int GetOccludersF0D::operator()(Interface0DIterator &iter) set<ViewShape *> occluders; getOccludersF0D(iter, occluders); result.clear(); - //vsOccluders.insert(vsOccluders.begin(), occluders.begin(), occluders.end()); + // vsOccluders.insert(vsOccluders.begin(), occluders.begin(), occluders.end()); for (set<ViewShape *>::iterator it = occluders.begin(), itend = occluders.end(); it != itend; ++it) { result.push_back((*it)); diff --git a/source/blender/freestyle/intern/view_map/Functions0D.h b/source/blender/freestyle/intern/view_map/Functions0D.h index ecf94b29d60..7149c1909fd 100644 --- a/source/blender/freestyle/intern/view_map/Functions0D.h +++ b/source/blender/freestyle/intern/view_map/Functions0D.h @@ -55,9 +55,9 @@ using namespace Geometry; /*! Base class for Unary Functions (functors) working on Interface0DIterator. * A unary function will be used by calling its operator() on an Interface0DIterator. - * \attention In the scripting language, there exists several prototypes depending on the returned value type. - * For example, you would inherit from a UnaryFunction0DDouble if you wish to define a function that returns a double. - * The different existing prototypes are: + * \attention In the scripting language, there exists several prototypes depending on the returned + * value type. For example, you would inherit from a UnaryFunction0DDouble if you wish to define a + * function that returns a double. The different existing prototypes are: * - UnaryFunction0DDouble * - UnaryFunction0DEdgeNature * - UnaryFunction0DFloat @@ -284,8 +284,9 @@ class GetParameterF0D : public UnaryFunction0D<float> { }; // VertexOrientation2DF0D -/*! Returns a Vec2r giving the 2D oriented tangent to the 1D element to which the Interface0DIterator& belongs to and - * evaluated at the Interface0D pointed by this Interface0DIterator&. +/*! Returns a Vec2r giving the 2D oriented tangent to the 1D element to which the + * Interface0DIterator& belongs to and evaluated at the Interface0D pointed by this + * Interface0DIterator&. */ class VertexOrientation2DF0D : public UnaryFunction0D<Vec2f> { public: @@ -300,8 +301,9 @@ class VertexOrientation2DF0D : public UnaryFunction0D<Vec2f> { }; // VertexOrientation3DF0D -/*! Returns a Vec3r giving the 3D oriented tangent to the 1D element to which the Interface0DIterator& belongs to and - * evaluated at the Interface0D pointed by this Interface0DIterator&. +/*! Returns a Vec3r giving the 3D oriented tangent to the 1D element to which the + * Interface0DIterator& belongs to and evaluated at the Interface0D pointed by this + * Interface0DIterator&. */ class VertexOrientation3DF0D : public UnaryFunction0D<Vec3f> { public: @@ -316,8 +318,9 @@ class VertexOrientation3DF0D : public UnaryFunction0D<Vec3f> { }; // Curvature2DAngleF0D -/*! Returns a real giving the 2D curvature (as an angle) of the 1D element to which the Interface0DIterator& - * belongs to and evaluated at the Interface0D pointed by this Interface0DIterator&. +/*! Returns a real giving the 2D curvature (as an angle) of the 1D element to which the + * Interface0DIterator& belongs to and evaluated at the Interface0D pointed by this + * Interface0DIterator&. */ class Curvature2DAngleF0D : public UnaryFunction0D<double> { public: @@ -332,9 +335,10 @@ class Curvature2DAngleF0D : public UnaryFunction0D<double> { }; // ZDiscontinuity -/*! Returns a real giving the distance between and Interface0D and the shape that lies behind (occludee). - * This distance is evaluated in the camera space and normalized between 0 and 1. Therefore, if no object is occluded - * by the shape to which the Interface0D belongs to, 1 is returned. +/*! Returns a real giving the distance between and Interface0D and the shape that lies behind + * (occludee). This distance is evaluated in the camera space and normalized between 0 and 1. + * Therefore, if no object is occluded by the shape to which the Interface0D belongs to, 1 is + * returned. */ class ZDiscontinuityF0D : public UnaryFunction0D<double> { public: @@ -349,8 +353,9 @@ class ZDiscontinuityF0D : public UnaryFunction0D<double> { }; // Normal2DF0D -/*! Returns a Vec2f giving the normalized 2D normal to the 1D element to which the Interface0DIterator& belongs to and - * evaluated at the Interface0D pointed by this Interface0DIterator&. +/*! Returns a Vec2f giving the normalized 2D normal to the 1D element to which the + * Interface0DIterator& belongs to and evaluated at the Interface0D pointed by this + * Interface0DIterator&. */ class Normal2DF0D : public UnaryFunction0D<Vec2f> { public: @@ -367,11 +372,11 @@ class Normal2DF0D : public UnaryFunction0D<Vec2f> { // MaterialF0D /*! Returns the material of the object evaluated at the Interface0D. * This evaluation can be ambiguous (in the case of a TVertex for example. - * This functor tries to remove this ambiguity using the context offered by the 1D element to which the - * Interface0DIterator& belongs to and by arbitrary choosing the material of the face that lies on its left when - * following the 1D element if there are two different materials on each side of the point. - * However, there still can be problematic cases, and the user willing to deal with this cases in a specific way - * should implement its own getMaterial functor. + * This functor tries to remove this ambiguity using the context offered by the 1D element to + * which the Interface0DIterator& belongs to and by arbitrary choosing the material of the face + * that lies on its left when following the 1D element if there are two different materials on each + * side of the point. However, there still can be problematic cases, and the user willing to deal + * with this cases in a specific way should implement its own getMaterial functor. */ class MaterialF0D : public UnaryFunction0D<FrsMaterial> { public: @@ -388,10 +393,10 @@ class MaterialF0D : public UnaryFunction0D<FrsMaterial> { // ShapeIdF0D /*! Returns the Id of the Shape the Interface0D belongs to. * This evaluation can be ambiguous (in the case of a TVertex for example). - * This functor tries to remove this ambiguity using the context offered by the 1D element to which the - * Interface0DIterator& belongs to. - * However, there still can be problematic cases, and the user willing to deal with this cases in a specific way - * should implement its own getShapeIdF0D functor. + * This functor tries to remove this ambiguity using the context offered by the 1D element to + * which the Interface0DIterator& belongs to. However, there still can be problematic cases, and + * the user willing to deal with this cases in a specific way should implement its own + * getShapeIdF0D functor. */ class ShapeIdF0D : public UnaryFunction0D<Id> { public: @@ -408,10 +413,10 @@ class ShapeIdF0D : public UnaryFunction0D<Id> { // QiF0D /*! Returns the quantitative invisibility of this Interface0D. * This evaluation can be ambiguous (in the case of a TVertex for example). - * This functor tries to remove this ambiguity using the context offered by the 1D element to which the - * Interface0DIterator& belongs to. - * However, there still can be problematic cases, and the user willing to deal with this cases in a specific way - * should implement its own getQIF0D functor. + * This functor tries to remove this ambiguity using the context offered by the 1D element to + * which the Interface0DIterator& belongs to. However, there still can be problematic cases, and + * the user willing to deal with this cases in a specific way should implement its own getQIF0D + * functor. */ class QuantitativeInvisibilityF0D : public UnaryFunction0D<unsigned int> { public: diff --git a/source/blender/freestyle/intern/view_map/Functions1D.h b/source/blender/freestyle/intern/view_map/Functions1D.h index 581ab9c459a..20aa9f2a27f 100644 --- a/source/blender/freestyle/intern/view_map/Functions1D.h +++ b/source/blender/freestyle/intern/view_map/Functions1D.h @@ -45,9 +45,9 @@ namespace Freestyle { /*! Base class for Unary Functions (functors) working on Interface1D. * A unary function will be used by calling its operator() on an Interface1D. - * \attention In the scripting language, there exists several prototypes depending on the returned value type. - * For example, you would inherit from a UnaryFunction1DDouble if you wish to define a function that returns a double. - * The different existing prototypes are: + * \attention In the scripting language, there exists several prototypes depending on the returned + * value type. For example, you would inherit from a UnaryFunction1DDouble if you wish to define a + * function that returns a double. The different existing prototypes are: * - UnaryFunction1DDouble * - UnaryFunction1DEdgeNature * - UnaryFunction1DFloat @@ -73,8 +73,8 @@ template<class T> class UnaryFunction1D { /*! Builds a UnaryFunction1D from an integration type. * \param iType: - * In case the result for the Interface1D would be obtained by evaluating a 0D function over the different - * Interface0D of the Interface1D, \a iType tells which integration method to use. + * In case the result for the Interface1D would be obtained by evaluating a 0D function over + * the different Interface0D of the Interface1D, \a iType tells which integration method to use. * The default integration method is the MEAN. */ UnaryFunction1D(IntegrationType iType) @@ -379,9 +379,10 @@ class Orientation3DF1D : public UnaryFunction1D<Vec3f> { }; // ZDiscontinuityF1D -/*! Returns a real giving the distance between and Interface1D and the shape that lies behind (occludee). - * This distance is evaluated in the camera space and normalized between 0 and 1. Therefore, if no object is occluded - * by the shape to which the Interface1D belongs to, 1 is returned. +/*! Returns a real giving the distance between and Interface1D and the shape that lies behind + * (occludee). This distance is evaluated in the camera space and normalized between 0 and 1. + * Therefore, if no object is occluded by the shape to which the Interface1D belongs to, 1 is + * returned. */ class ZDiscontinuityF1D : public UnaryFunction1D<double> { private: @@ -408,9 +409,9 @@ class ZDiscontinuityF1D : public UnaryFunction1D<double> { // QuantitativeInvisibilityF1D /*! Returns the Quantitative Invisibility of an Interface1D element. - * If the Interface1D is a ViewEdge, then there is no ambiguity concerning the result. But, if the Interface1D - * results of a chaining (chain, stroke), then it might be made of several 1D elements of different - * Quantitative Invisibilities. + * If the Interface1D is a ViewEdge, then there is no ambiguity concerning the result. But, if the + * Interface1D results of a chaining (chain, stroke), then it might be made of several 1D elements + * of different Quantitative Invisibilities. */ class QuantitativeInvisibilityF1D : public UnaryFunction1D<unsigned> { private: @@ -438,8 +439,9 @@ class QuantitativeInvisibilityF1D : public UnaryFunction1D<unsigned> { // CurveNatureF1D /*! Returns the nature of the Interface1D (silhouette, ridge, crease...). * Except if the Interface1D is a ViewEdge, this result might be ambiguous. - * Indeed, the Interface1D might result from the gathering of several 1D elements, each one being of a different - * nature. An integration method, such as the MEAN, might give, in this case, irrelevant results. + * Indeed, the Interface1D might result from the gathering of several 1D elements, each one being + * of a different nature. An integration method, such as the MEAN, might give, in this case, + * irrelevant results. */ class CurveNatureF1D : public UnaryFunction1D<Nature::EdgeNature> { private: diff --git a/source/blender/freestyle/intern/view_map/GridDensityProvider.h b/source/blender/freestyle/intern/view_map/GridDensityProvider.h index dacdb345c86..8d6ba521dde 100644 --- a/source/blender/freestyle/intern/view_map/GridDensityProvider.h +++ b/source/blender/freestyle/intern/view_map/GridDensityProvider.h @@ -110,7 +110,8 @@ class GridDensityProvider { Vec3r p6 = transform(Vec3r(xM, ym, zM)); Vec3r p7 = transform(Vec3r(xM, yM, zm)); Vec3r p8 = transform(Vec3r(xM, yM, zM)); - // Determine the proscenium face according to the min and max values of the transformed x and y coordinates + // Determine the proscenium face according to the min and max values of the transformed x and y + // coordinates proscenium[0] = std::min(std::min(std::min(p1.x(), p2.x()), std::min(p3.x(), p4.x())), std::min(std::min(p5.x(), p6.x()), std::min(p7.x(), p8.x()))); proscenium[1] = std::max(std::max(std::max(p1.x(), p2.x()), std::max(p3.x(), p4.x())), diff --git a/source/blender/freestyle/intern/view_map/Interface0D.h b/source/blender/freestyle/intern/view_map/Interface0D.h index bab996d9308..3d50e978147 100644 --- a/source/blender/freestyle/intern/view_map/Interface0D.h +++ b/source/blender/freestyle/intern/view_map/Interface0D.h @@ -95,7 +95,8 @@ class Interface0D { /*! Returns the 2D point. */ virtual Geometry::Vec2r getPoint2D() const; - /*! Returns the FEdge that lies between this Interface0D and the Interface0D given as argument. */ + /*! Returns the FEdge that lies between this Interface0D and the Interface0D given as argument. + */ virtual FEdge *getFEdge(Interface0D &); /*! Returns the Id of the point. */ @@ -175,8 +176,8 @@ class Interface0DIteratorNested : public Iterator { /*! Class defining an iterator over Interface0D elements. * An instance of this iterator is always obtained from a 1D element. - * \attention In the scripting language, you must call \code it2 = Interface0DIterator(it1) \endcode instead of - * \code it2 = it1 \endcode where \a it1 and \a it2 are 2 Interface0DIterator. + * \attention In the scripting language, you must call \code it2 = Interface0DIterator(it1) + * \endcode instead of \code it2 = it1 \endcode where \a it1 and \a it2 are 2 Interface0DIterator. * Otherwise, incrementing \a it1 will also increment \a it2. */ class Interface0DIterator : public Iterator { @@ -200,9 +201,9 @@ class Interface0DIterator : public Iterator { } /*! Operator = - * \attention In the scripting language, you must call \code it2 = Interface0DIterator(it1) \endcode instead of - * \code it2 = it1 \endcode where \a it1 and \a it2 are 2 Interface0DIterator. - * Otherwise, incrementing \a it1 will also increment \a it2. + * \attention In the scripting language, you must call \code it2 = Interface0DIterator(it1) + * \endcode instead of \code it2 = it1 \endcode where \a it1 and \a it2 are 2 + * Interface0DIterator. Otherwise, incrementing \a it1 will also increment \a it2. */ Interface0DIterator &operator=(const Interface0DIterator &it) { @@ -280,16 +281,16 @@ class Interface0DIterator : public Iterator { return _iterator->decrement(); } - /*! Returns true if the pointed Interface0D is the first of the 1D element containing the points over which - * we're iterating. + /*! Returns true if the pointed Interface0D is the first of the 1D element containing the points + * over which we're iterating. */ virtual bool isBegin() const { return _iterator->isBegin(); } - /*! Returns true if the pointed Interface0D is after the after the last point of the 1D element we're - * iterating from. */ + /*! Returns true if the pointed Interface0D is after the after the last point of the 1D element + * we're iterating from. */ virtual bool isEnd() const { return _iterator->isEnd(); diff --git a/source/blender/freestyle/intern/view_map/Interface1D.h b/source/blender/freestyle/intern/view_map/Interface1D.h index e56a58096f8..e47a5ad8f31 100644 --- a/source/blender/freestyle/intern/view_map/Interface1D.h +++ b/source/blender/freestyle/intern/view_map/Interface1D.h @@ -42,24 +42,28 @@ using namespace std; namespace Freestyle { // Integration method -/*! The different integration methods that can be invoked to integrate into a single value the set of values obtained - * from each 0D element of a 1D element. +/*! The different integration methods that can be invoked to integrate into a single value the set + * of values obtained from each 0D element of a 1D element. */ typedef enum { - MEAN, /*!< The value computed for the 1D element is the mean of the values obtained for the 0D elements.*/ - MIN, /*!< The value computed for the 1D element is the minimum of the values obtained for the 0D elements.*/ - MAX, /*!< The value computed for the 1D element is the maximum of the values obtained for the 0D elements.*/ - FIRST, /*!< The value computed for the 1D element is the first of the values obtained for the 0D elements.*/ - LAST, /*!< The value computed for the 1D element is the last of the values obtained for the 0D elements.*/ + MEAN, /*!< The value computed for the 1D element is the mean of the values obtained for the 0D + elements.*/ + MIN, /*!< The value computed for the 1D element is the minimum of the values obtained for the 0D + elements.*/ + MAX, /*!< The value computed for the 1D element is the maximum of the values obtained for the 0D + elements.*/ + FIRST, /*!< The value computed for the 1D element is the first of the values obtained for the 0D + elements.*/ + LAST, /*!< The value computed for the 1D element is the last of the values obtained for the 0D + elements.*/ } IntegrationType; /*! Returns a single value from a set of values evaluated at each 0D element of this 1D element. * \param fun: * The UnaryFunction0D used to compute a value at each Interface0D. * \param it: - * The Interface0DIterator used to iterate over the 0D elements of this 1D element. The integration will occur - * over the 0D elements starting from the one pointed by it. - * \param it_end: + * The Interface0DIterator used to iterate over the 0D elements of this 1D element. The + * integration will occur over the 0D elements starting from the one pointed by it. \param it_end: * The Interface0DIterator pointing the end of the 0D elements of the 1D element. * \param integration_type: * The integration method used to compute a single value from a set of values. @@ -148,19 +152,17 @@ class Interface1D { /*! Returns an iterator over the Interface1D vertices, pointing after the last vertex. */ virtual Interface0DIterator verticesEnd(); - /*! Returns an iterator over the Interface1D points, pointing to the first point. The difference with - * verticesBegin() is that here we can iterate over points of the 1D element at a any given sampling. - * Indeed, for each iteration, a virtual point is created. - * \param t: - * The sampling with which we want to iterate over points of this 1D element. + /*! Returns an iterator over the Interface1D points, pointing to the first point. The difference + * with verticesBegin() is that here we can iterate over points of the 1D element at a any given + * sampling. Indeed, for each iteration, a virtual point is created. \param t: The sampling with + * which we want to iterate over points of this 1D element. */ virtual Interface0DIterator pointsBegin(float t = 0.0f); - /*! Returns an iterator over the Interface1D points, pointing after the last point. The difference with - * verticesEnd() is that here we can iterate over points of the 1D element at a any given sampling. - * Indeed, for each iteration, a virtual point is created. - * \param t: - * The sampling with which we want to iterate over points of this 1D element. + /*! Returns an iterator over the Interface1D points, pointing after the last point. The + * difference with verticesEnd() is that here we can iterate over points of the 1D element at a + * any given sampling. Indeed, for each iteration, a virtual point is created. \param t: The + * sampling with which we want to iterate over points of this 1D element. */ virtual Interface0DIterator pointsEnd(float t = 0.0f); diff --git a/source/blender/freestyle/intern/view_map/Silhouette.cpp b/source/blender/freestyle/intern/view_map/Silhouette.cpp index af97efa1406..15fe55874ca 100644 --- a/source/blender/freestyle/intern/view_map/Silhouette.cpp +++ b/source/blender/freestyle/intern/view_map/Silhouette.cpp @@ -286,9 +286,9 @@ real FEdge::z_discontinuity() const Vec3r bbox_size_vec(box.getMax() - box.getMin()); real bboxsize = bbox_size_vec.norm(); if (occludee_empty()) { - //return FLT_MAX; + // return FLT_MAX; return 1.0; - //return bboxsize; + // return bboxsize; } #if 0 @@ -302,7 +302,7 @@ real FEdge::z_discontinuity() const real res = disc_vec.norm() / bboxsize; return res; - //return fabs((middle.z() - _occludeeIntersection.z())); + // return fabs((middle.z() - _occludeeIntersection.z())); } #if 0 diff --git a/source/blender/freestyle/intern/view_map/Silhouette.h b/source/blender/freestyle/intern/view_map/Silhouette.h index b9f84e7077f..b5bbe66e51e 100644 --- a/source/blender/freestyle/intern/view_map/Silhouette.h +++ b/source/blender/freestyle/intern/view_map/Silhouette.h @@ -303,7 +303,8 @@ class SVertex : public Interface0D { _Point2D = iPoint2D; } - /*! Adds a normal to the Svertex's set of normals. If the same normal is already in the set, nothing changes. */ + /*! Adds a normal to the Svertex's set of normals. If the same normal is already in the set, + * nothing changes. */ inline void AddNormal(const Vec3r &iNormal) { _Normals.insert(iNormal); // if iNormal in the set already exists, nothing is done @@ -420,7 +421,7 @@ class SVertex : public Interface0D { return *(_Normals.begin()); } - //Material material() const ; + // Material material() const ; Id shape_id() const; const SShape *shape() const; float shape_importance() const; @@ -462,13 +463,12 @@ class SVertex : public Interface0D { class ViewEdge; /*! Base Class for feature edges. - * This FEdge can represent a silhouette, a crease, a ridge/valley, a border or a suggestive contour. - * For silhouettes, the FEdge is oriented such as, the visible face lies on the left of the edge. - * For borders, the FEdge is oriented such as, the face lies on the left of the edge. - * An FEdge can represent an initial edge of the mesh or runs accross a face of the initial mesh depending - * on the smoothness or sharpness of the mesh. - * This class is specialized into a smooth and a sharp version since their properties slightly vary from - * one to the other. + * This FEdge can represent a silhouette, a crease, a ridge/valley, a border or a suggestive + * contour. For silhouettes, the FEdge is oriented such as, the visible face lies on the left of + * the edge. For borders, the FEdge is oriented such as, the face lies on the left of the edge. An + * FEdge can represent an initial edge of the mesh or runs accross a face of the initial mesh + * depending on the smoothness or sharpness of the mesh. This class is specialized into a smooth + * and a sharp version since their properties slightly vary from one to the other. */ class FEdge : public Interface1D { public: // Implementation of Interface0D @@ -509,13 +509,13 @@ class FEdge : public Interface1D { SVertex *_VertexB; Id _Id; Nature::EdgeNature _Nature; - //vector<Polygon3r> _Occluders; // visibility // NOT HANDLED BY THE COPY CONSTRUCTOR!! + // vector<Polygon3r> _Occluders; // visibility // NOT HANDLED BY THE COPY CONSTRUCTOR!! FEdge *_NextEdge; // next edge on the chain FEdge *_PreviousEdge; ViewEdge *_ViewEdge; - // Sometimes we need to deport the visibility computation onto another edge. For example the exact edges use - // edges of the mesh to compute their visibility + // Sometimes we need to deport the visibility computation onto another edge. For example the + // exact edges use edges of the mesh to compute their visibility Polygon3r _aFace; // The occluded face which lies on the right of a silhouette edge Vec3r _occludeeIntersection; @@ -868,7 +868,7 @@ class FEdge : public Interface1D { /* Information access interface */ - //Material material() const; + // Material material() const; Id shape_id() const; const SShape *shape() const; float shape_importance() const; @@ -911,7 +911,7 @@ class FEdge : public Interface1D { int viewedge_nature() const; - //float viewedge_length() const; + // float viewedge_length() const; inline Vec3r orientation2d() const { @@ -942,16 +942,16 @@ class FEdge : public Interface1D { /*! Returns an iterator over the 2 (!) SVertex pointing after the last SVertex. */ virtual inline Interface0DIterator verticesEnd(); - /*! Returns an iterator over the FEdge points, pointing to the first point. The difference with verticesBegin() - * is that here we can iterate over points of the FEdge at a any given sampling. + /*! Returns an iterator over the FEdge points, pointing to the first point. The difference with + * verticesBegin() is that here we can iterate over points of the FEdge at a any given sampling. * Indeed, for each iteration, a virtual point is created. * \param t: * The sampling with which we want to iterate over points of this FEdge. */ virtual inline Interface0DIterator pointsBegin(float t = 0.0f); - /*! Returns an iterator over the FEdge points, pointing after the last point. The difference with verticesEnd() - * is that here we can iterate over points of the FEdge at a any given sampling. + /*! Returns an iterator over the FEdge points, pointing after the last point. The difference with + * verticesEnd() is that here we can iterate over points of the FEdge at a any given sampling. * Indeed, for each iteration, a virtual point is created. * \param t: * The sampling with which we want to iterate over points of this FEdge. @@ -1277,8 +1277,8 @@ class FEdgeSharp : public FEdge { #endif }; -/*! Class defining a smooth edge. This kind of edge typically runs across a face of the input mesh. It can be - * a silhouette, a ridge or valley, a suggestive contour. +/*! Class defining a smooth edge. This kind of edge typically runs across a face of the input mesh. + * It can be a silhouette, a ridge or valley, a suggestive contour. */ class FEdgeSmooth : public FEdge { protected: @@ -1402,7 +1402,8 @@ class FEdgeSmooth : public FEdge { /* */ /**********************************/ -/*! Class to define a feature shape. It is the gathering of feature elements from an identified input shape */ +/*! Class to define a feature shape. It is the gathering of feature elements from an identified + * input shape */ class SShape { private: vector<FEdge *> _chains; // list of fedges that are chains starting points. @@ -1578,10 +1579,10 @@ class SShape { } /*! Splits an edge into several edges. - * The edge's vertices are passed rather than the edge itself. This way, all feature edges (SILHOUETTE, - * CREASE, BORDER) are splitted in the same time. - * The processed edges are flagged as done (using the userdata flag).One single new vertex is created whereas - * several splitted edges might created for the different kinds of edges. These new elements are added to the lists + * The edge's vertices are passed rather than the edge itself. This way, all feature edges + * (SILHOUETTE, CREASE, BORDER) are splitted in the same time. The processed edges are flagged as + * done (using the userdata flag).One single new vertex is created whereas several splitted edges + * might created for the different kinds of edges. These new elements are added to the lists * maintained by the shape. * New chains are also created. * ioA @@ -1589,12 +1590,11 @@ class SShape { * ioB * The second vertex for the edge that gets splitted * iParameters - * A vector containing 2D real vectors indicating the parameters giving the intersections coordinates in - * 3D and in 2D. These intersections points must be sorted from B to A. - * Each parameter defines the intersection point I as I=A+T*AB. T<0 and T>1 are then incorrect insofar as - * they give intersections points that lie outside the segment. - * ioNewEdges - * The edges that are newly created (the initial edges are not included) are added to this list. + * A vector containing 2D real vectors indicating the parameters giving the intersections + * coordinates in 3D and in 2D. These intersections points must be sorted from B to A. Each + * parameter defines the intersection point I as I=A+T*AB. T<0 and T>1 are then incorrect insofar + * as they give intersections points that lie outside the segment. ioNewEdges The edges that are + * newly created (the initial edges are not included) are added to this list. */ inline void SplitEdge(FEdge *fe, const vector<Vec2r> &iParameters, vector<FEdge *> &ioNewEdges) { @@ -1637,7 +1637,7 @@ class SShape { for (vector<SVertex *>::iterator sv = intersections.begin(), svend = intersections.end(); sv != svend; sv++) { - //SVertex *svA = fe->vertexA(); + // SVertex *svA = fe->vertexA(); SVertex *svB = fe->vertexB(); // We split edge AB into AA' and A'B. A' and A'B are created. @@ -1678,7 +1678,7 @@ class SShape { fe->setId(id); // update edge AA' for the next pointing edge - //ioEdge->setNextEdge(newEdge); + // ioEdge->setNextEdge(newEdge); (fe)->setNextEdge(NULL); // update vertex pointing edges list: @@ -1690,17 +1690,13 @@ class SShape { } } - /* splits an edge into 2 edges. The new vertex and edge are added to the sshape list of vertices and edges - * a new chain is also created. - * returns the new edge. - * ioEdge - * The edge that gets splitted - * newpoint - * x,y,z coordinates of the new point. + /* splits an edge into 2 edges. The new vertex and edge are added to the sshape list of vertices + * and edges a new chain is also created. returns the new edge. ioEdge The edge that gets + * splitted newpoint x,y,z coordinates of the new point. */ inline FEdge *SplitEdgeIn2(FEdge *ioEdge, SVertex *ioNewVertex) { - //soc unused - SVertex *A = ioEdge->vertexA(); + // soc unused - SVertex *A = ioEdge->vertexA(); SVertex *B = ioEdge->vertexB(); // We split edge AB into AA' and A'B. A' and A'B are created. diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp index eeec347efc6..1d0ac8634dd 100644 --- a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp +++ b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.cpp @@ -16,8 +16,8 @@ /** \file * \ingroup freestyle - * \brief Class to perform all geometric operations dedicated to silhouette. That, for example, implies that - * this geom engine has as member data the viewpoint, transformations, projections... + * \brief Class to perform all geometric operations dedicated to silhouette. That, for example, + * implies that this geom engine has as member data the viewpoint, transformations, projections... */ #include <cstring> @@ -150,7 +150,8 @@ real SilhouetteGeomEngine::ImageToWorldParameter(FEdge *fe, real t) if (_isOrthographicProjection) return t; - // we need to compute for each parameter t the corresponding parameter T which gives the intersection in 3D. + // we need to compute for each parameter t the corresponding parameter T which gives the + // intersection in 3D. real T; // suffix w for world, c for camera, r for retina, i for image diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h index 306eb3a55be..79d863e81e7 100644 --- a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h +++ b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h @@ -19,8 +19,8 @@ /** \file * \ingroup freestyle - * \brief Class to perform all geometric operations dedicated to silhouette. That, for example, implies that - * this geom engine has as member data the viewpoint, transformations, projections... + * \brief Class to perform all geometric operations dedicated to silhouette. That, for example, + * implies that this geom engine has as member data the viewpoint, transformations, projections... */ #include <vector> diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp index 1a7f01d288f..0c6e9741fbd 100644 --- a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp +++ b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp @@ -187,9 +187,9 @@ void SphericalGrid::distributePolygons(OccluderSource &source) } } catch (...) { - // If an exception was thrown, _faces.push_back() cannot have succeeded. Occluder is not owned by anyone, - // and must be deleted. If the exception was thrown before or during new OccluderData(), then - // occluder is NULL, and this delete is harmless. + // If an exception was thrown, _faces.push_back() cannot have succeeded. Occluder is not + // owned by anyone, and must be deleted. If the exception was thrown before or during new + // OccluderData(), then occluder is NULL, and this delete is harmless. delete occluder; throw; } diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.h b/source/blender/freestyle/intern/view_map/SphericalGrid.h index ae00c270c1d..c32ceb09805 100644 --- a/source/blender/freestyle/intern/view_map/SphericalGrid.h +++ b/source/blender/freestyle/intern/view_map/SphericalGrid.h @@ -24,8 +24,9 @@ #define SPHERICAL_GRID_LOGGING 0 -// I would like to avoid using deque because including ViewMap.h and <deque> or <vector> separately results in -// redefinitions of identifiers. ViewMap.h already includes <vector> so it should be a safe fall-back. +// I would like to avoid using deque because including ViewMap.h and <deque> or <vector> separately +// results in redefinitions of identifiers. ViewMap.h already includes <vector> so it should be a +// safe fall-back. //#include <vector> //#include <deque> @@ -57,9 +58,9 @@ class SphericalGrid { Polygon3r poly; Polygon3r cameraSpacePolygon; real shallowest, deepest; - // 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. + // 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; #ifdef WITH_CXX_GUARDEDALLOC @@ -70,8 +71,8 @@ class SphericalGrid { private: struct Cell { // Can't store Cell in a vector without copy and assign - //Cell(const Cell& other); - //Cell& operator=(const Cell& other); + // Cell(const Cell& other); + // Cell& operator=(const Cell& other); explicit Cell(); ~Cell(); @@ -83,25 +84,28 @@ class SphericalGrid { void indexPolygons(); real boundary[4]; - //deque<OccluderData*> faces; + // deque<OccluderData*> faces; vector<OccluderData *> faces; }; public: /*! Iterator needs to allow the user to avoid full 3D comparison in two cases: * - * (1) Where (*current)->deepest < target[2], where the occluder is unambiguously in front of the target point. + * (1) Where (*current)->deepest < target[2], where the occluder is unambiguously in front of + * the target point. * - * (2) Where (*current)->shallowest > target[2], where the occluder is unambiguously in back of the target point. + * (2) Where (*current)->shallowest > target[2], where the occluder is unambiguously in back of + * the target point. * - * In addition, when used by OptimizedFindOccludee, Iterator should stop iterating as soon as it has an occludee - * candidate and (*current)->shallowest > candidate[2], because at that point forward no new occluder could - * possibly be a better occludee. + * In addition, when used by OptimizedFindOccludee, Iterator should stop iterating as soon as it + * has an occludee candidate and (*current)->shallowest > candidate[2], because at that point + * forward no new occluder could possibly be a better occludee. */ class Iterator { public: - // epsilon is not used in this class, but other grids with the same interface may need an epsilon + // epsilon is not used in this class, but other grids with the same interface may need an + // epsilon explicit Iterator(SphericalGrid &grid, Vec3r ¢er, real epsilon = 1.0e-06); ~Iterator(); void initBeforeTarget(); @@ -122,7 +126,7 @@ class SphericalGrid { Vec3r _target; bool _foundOccludee; real _occludeeDepth; - //deque<OccluderData*>::iterator _current, _occludeeCandidate; + // deque<OccluderData*>::iterator _current, _occludeeCandidate; vector<OccluderData *>::iterator _current, _occludeeCandidate; #ifdef WITH_CXX_GUARDEDALLOC @@ -171,7 +175,7 @@ class SphericalGrid { void getCellCoordinates(const Vec3r &point, unsigned &x, unsigned &y); typedef PointerSequence<vector<Cell *>, Cell *> cellContainer; - //typedef PointerSequence<deque<OccluderData*>, OccluderData*> occluderContainer; + // typedef PointerSequence<deque<OccluderData*>, OccluderData*> occluderContainer; typedef PointerSequence<vector<OccluderData *>, OccluderData *> occluderContainer; unsigned _cellsX, _cellsY; float _cellSize; @@ -222,8 +226,8 @@ inline bool SphericalGrid::Iterator::testOccluder(bool wantOccludee) { // End-of-list is not even a valid iterator position if (_current == _cell->faces.end()) { - // Returning true seems strange, but it will break us out of whatever loop is calling testOccluder, and - // _current=_cell->face.end() will make the calling routine give up. + // Returning true seems strange, but it will break us out of whatever loop is calling + // testOccluder, and _current=_cell->face.end() will make the calling routine give up. return true; } #if SPHERICAL_GRID_LOGGING @@ -286,15 +290,17 @@ inline bool SphericalGrid::Iterator::testOccluder(bool wantOccludee) return false; } - // We've done all the corner cutting we can. Let the caller work out whether or not the geometry is correct. + // We've done all the corner cutting we can. Let the caller work out whether or not the geometry + // is correct. return true; } inline void SphericalGrid::Iterator::reportDepth(Vec3r origin, Vec3r u, real t) { - // The reported depth is the length of a ray in camera space. We need to convert it into the distance from viewpoint - // 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. + // The reported depth is the length of a ray in camera space. We need to convert it into the + // distance from viewpoint 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 (G.debug & G_DEBUG_FREESTYLE) { diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp index d9258a05ebd..d1f9a5b41bd 100644 --- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp @@ -16,7 +16,8 @@ /** \file * \ingroup freestyle - * \brief Convenient access to the steerable ViewMap to which any element of the ViewMap belongs to. + * \brief Convenient access to the steerable ViewMap to which any element of the ViewMap belongs + * to. */ #include <sstream> @@ -146,7 +147,7 @@ double *SteerableViewMap::AddFEdge(FEdge *iFEdge) unsigned SteerableViewMap::getSVMNumber(const Vec2f &orient) { Vec2f dir(orient); - //soc unsigned res = 0; + // soc unsigned res = 0; real norm = dir.norm(); if (norm < 1.0e-6) { return _nbOrientations + 1; @@ -211,11 +212,11 @@ float SteerableViewMap::readSteerableViewMapPixel(unsigned iOrientation, int iLe } if ((x < 0) || (x >= pyramid->width()) || (y < 0) || (y >= pyramid->height())) return 0; - //float v = pyramid->pixel(x, pyramid->height() - 1 - y, iLevel) * 255.0f; - // We encode both the directionality and the lines counting on 8 bits (because of frame buffer). Thus, we allow - // until 8 lines to pass through the same pixel, so that we can discretize the Pi/_nbOrientations angle into - // 32 slices. Therefore, for example, in the vertical direction, a vertical line will have the value 32 on - // each pixel it passes through. + // float v = pyramid->pixel(x, pyramid->height() - 1 - y, iLevel) * 255.0f; + // We encode both the directionality and the lines counting on 8 bits (because of frame buffer). + // Thus, we allow until 8 lines to pass through the same pixel, so that we can discretize the + // Pi/_nbOrientations angle into 32 slices. Therefore, for example, in the vertical direction, a + // vertical line will have the value 32 on each pixel it passes through. float v = pyramid->pixel(x, pyramid->height() - 1 - y, iLevel) / 32.0f; return v; } @@ -243,31 +244,31 @@ void SteerableViewMap::saveSteerableViewMap() const int ow = _imagesPyramids[i]->width(0); int oh = _imagesPyramids[i]->height(0); - //soc QString base("SteerableViewMap"); + // soc QString base("SteerableViewMap"); string base("SteerableViewMap"); stringstream filename; - for (int j = 0; j < _imagesPyramids[i]->getNumberOfLevels(); ++j) { //soc + for (int j = 0; j < _imagesPyramids[i]->getNumberOfLevels(); ++j) { // soc float coeff = 1.0f; // 1 / 255.0f; // 100 * 255; // * pow(2, j); - //soc QImage qtmp(ow, oh, QImage::Format_RGB32); + // soc QImage qtmp(ow, oh, QImage::Format_RGB32); ImBuf *ibuf = IMB_allocImBuf(ow, oh, 32, IB_rect); int rowbytes = ow * 4; char *pix; - for (int y = 0; y < oh; ++y) { //soc - for (int x = 0; x < ow; ++x) { //soc + for (int y = 0; y < oh; ++y) { // soc + for (int x = 0; x < ow; ++x) { // soc int c = (int)(coeff * _imagesPyramids[i]->pixel(x, y, j)); if (c > 255) c = 255; - //int c = (int)(_imagesPyramids[i]->pixel(x, y, j)); + // int c = (int)(_imagesPyramids[i]->pixel(x, y, j)); - //soc qtmp.setPixel(x, y, qRgb(c, c, c)); + // soc qtmp.setPixel(x, y, qRgb(c, c, c)); pix = (char *)ibuf->rect + y * rowbytes + x * 4; pix[0] = pix[1] = pix[2] = c; } } - //soc qtmp.save(base+QString::number(i)+"-"+QString::number(j)+".png", "PNG"); + // soc qtmp.save(base+QString::number(i)+"-"+QString::number(j)+".png", "PNG"); filename << base; filename << i << "-" << j << ".png"; ibuf->ftype = IMB_FTYPE_PNG; diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.h b/source/blender/freestyle/intern/view_map/SteerableViewMap.h index 16f57f39737..27a27540a09 100644 --- a/source/blender/freestyle/intern/view_map/SteerableViewMap.h +++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.h @@ -19,7 +19,8 @@ /** \file * \ingroup freestyle - * \brief Convenient access to the steerable ViewMap to which any element of the ViewMap belongs to. + * \brief Convenient access to the steerable ViewMap to which any element of the ViewMap belongs + * to. */ #include <map> @@ -42,8 +43,8 @@ class FEdge; class ImagePyramid; class GrayImage; -/*! This class checks for every FEdge in which steerable it belongs and stores the mapping allowing to retrieve - * this information from the FEdge Id. +/*! This class checks for every FEdge in which steerable it belongs and stores the mapping allowing + * to retrieve this information from the FEdge Id. */ class SteerableViewMap { protected: @@ -66,8 +67,8 @@ class SteerableViewMap { virtual void Reset(); /*! Adds a FEdge to steerable VM. - * Returns the nbOrientations weights corresponding to the FEdge contributions to the nbOrientations - * directional maps. + * Returns the nbOrientations weights corresponding to the FEdge contributions to the + * nbOrientations directional maps. */ double *AddFEdge(FEdge *iFEdge); @@ -86,17 +87,13 @@ class SteerableViewMap { */ unsigned getSVMNumber(unsigned id); - /*! Builds _nbOrientations+1 pyramids of images from the _nbOrientations+1 base images of the steerable viewmap. - * \param steerableBases: - * The _nbOrientations+1 images constituting the basis for the steerable pyramid. - * \param copy: - * If false, the data is not duplicated, and Canvas deals with the memory management of these - * _nbOrientations+1 images. If true, data is copied, and it's up to the caller to delete the images. - * \param iNbLevels: - * The number of levels desired for each pyramid. - * If iNbLevels == 0, the complete pyramid is built. - * \param iSigma: - * The sigma that will be used for the gaussian blur + /*! Builds _nbOrientations+1 pyramids of images from the _nbOrientations+1 base images of the + * steerable viewmap. \param steerableBases: The _nbOrientations+1 images constituting the basis + * for the steerable pyramid. \param copy: If false, the data is not duplicated, and Canvas deals + * with the memory management of these _nbOrientations+1 images. If true, data is copied, and + * it's up to the caller to delete the images. \param iNbLevels: The number of levels desired for + * each pyramid. If iNbLevels == 0, the complete pyramid is built. \param iSigma: The sigma that + * will be used for the gaussian blur */ void buildImagesPyramids(GrayImage **steerableBases, bool copy = false, @@ -116,15 +113,15 @@ class SteerableViewMap { * \param iLevel: * The level of the pyramid we want to read * \param x: - * The abscissa of the desired pixel specified in level0 coordinate system. The origin is the lower left corner. - * \param y: - * The ordinate of the desired pixel specified in level0 coordinate system. The origin is the lower left corner. + * The abscissa of the desired pixel specified in level0 coordinate system. The origin is the + * lower left corner. \param y: The ordinate of the desired pixel specified in level0 coordinate + * system. The origin is the lower left corner. */ float readSteerableViewMapPixel(unsigned iOrientation, int iLevel, int x, int y); - /*! Reads a pixel in the one of the level of the pyramid containing the images of the complete ViewMap. - * Returns a value between 0 and 1. - * Equivalent to : readSteerableViewMapPixel(nbOrientations, x, y) + /*! Reads a pixel in the one of the level of the pyramid containing the images of the complete + * ViewMap. Returns a value between 0 and 1. Equivalent to : + * readSteerableViewMapPixel(nbOrientations, x, y) */ float readCompleteViewMapPixel(int iLevel, int x, int y); diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp index 629ec3d5d77..8715f4f52d9 100644 --- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp @@ -79,8 +79,8 @@ void ViewEdgeXBuilder::BuildViewEdges(WXShape *iWShape, continue; if (stopSmoothViewEdge((*sl))) // has it been parsed already ? continue; - // here we know that we're dealing with a face layer that has not been processed yet and that contains - // a smooth edge. + // here we know that we're dealing with a face layer that has not been processed yet and that + // contains a smooth edge. /* vedge =*//* UNUSED */ BuildSmoothViewEdge(OWXFaceLayer(*sl, true)); } } @@ -89,7 +89,7 @@ void ViewEdgeXBuilder::BuildViewEdges(WXShape *iWShape, //---------------------------------- // Reset all userdata for WXEdge structure //---------------------------------------- - //iWShape->ResetUserData(); + // iWShape->ResetUserData(); WXEdge *wxe; vector<WEdge *> &wedges = iWShape->getEdgeList(); @@ -339,7 +339,8 @@ OWXFaceLayer ViewEdgeXBuilder::FindNextFaceLayer(const OWXFaceLayer &iFaceLayer) nextFace = dynamic_cast<WXFace *>(iFaceLayer.fl->getFace()->GetBordingFace(woeend)); if (!nextFace) 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 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); vector<WXFaceLayer *> sameNatureLayers; @@ -411,7 +412,8 @@ OWXFaceLayer ViewEdgeXBuilder::FindPreviousFaceLayer(const OWXFaceLayer &iFaceLa previousFace = dynamic_cast<WXFace *>(iFaceLayer.fl->getFace()->GetBordingFace(woebegin)); if (0 == previousFace) 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 the next face layer has either no smooth edge or no smooth edge of same nature, no next + // face if (!previousFace->hasSmoothEdges()) return OWXFaceLayer(NULL, true); vector<WXFaceLayer *> sameNatureLayers; @@ -688,7 +690,7 @@ FEdge *ViewEdgeXBuilder::BuildSharpFEdge(FEdge *feprevious, const OWXEdge &iwe) _pCurrentSShape->AddEdge(fe); va->AddFEdge(fe); vb->AddFEdge(fe); - //Add normals: + // Add normals: va->AddNormal(normalA); va->AddNormal(normalB); vb->AddNormal(normalA); diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h index 6f3604a1029..26f114497c0 100644 --- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h +++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h @@ -28,7 +28,8 @@ #if 0 // soc # if defined(__GNUC__) && (__GNUC__ >= 3) -//hash_map is not part of the C++ standard anymore; hash_map.h has been kept though for backward compatibility +/* hash_map is not part of the C++ standard anymore; + * hash_map.h has been kept though for backward compatibility */ # include <hash_map.h> # else # include <hash_map> @@ -278,9 +279,9 @@ class ViewEdgeXBuilder { /*! instanciate a ViewVertex from a SVertex, if it doesn't exist yet */ ViewVertex *MakeViewVertex(SVertex *iSVertex); - //oldtmp values - //IdHashTable _hashtable; - //VVIdHashTable _multivertexHashTable; + // oldtmp values + // IdHashTable _hashtable; + // VVIdHashTable _multivertexHashTable; SVertexMap _SVertexMap; SShape *_pCurrentSShape; ViewShape *_pCurrentVShape; diff --git a/source/blender/freestyle/intern/view_map/ViewMap.cpp b/source/blender/freestyle/intern/view_map/ViewMap.cpp index d859f83079c..0b352be1a89 100644 --- a/source/blender/freestyle/intern/view_map/ViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMap.cpp @@ -155,8 +155,8 @@ TVertex *ViewMap::CreateTVertex(const Vec3r &iA3D, SVertex *Ia = shapeA->CreateSVertex(iA3D, iA2D, iFEdgeA->vertexA()->getId()); SVertex *Ib = shapeB->CreateSVertex(iB3D, iB2D, iFEdgeB->vertexA()->getId()); - // depending on which of these 2 svertices is the nearest from the viewpoint, we're going to build the TVertex - // by giving them in an order or another (the first one must be the nearest) + // depending on which of these 2 svertices is the nearest from the viewpoint, we're going to + // build the TVertex by giving them in an order or another (the first one must be the nearest) real dista = Ia->point2D()[2]; real distb = Ib->point2D()[2]; @@ -185,8 +185,8 @@ ViewVertex *ViewMap::InsertViewVertex(SVertex *iVertex, vector<ViewEdge *> &newV NonTVertex *vva = dynamic_cast<NonTVertex *>(iVertex->viewvertex()); if (vva) 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 + // 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(); if (fedges.size() != 2) { cerr << "ViewMap warning: Can't split the ViewEdge" << endl; @@ -235,7 +235,7 @@ ViewVertex *ViewMap::InsertViewVertex(SVertex *iVertex, vector<ViewEdge *> &newV ViewEdge *newVEdge = new ViewEdge(vva, ioEdge->B(), fbegin, ioEdge->fedgeB(), vshape); newVEdge->setId(Id(ioEdge->getId().getFirst(), ioEdge->getId().getSecond() + 1)); newVEdge->setNature(ioEdge->getNature()); - //newVEdge->UpdateFEdges(); // done in the ViewEdge constructor + // newVEdge->UpdateFEdges(); // done in the ViewEdge constructor // Update old ViewEdge ioEdge->setB(vva); ioEdge->setFEdgeB(fend); @@ -253,7 +253,7 @@ ViewVertex *ViewMap::InsertViewVertex(SVertex *iVertex, vector<ViewEdge *> &newV vvb->Replace(ioEdge, newVEdge); // update ViewShape - //vshape->AddEdge(newVEdge); + // vshape->AddEdge(newVEdge); // update SShape vshape->sshape()->AddChain(fbegin); // update ViewMap @@ -421,25 +421,27 @@ void TVertex::Replace(ViewEdge *iOld, ViewEdge *iNew) /*! iterators access */ ViewVertex::edge_iterator TVertex::edges_begin() { - //return edge_iterator(_FrontEdgeA, _FrontEdgeB, _BackEdgeA, _BackEdgeB, _FrontEdgeA); + // return edge_iterator(_FrontEdgeA, _FrontEdgeB, _BackEdgeA, _BackEdgeB, _FrontEdgeA); return edge_iterator(_sortedEdges.begin(), _sortedEdges.end(), _sortedEdges.begin()); } ViewVertex::const_edge_iterator TVertex::edges_begin() const { - //return const_edge_iterator(_FrontEdgeA, _FrontEdgeB, _BackEdgeA, _BackEdgeB, _FrontEdgeA); + // return const_edge_iterator(_FrontEdgeA, _FrontEdgeB, _BackEdgeA, _BackEdgeB, _FrontEdgeA); return const_edge_iterator(_sortedEdges.begin(), _sortedEdges.end(), _sortedEdges.begin()); } ViewVertex::edge_iterator TVertex::edges_end() { - //return edge_iterator(_FrontEdgeA, _FrontEdgeB, _BackEdgeA, _BackEdgeB, directedViewEdge(0,true)); + // return edge_iterator(_FrontEdgeA, _FrontEdgeB, _BackEdgeA, _BackEdgeB, + // directedViewEdge(0,true)); return edge_iterator(_sortedEdges.begin(), _sortedEdges.end(), _sortedEdges.end()); } ViewVertex::const_edge_iterator TVertex::edges_end() const { - //return const_edge_iterator(_FrontEdgeA, _FrontEdgeB, _BackEdgeA, _BackEdgeB, directedViewEdge(0, true)); + // return const_edge_iterator(_FrontEdgeA, _FrontEdgeB, _BackEdgeA, _BackEdgeB, + // directedViewEdge(0, true)); return const_edge_iterator(_sortedEdges.begin(), _sortedEdges.end(), _sortedEdges.end()); } diff --git a/source/blender/freestyle/intern/view_map/ViewMap.h b/source/blender/freestyle/intern/view_map/ViewMap.h index 96c9c3c0b4a..011090d8e67 100644 --- a/source/blender/freestyle/intern/view_map/ViewMap.h +++ b/source/blender/freestyle/intern/view_map/ViewMap.h @@ -75,8 +75,8 @@ class ViewMap { fedges_container _FEdges; // feature edges (embedded edges) svertices_container _SVertices; // embedded vertices BBox<Vec3r> _scene3DBBox; - // Mapping between the WShape or VShape id to the VShape index in the _VShapes vector. Used in the method - // viewShape(int id) to access a shape from its id. + // Mapping between the WShape or VShape id to the VShape index in the _VShapes vector. Used in + // the method viewShape(int id) to access a shape from its id. id_to_index_map _shapeIdToIndex; public: @@ -222,16 +222,15 @@ class ViewMap { FEdge *iFEdgeB, const Id &id); - /* Updates the structures to take into account the fact that a SVertex must now be considered as a ViewVertex - * iVertex - * The SVertex on top of which the ViewVertex is built (it is necessarily a NonTVertex because it is a SVertex) - * newViewEdges - * The new ViewEdges that must be add to the ViewMap + /* Updates the structures to take into account the fact that a SVertex must now be considered as + * a ViewVertex iVertex The SVertex on top of which the ViewVertex is built (it is necessarily a + * NonTVertex because it is a SVertex) newViewEdges The new ViewEdges that must be add to the + * ViewMap */ ViewVertex *InsertViewVertex(SVertex *iVertex, vector<ViewEdge *> &newViewEdges); /* connects a FEdge to the graph trough a SVertex */ - //FEdge *Connect(FEdge *ioEdge, SVertex *ioVertex); + // FEdge *Connect(FEdge *ioEdge, SVertex *ioVertex); /* Clean temporary FEdges created by chaining */ virtual void Clean(); @@ -262,11 +261,12 @@ class orientedViewEdgeIterator; } // namespace ViewVertexInternal /*! Class to define a view vertex. - * A view vertex is a feature vertex corresponding to a point of the image graph, where the characteristics of an - * edge might change (nature, visibility, ...). - * A ViewVertex can be of two kinds: a TVertex when it corresponds to the intersection between two ViewEdges or a - * NonTVertex when it corresponds to a vertex of the initial input mesh (it is the case for vertices such as corners - * for example). Thus, this class can be specialized into two classes, the TVertex class and the NonTVertex class. + * A view vertex is a feature vertex corresponding to a point of the image graph, where the + * characteristics of an edge might change (nature, visibility, ...). A ViewVertex can be of two + * kinds: a TVertex when it corresponds to the intersection between two ViewEdges or a NonTVertex + * when it corresponds to a vertex of the initial input mesh (it is the case for vertices such as + * corners for example). Thus, this class can be specialized into two classes, the TVertex class + * and the NonTVertex class. */ class ViewVertex : public Interface0D { public: // Implementation of Interface0D @@ -348,8 +348,8 @@ class ViewVertex : public Interface0D { public: /* iterators access */ - // allows iteration on the edges that comes from/goes to this vertex in CCW order (order defined in 2D in the - // image plan) + // allows iteration on the edges that comes from/goes to this vertex in CCW order (order defined + // in 2D in the image plan) virtual edge_iterator edges_begin() = 0; virtual const_edge_iterator edges_begin() const = 0; virtual edge_iterator edges_end() = 0; @@ -358,13 +358,14 @@ class ViewVertex : public Interface0D { virtual const_edge_iterator edges_iterator(ViewEdge *iEdge) const = 0; // Iterator access - /*! Returns an iterator over the ViewEdges that goes to or comes from this ViewVertex pointing to the first - * ViewEdge of the list. The orientedViewEdgeIterator allows to iterate in CCW order over these ViewEdges - * and to get the orientation for each ViewEdge (incoming/outgoing). + /*! Returns an iterator over the ViewEdges that goes to or comes from this ViewVertex pointing to + * the first ViewEdge of the list. The orientedViewEdgeIterator allows to iterate in CCW order + * over these ViewEdges and to get the orientation for each ViewEdge (incoming/outgoing). */ virtual ViewVertexInternal::orientedViewEdgeIterator edgesBegin() = 0; - /*! Returns an orientedViewEdgeIterator over the ViewEdges around this ViewVertex, pointing after the last ViewEdge. + /*! Returns an orientedViewEdgeIterator over the ViewEdges around this ViewVertex, pointing after + * the last ViewEdge. */ virtual ViewVertexInternal::orientedViewEdgeIterator edgesEnd() = 0; @@ -477,7 +478,8 @@ class TVertex : public ViewVertex { directedViewEdge _FrontEdgeB; directedViewEdge _BackEdgeA; directedViewEdge _BackEdgeB; - Id _Id; // id to identify t vertices . these id will be negative in order not to be mixed with NonTVertex ids. + Id _Id; // id to identify t vertices . these id will be negative in order not to be mixed with + // NonTVertex ids. edge_pointers_container _sortedEdges; // the list of the four ViewEdges, ordered in CCW order (in the image plan) @@ -606,8 +608,8 @@ class TVertex : public ViewVertex { virtual void Replace(ViewEdge *iOld, ViewEdge *iNew); /*! returns the mate edge of iEdgeA. - * For example, if iEdgeA is frontEdgeA, then frontEdgeB is returned. If iEdgeA is frontEdgeB then frontEdgeA - * is returned. Same for back edges + * For example, if iEdgeA is frontEdgeA, then frontEdgeB is returned. If iEdgeA is frontEdgeB + * then frontEdgeA is returned. Same for back edges */ virtual ViewEdge *mate(ViewEdge *iEdgeA) { @@ -630,13 +632,14 @@ class TVertex : public ViewVertex { virtual edge_iterator edges_iterator(ViewEdge *iEdge); virtual const_edge_iterator edges_iterator(ViewEdge *iEdge) const; - /*! Returns an iterator over the ViewEdges that goes to or comes from this ViewVertex pointing to the first - * ViewEdge of the list. The orientedViewEdgeIterator allows to iterate in CCW order over these ViewEdges - * and to get the orientation for each ViewEdge (incoming/outgoing). + /*! Returns an iterator over the ViewEdges that goes to or comes from this ViewVertex pointing to + * the first ViewEdge of the list. The orientedViewEdgeIterator allows to iterate in CCW order + * over these ViewEdges and to get the orientation for each ViewEdge (incoming/outgoing). */ virtual ViewVertexInternal::orientedViewEdgeIterator edgesBegin(); - /*! Returns an orientedViewEdgeIterator over the ViewEdges around this ViewVertex, pointing after the last ViewEdge. + /*! Returns an orientedViewEdgeIterator over the ViewEdges around this ViewVertex, pointing after + * the last ViewEdge. */ virtual ViewVertexInternal::orientedViewEdgeIterator edgesEnd(); @@ -847,13 +850,14 @@ class NonTVertex : public ViewVertex { virtual edge_iterator edges_iterator(ViewEdge *iEdge); virtual const_edge_iterator edges_iterator(ViewEdge *iEdge) const; - /*! Returns an iterator over the ViewEdges that goes to or comes from this ViewVertex pointing to the first - * ViewEdge of the list. The orientedViewEdgeIterator allows to iterate in CCW order over these ViewEdges - * and to get the orientation for each ViewEdge (incoming/outgoing). + /*! Returns an iterator over the ViewEdges that goes to or comes from this ViewVertex pointing to + * the first ViewEdge of the list. The orientedViewEdgeIterator allows to iterate in CCW order + * over these ViewEdges and to get the orientation for each ViewEdge (incoming/outgoing). */ virtual ViewVertexInternal::orientedViewEdgeIterator edgesBegin(); - /*! Returns an orientedViewEdgeIterator over the ViewEdges around this ViewVertex, pointing after the last ViewEdge. + /*! Returns an orientedViewEdgeIterator over the ViewEdges around this ViewVertex, pointing after + * the last ViewEdge. */ virtual ViewVertexInternal::orientedViewEdgeIterator edgesEnd(); @@ -891,8 +895,8 @@ template<class Traits> class vertex_iterator_base; } // end of namespace ViewEdgeInternal -/*! Class defining a ViewEdge. A ViewEdge in an edge of the image graph. it connects two ViewVertex. - * It is made by connecting a set of FEdges. +/*! Class defining a ViewEdge. A ViewEdge in an edge of the image graph. it connects two + * ViewVertex. It is made by connecting a set of FEdges. */ class ViewEdge : public Interface1D { public: // Implementation of Interface0D @@ -937,9 +941,9 @@ class ViewEdge : public Interface1D { FEdge *_FEdgeB; // last edge of the embedded fedges chain Id _Id; unsigned _ChainingTimeStamp; - // The silhouette view edge separates 2 2D spaces. The one on the left is necessarly the Shape _Shape (the one to - // which this edge belongs to) and _aShape is the one on its right - // NOT HANDLED BY THE COPY CONSTRUCTOR + // The silhouette view edge separates 2 2D spaces. The one on the left is necessarly the Shape + // _Shape (the one to which this edge belongs to) and _aShape is the one on its right NOT HANDLED + // BY THE COPY CONSTRUCTOR ViewShape *_aShape; int _qi; vector<ViewShape *> _Occluders; @@ -1016,7 +1020,7 @@ class ViewEdge : public Interface1D { UpdateFEdges(); // tells every FEdge between iFEdgeA and iFEdgeB that this is theit ViewEdge } - //soc protected: + // soc protected: /*! Copy constructor. */ inline ViewEdge(ViewEdge &iBrother) { @@ -1091,9 +1095,8 @@ class ViewEdge : public Interface1D { return _Shape; } - /*! Returns the shape that is occluded by the ViewShape to which this ViewEdge belongs to. If no object is occluded, - * NULL is returned. - * \return The occluded ViewShape. + /*! Returns the shape that is occluded by the ViewShape to which this ViewEdge belongs to. If no + * object is occluded, NULL is returned. \return The occluded ViewShape. */ inline ViewShape *aShape() { @@ -1316,7 +1319,7 @@ class ViewEdge : public Interface1D { return false; } - //inline real z_discontinuity(int iCombination = 0) const; + // inline real z_discontinuity(int iCombination = 0) const; inline Id shape_id() const { @@ -1353,25 +1356,24 @@ class ViewEdge : public Interface1D { vertex_iterator vertices_end(); // Iterator access (Interface1D) - /*! Returns an Interface0DIterator to iterate over the SVertex constituting the embedding of this ViewEdge. - * The returned Interface0DIterator points to the first SVertex of the ViewEdge. + /*! Returns an Interface0DIterator to iterate over the SVertex constituting the embedding of this + * ViewEdge. The returned Interface0DIterator points to the first SVertex of the ViewEdge. */ virtual Interface0DIterator verticesBegin(); - /*! Returns an Interface0DIterator to iterate over the SVertex constituting the embedding of this ViewEdge. - * The returned Interface0DIterator points after the last SVertex of the ViewEdge. + /*! Returns an Interface0DIterator to iterate over the SVertex constituting the embedding of this + * ViewEdge. The returned Interface0DIterator points after the last SVertex of the ViewEdge. */ virtual Interface0DIterator verticesEnd(); - /*! Returns an Interface0DIterator to iterate over the points of this ViewEdge at a given resolution. - * The returned Interface0DIterator points on the first Point of the ViewEdge. - * \param t: - * the sampling value. + /*! Returns an Interface0DIterator to iterate over the points of this ViewEdge at a given + * resolution. The returned Interface0DIterator points on the first Point of the ViewEdge. \param + * t: the sampling value. */ virtual Interface0DIterator pointsBegin(float t = 0.0f); - /*! Returns an Interface0DIterator to iterate over the points of this ViewEdge at a given resolution. - * The returned Interface0DIterator points after the last Point of the ViewEdge. + /*! Returns an Interface0DIterator to iterate over the points of this ViewEdge at a given + * resolution. The returned Interface0DIterator points after the last Point of the ViewEdge. * \param t: * the sampling value. */ @@ -1390,7 +1392,8 @@ class ViewEdge : public Interface1D { /* */ /**********************************/ -/*! Class gathering the elements of the ViewMap (ViewVertex, ViewEdge) that are issued from the same input shape. */ +/*! Class gathering the elements of the ViewMap (ViewVertex, ViewEdge) that are issued from the + * same input shape. */ class ViewShape { private: vector<ViewVertex *> _Vertices; @@ -1520,11 +1523,10 @@ class ViewShape { * The FEdge that gets splitted * iViewVertices * The view vertices corresponding to the different intersections for the edge fe. - * This list need to be sorted such as the first view vertex is the farther away from fe->vertexA. - * ioNewEdges - * The feature edges that are newly created (the initial edges are not included) are added to this list. - * ioNewViewEdges - * The view edges that are newly created (the initial edges are not included) are added to this list. + * This list need to be sorted such as the first view vertex is the farther away from + * fe->vertexA. ioNewEdges The feature edges that are newly created (the initial edges are not + * included) are added to this list. ioNewViewEdges The view edges that are newly created (the + * initial edges are not included) are added to this list. */ inline void SplitEdge(FEdge *fe, const vector<TVertex *> &iViewVertices, @@ -1608,7 +1610,8 @@ class ViewShape { //_SShape->AddNewEdge(iEdge->fedge()); } - /* removes the view edge iViewEdge in the View Shape and the associated FEdge chain entry in the underlying SShape + /* removes the view edge iViewEdge in the View Shape and the associated FEdge chain entry in the + * underlying SShape */ void RemoveEdge(ViewEdge *iViewEdge); @@ -1681,28 +1684,30 @@ void ViewShape::SplitEdge(FEdge *fe, ViewEdge *newVEdge; if ((vva == 0) || (vvb == 0)) { // that means we're dealing with a closed viewedge (loop) - // remove the chain that was starting by the fedge A of vEdge (which is different from fe !!!!) + // remove the chain that was starting by the fedge A of vEdge (which is different from fe + // !!!!) shape->RemoveEdgeFromChain(vEdge->fedgeA()); // we set vEdge->setA(*vv); vEdge->setB(*vv); vEdge->setFEdgeA(newEdge); - //FEdge *previousEdge = newEdge->previousEdge(); + // FEdge *previousEdge = newEdge->previousEdge(); vEdge->setFEdgeB(fe); newVEdge = vEdge; vEdge->fedgeA()->setViewEdge(newVEdge); } else { - // while we create the view edge, it updates the "ViewEdge" pointer of every underlying FEdges to this. + // while we create the view edge, it updates the "ViewEdge" pointer of every underlying + // FEdges to this. newVEdge = new ViewEdge((*vv), vvb); //, newEdge, vEdge->fedgeB()); newVEdge->setNature((fe)->getNature()); newVEdge->setFEdgeA(newEdge); - //newVEdge->setFEdgeB(fe); + // newVEdge->setFEdgeB(fe); // If our original viewedge is made of one FEdge, then if ((vEdge->fedgeA() == vEdge->fedgeB()) || (fe == vEdge->fedgeB())) newVEdge->setFEdgeB(newEdge); else - newVEdge->setFEdgeB(vEdge->fedgeB()); //MODIF + newVEdge->setFEdgeB(vEdge->fedgeB()); // MODIF Id *newId = vEdge->splittingId(); if (newId == 0) { @@ -1728,7 +1733,7 @@ void ViewShape::SplitEdge(FEdge *fe, // we split the view edge: vEdge->setB((*vv)); - vEdge->setFEdgeB(fe); //MODIF + vEdge->setFEdgeB(fe); // MODIF // Update fedges so that they point to the new viewedge: newVEdge->UpdateFEdges(); diff --git a/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h b/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h index 6af70120832..63343c33c4f 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h +++ b/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h @@ -165,7 +165,7 @@ class edge_iterator_base : public IteratorBase<Traits, InputIteratorTag_Traits> { } - //protected://FIXME + // protected://FIXME public: #if 0 inline edge_iterator_base( @@ -208,7 +208,7 @@ class edge_iterator_base : public IteratorBase<Traits, InputIteratorTag_Traits> { if (_Nature & Nature::T_VERTEX) return (_tvertex_iter == _tbegin); - //return (_tvertex_iter == _feA); + // return (_tvertex_iter == _feA); else return (_nontvertex_iter == _begin); } @@ -216,7 +216,7 @@ class edge_iterator_base : public IteratorBase<Traits, InputIteratorTag_Traits> virtual bool end() const { if (_Nature & Nature::T_VERTEX) - //return (_tvertex_iter.first == 0); + // return (_tvertex_iter.first == 0); return (_tvertex_iter == _tend); else return (_nontvertex_iter == _end); @@ -257,7 +257,7 @@ class edge_iterator_base : public IteratorBase<Traits, InputIteratorTag_Traits> virtual reference operator*() const { if (_Nature & Nature::T_VERTEX) - //return _tvertex_iter; + // return _tvertex_iter; return **_tvertex_iter; else return (*_nontvertex_iter); @@ -362,8 +362,8 @@ class edge_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTag_ public: mutable value_type _ViewEdge; - //friend class edge_iterator_base<Nonconst_traits<ViewEdge*> >; - //friend class edge_iterator_base<Const_traits<ViewEdge*> >; + // friend class edge_iterator_base<Nonconst_traits<ViewEdge*> >; + // friend class edge_iterator_base<Const_traits<ViewEdge*> >; value_type _first; bool _orientation; typedef IteratorBase<Traits, BidirectionalIteratorTag_Traits> parent_class; @@ -392,7 +392,7 @@ class edge_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTag_ _orientation = iBrother._orientation; } - //protected://FIXME + // protected://FIXME public: inline edge_iterator_base(value_type iEdge, bool orientation = true) : parent_class() { @@ -550,7 +550,7 @@ class fedge_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTag _FEdgeB = iBrother._FEdgeB; } - //protected://FIXME + // protected://FIXME public: inline fedge_iterator_base(value_type iEdge, value_type iFEdgeB) : parent_class() { @@ -687,7 +687,7 @@ class vertex_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTa _PreviousFEdge = iBrother._PreviousFEdge; } - //protected://FIXME + // protected://FIXME public: inline vertex_iterator_base(value_type iVertex, FEdge *iPreviousFEdge, FEdge *iNextFEdge) : parent_class() diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp index 44d840c2cc5..f990b7bd63a 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp @@ -125,7 +125,7 @@ static void findOccludee(FEdge *fe, else { // check whether the edge and the polygon plane are coincident: //------------------------------------------------------------- - //first let us compute the plane equation. + // first let us compute the plane equation. if (GeomUtils::COINCIDENT == GeomUtils::intersectRayPlane(origin, edgeDir, p->getNormal(), d, t, epsilon)) { #if LOGGING @@ -255,8 +255,9 @@ static int computeVisibility(ViewMap *viewMap, 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). + // 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(); @@ -324,8 +325,8 @@ static int computeVisibility(ViewMap *viewMap, continue; WFace *sface = (*ie)->GetbFace(); - //WFace *sfacea = (*ie)->GetaFace(); - //if ((sface == oface) || (sfacea == oface)) + // WFace *sfacea = (*ie)->GetaFace(); + // if ((sface == oface) || (sfacea == oface)) if (sface == oface) { skipFace = true; break; @@ -346,7 +347,7 @@ static int computeVisibility(ViewMap *viewMap, else { // check whether the edge and the polygon plane are coincident: //------------------------------------------------------------- - //first let us compute the plane equation. + // first let us compute the plane equation. if (GeomUtils::COINCIDENT == GeomUtils::intersectRayPlane(origin, edgeDir, p->getNormal(), d, t, epsilon)) { #if LOGGING @@ -412,11 +413,12 @@ static int computeVisibility(ViewMap *viewMap, // computeCumulativeVisibility returns the lowest x such that the majority of FEdges have QI <= x // -// This was probably the original intention of the "normal" algorithm on which computeDetailedVisibility is based. -// But because the "normal" algorithm chooses the most popular QI, without considering any other values, a ViewEdge -// with FEdges having QIs of 0, 21, 22, 23, 24 and 25 will end up having a total QI of 0, even though most of the -// FEdges are heavily occluded. computeCumulativeVisibility will treat this case as a QI of 22 because 3 out of -// 6 occluders have QI <= 22. +// This was probably the original intention of the "normal" algorithm on which +// computeDetailedVisibility is based. But because the "normal" algorithm chooses the most popular +// QI, without considering any other values, a ViewEdge with FEdges having QIs of 0, 21, 22, 23, 24 +// and 25 will end up having a total QI of 0, even though most of the FEdges are heavily occluded. +// computeCumulativeVisibility will treat this case as a QI of 22 because 3 out of 6 occluders have +// QI <= 22. template<typename G, typename I> static void computeCumulativeVisibility(ViewMap *ioViewMap, @@ -513,7 +515,7 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, continue; } if ((maxCard < qiMajority)) { - //ARB: change &wFace to wFace and use reference in called function + // ARB: change &wFace to wFace and use reference in called function tmpQI = computeVisibility<G, I>( ioViewMap, fe, grid, epsilon, *ve, &wFace, &foundOccluders); #if LOGGING @@ -522,11 +524,11 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, } #endif - //ARB: This is an error condition, not an alert condition. + // ARB: This is an error condition, not an alert condition. // Some sort of recovery or abort is necessary. if (tmpQI >= 256) { cerr << "Warning: too many occluding levels" << endl; - //ARB: Wild guess: instead of aborting or corrupting memory, treat as tmpQI == 255 + // ARB: Wild guess: instead of aborting or corrupting memory, treat as tmpQI == 255 tmpQI = 255; } @@ -536,8 +538,8 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, } } else { - //ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called - //ARB: change &wFace to wFace and use reference in called function + // 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) { @@ -589,8 +591,8 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, } } // occluders -- - // I would rather not have to go through the effort of creating this set and then copying out its contents. - // Is there a reason why ViewEdge::_Occluders cannot be converted to a set<>? + // I would rather not have to go through the effort of creating this set and then copying out + // its contents. Is there a reason why ViewEdge::_Occluders cannot be converted to a set<>? for (set<ViewShape *>::iterator o = foundOccluders.begin(), oend = foundOccluders.end(); o != oend; ++o) { @@ -710,7 +712,7 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, continue; } if ((maxCard < qiMajority)) { - //ARB: change &wFace to wFace and use reference in called function + // ARB: change &wFace to wFace and use reference in called function tmpQI = computeVisibility<G, I>( ioViewMap, fe, grid, epsilon, *ve, &wFace, &foundOccluders); #if LOGGING @@ -719,11 +721,11 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, } #endif - //ARB: This is an error condition, not an alert condition. + // ARB: This is an error condition, not an alert condition. // Some sort of recovery or abort is necessary. if (tmpQI >= 256) { cerr << "Warning: too many occluding levels" << endl; - //ARB: Wild guess: instead of aborting or corrupting memory, treat as tmpQI == 255 + // ARB: Wild guess: instead of aborting or corrupting memory, treat as tmpQI == 255 tmpQI = 255; } @@ -733,8 +735,8 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, } } else { - //ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called - //ARB: change &wFace to wFace and use reference in called function + // 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) { @@ -779,8 +781,8 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, // qi -- (*ve)->setQI(maxIndex); // occluders -- - // I would rather not have to go through the effort of creating this this set and then copying out its contents. - // Is there a reason why ViewEdge::_Occluders cannot be converted to a set<>? + // I would rather not have to go through the effort of creating this this set and then copying + // out its contents. Is there a reason why ViewEdge::_Occluders cannot be converted to a set<>? for (set<ViewShape *>::iterator o = foundOccluders.begin(), oend = foundOccluders.end(); o != oend; ++o) { @@ -877,15 +879,15 @@ static void computeFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon) } if (even_test) { if ((maxCard < qiMajority)) { - //ARB: change &wFace to wFace and use reference in called function + // ARB: change &wFace to wFace and use reference in called function tmpQI = computeVisibility<G, I>( ioViewMap, fe, grid, epsilon, *ve, &wFace, &foundOccluders); - //ARB: This is an error condition, not an alert condition. + // ARB: This is an error condition, not an alert condition. // Some sort of recovery or abort is necessary. if (tmpQI >= 256) { cerr << "Warning: too many occluding levels" << endl; - //ARB: Wild guess: instead of aborting or corrupting memory, treat as tmpQI == 255 + // ARB: Wild guess: instead of aborting or corrupting memory, treat as tmpQI == 255 tmpQI = 255; } @@ -895,8 +897,8 @@ static void computeFastVisibility(ViewMap *ioViewMap, G &grid, real epsilon) } } else { - //ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called - //ARB: change &wFace to wFace and use reference in called function + // 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); } @@ -1008,7 +1010,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]); - // 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) { @@ -1083,8 +1086,8 @@ void ViewMapBuilder::CullViewEdges(ViewMap *ioViewMap, // Non-displayable view edges will be skipped over during visibility calculation. - // View edges will be culled according to their position w.r.t. the viewport proscenium (viewport + 5% border, - // or some such). + // View edges will be culled according to their position w.r.t. the viewport proscenium (viewport + // + 5% border, or some such). // Get proscenium boundary for culling GridHelpers::getDefaultViewProscenium(viewProscenium); @@ -1098,17 +1101,16 @@ void ViewMapBuilder::CullViewEdges(ViewMap *ioViewMap, cout << "Origin: [" << prosceniumOrigin[0] << ", " << prosceniumOrigin[1] << "]" << endl; } - // A separate occluder proscenium will also be maintained, starting out the same as the viewport proscenium, and - // expanding as necessary so that it encompasses the center point of at least one feature edge in each retained view - // edge. - // The occluder proscenium will be used later to cull occluding triangles before they are inserted into the Grid. - // The occluder proscenium starts out the same size as the view proscenium + // A separate occluder proscenium will also be maintained, starting out the same as the viewport + // proscenium, and expanding as necessary so that it encompasses the center point of at least one + // feature edge in each retained view edge. The occluder proscenium will be used later to cull + // occluding triangles before they are inserted into the Grid. The occluder proscenium starts out + // the same size as the view proscenium GridHelpers::getDefaultViewProscenium(occluderProscenium); - // N.B. Freestyle is inconsistent in its use of ViewMap::viewedges_container and vector<ViewEdge*>::iterator. - // Probably all occurences of vector<ViewEdge*>::iterator should be replaced ViewMap::viewedges_container - // throughout the code. - // For each view edge + // N.B. Freestyle is inconsistent in its use of ViewMap::viewedges_container and + // vector<ViewEdge*>::iterator. Probably all occurences of vector<ViewEdge*>::iterator should be + // replaced ViewMap::viewedges_container throughout the code. For each view edge ViewMap::viewedges_container::iterator ve, veend; for (ve = ioViewMap->ViewEdges().begin(), veend = ioViewMap->ViewEdges().end(); ve != veend; @@ -1130,8 +1132,8 @@ void ViewMapBuilder::CullViewEdges(ViewMap *ioViewMap, // All ViewEdges start culled (*ve)->setIsInImage(false); - // For simple visibility calculation: mark a feature edge that is known to have a center point inside the - // occluder proscenium. Cull all other feature edges. + // For simple visibility calculation: mark a feature edge that is known to have a center point + // inside the occluder proscenium. Cull all other feature edges. do { // All FEdges start culled fe->setIsInImage(false); @@ -1165,15 +1167,15 @@ void ViewMapBuilder::CullViewEdges(ViewMap *ioViewMap, fe = fe->nextEdge(); } while (fe && fe != festart && !(bestOccluderTargetFound && (*ve)->isInImage())); - // Either we have run out of FEdges, or we already have the one edge we need to determine visibility - // Cull all remaining edges. + // Either we have run out of FEdges, or we already have the one edge we need to determine + // visibility Cull all remaining edges. while (fe && fe != festart) { fe->setIsInImage(false); fe = fe->nextEdge(); } - // If bestOccluderTarget was not found inside the occluder proscenium, we need to expand the occluder - // proscenium to include it. + // If bestOccluderTarget was not found inside the occluder proscenium, we need to expand the + // occluder proscenium to include it. if ((*ve)->isInImage() && bestOccluderTarget != NULL && !bestOccluderTargetFound) { // Expand occluder proscenium to enclose bestOccluderTarget Vec3r point = bestOccluderTarget->center2d(); @@ -1204,14 +1206,15 @@ void ViewMapBuilder::CullViewEdges(ViewMap *ioViewMap, // For "Normal" or "Fast" style visibility computation only: - // For more detailed visibility calculation, make a second pass through the view map, marking all feature edges - // with center points inside the final occluder proscenium. All of these feature edges can be considered during - // visibility calculation. + // For more detailed visibility calculation, make a second pass through the view map, marking all + // feature edges with center points inside the final occluder proscenium. All of these feature + // edges can be considered during visibility calculation. - // So far we have only found one FEdge per ViewEdge. The "Normal" and "Fast" styles of visibility computation - // want to consider many FEdges for each ViewEdge. - // Here we re-scan the view map to find any usable FEdges that we skipped on the first pass, or that have become - // usable because the occluder proscenium has been expanded since the edge was visited on the first pass. + // So far we have only found one FEdge per ViewEdge. The "Normal" and "Fast" styles of + // visibility computation want to consider many FEdges for each ViewEdge. Here we re-scan the + // view map to find any usable FEdges that we skipped on the first pass, or that have become + // usable because the occluder proscenium has been expanded since the edge was visited on the + // first pass. if (extensiveFEdgeSearch) { // For each view edge, for (ve = ioViewMap->ViewEdges().begin(), veend = ioViewMap->ViewEdges().end(); ve != veend; @@ -1465,15 +1468,15 @@ void ViewMapBuilder::ComputeEdgesVisibility(ViewMap *ioViewMap, ComputeDetailedVisibility(ioViewMap, we, bbox, epsilon, true, factory); } catch (...) { - // Last resort catch to make sure RAII semantics hold for OptimizedGrid. Can be replaced with - // try...catch block around main() if the program as a whole is converted to RAII + // Last resort catch to make sure RAII semantics hold for OptimizedGrid. Can be replaced + // with try...catch block around main() if the program as a whole is converted to RAII - // This is the little-mentioned caveat of RAII: RAII does not work unless destructors are always - // called, but destructors are only called if all exceptions are caught (or std::terminate() is - // replaced). + // This is the little-mentioned caveat of RAII: RAII does not work unless destructors are + // always called, but destructors are only called if all exceptions are caught (or + // std::terminate() is replaced). - // We don't actually handle the exception here, so re-throw it now that our destructors have had a - // chance to run. + // We don't actually handle the exception here, so re-throw it now that our destructors + // have had a chance to run. throw; } break; @@ -1591,11 +1594,11 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo cout << "\tFEdge: visibility " << tmpQI << endl; } #endif - //ARB: This is an error condition, not an alert condition. + // ARB: This is an error condition, not an alert condition. // Some sort of recovery or abort is necessary. if (tmpQI >= 256) { cerr << "Warning: too many occluding levels" << endl; - //ARB: Wild guess: instead of aborting or corrupting memory, treat as tmpQI == 255 + // ARB: Wild guess: instead of aborting or corrupting memory, treat as tmpQI == 255 tmpQI = 255; } @@ -1605,7 +1608,7 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo } } else { - //ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called + // ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called FindOccludee(fe, _Grid, epsilon, &aFace, timestamp++); #if LOGGING if (_global.debug & G_DEBUG_FREESTYLE) { @@ -1626,7 +1629,8 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo #endif } else { - //ARB: We are arbitrarily using the last observed value for occludee (almost always the value observed + // ARB: We are arbitrarily using the last observed value for occludee (almost always the + // value observed // for the edge before festart). Is that meaningful? // ...in fact, _occludeeEmpty seems to be unused. fe->setOccludeeEmpty(true); @@ -1736,11 +1740,11 @@ void ViewMapBuilder::ComputeFastRayCastingVisibility(ViewMap *ioViewMap, real ep if ((maxCard < qiMajority)) { tmpQI = ComputeRayCastingVisibility(fe, _Grid, epsilon, occluders, &aFace, timestamp++); - //ARB: This is an error condition, not an alert condition. + // ARB: This is an error condition, not an alert condition. // Some sort of recovery or abort is necessary. if (tmpQI >= 256) { cerr << "Warning: too many occluding levels" << endl; - //ARB: Wild guess: instead of aborting or corrupting memory, treat as tmpQI == 255 + // ARB: Wild guess: instead of aborting or corrupting memory, treat as tmpQI == 255 tmpQI = 255; } @@ -1750,7 +1754,7 @@ void ViewMapBuilder::ComputeFastRayCastingVisibility(ViewMap *ioViewMap, real ep } } else { - //ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called + // ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called FindOccludee(fe, _Grid, epsilon, &aFace, timestamp++); } @@ -1895,7 +1899,7 @@ void ViewMapBuilder::FindOccludee(FEdge *fe, for (p = occluders.begin(), pend = occluders.end(); p != pend; p++) { // check whether the edge and the polygon plane are coincident: //------------------------------------------------------------- - //first let us compute the plane equation. + // first let us compute the plane equation. oface = (WFace *)(*p)->userdata; Vec3r v1(((*p)->getVertices())[0]); Vec3r normal((*p)->getNormal()); @@ -2022,7 +2026,7 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, (center.z() < gridOrigin.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; + // return 0; } #if 0 @@ -2073,8 +2077,9 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, face->RetrieveVertexList(faceVertices); for (p = occluders.begin(), pend = occluders.end(); p != pend; p++) { - // 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). + // 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 @@ -2126,8 +2131,8 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, continue; WFace *sface = (*ie)->GetbFace(); - //WFace *sfacea = (*ie)->GetaFace(); - //if ((sface == oface) || (sfacea == oface)) { + // WFace *sfacea = (*ie)->GetaFace(); + // if ((sface == oface) || (sfacea == oface)) { if (sface == oface) { skipFace = true; break; @@ -2148,7 +2153,7 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, else { // check whether the edge and the polygon plane are coincident: //------------------------------------------------------------- - //first let us compute the plane equation. + // first let us compute the plane equation. if (GeomUtils::COINCIDENT == GeomUtils::intersectRayPlane(origin, edgeDir, normal, d, t, epsilon)) { diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.h b/source/blender/freestyle/intern/view_map/ViewMapBuilder.h index 0e3dbf9148e..eac5b348555 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.h +++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.h @@ -57,7 +57,7 @@ using namespace Geometry; class ViewMapBuilder { private: ViewMap *_ViewMap; // result - //SilhouetteGeomEngine _GeomEngine; + // SilhouetteGeomEngine _GeomEngine; ProgressBar *_pProgressBar; RenderMonitor *_pRenderMonitor; Vec3r _viewpoint; @@ -117,8 +117,8 @@ class ViewMapBuilder { /*! Compute Cusps */ void computeCusps(ViewMap *ioViewMap); - /*! Detects cusps (for a single ViewEdge) among SVertices and builds a ViewVertex on top of each cusp SVertex - * We use a hysteresis approach to avoid noise. + /*! Detects cusps (for a single ViewEdge) among SVertices and builds a ViewVertex on top of each + * cusp SVertex We use a hysteresis approach to avoid noise. */ void DetectCusps(ViewEdge *ioEdge); @@ -174,10 +174,9 @@ class ViewMapBuilder { * ioViewMap * The view map. It is modified by the method. * The list of all features edges of the scene. - * Each time an intersection is found, the 2 intersecting edges are splitted (creating 2 new vertices) - * At the end, this list is updated with the adding of all new created edges (resulting from splitting). - * iAlgo - * The algo to use for computing the intersections + * Each time an intersection is found, the 2 intersecting edges are splitted (creating 2 new + * vertices) At the end, this list is updated with the adding of all new created edges (resulting + * from splitting). iAlgo The algo to use for computing the intersections */ void ComputeIntersections(ViewMap *ioViewMap, intersection_algo iAlgo = sweep_line, @@ -221,14 +220,11 @@ class ViewMapBuilder { /*! Computes intersections on all edges of the scene using a sweep line algorithm */ void ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsilon = 1.0e-6); - /*! Computes the 2D scene silhouette edges visibility using a ray casting. On each edge, a ray is cast - * to check its quantitative invisibility. The list of occluders are each time stored in the tested edge. - * ioViewMap - * The view map. - * The 2D scene silhouette edges as FEdges. - * These edges have already been splitted at their intersections points. - * Thus, these edges do not intersect anymore. - * The visibility corresponding to each edge of ioScene is set is this edge. + /*! Computes the 2D scene silhouette edges visibility using a ray casting. On each edge, a ray is + * cast to check its quantitative invisibility. The list of occluders are each time stored in the + * tested edge. ioViewMap The view map. The 2D scene silhouette edges as FEdges. These edges have + * already been splitted at their intersections points. Thus, these edges do not intersect + * anymore. The visibility corresponding to each edge of ioScene is set is this edge. */ void ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilon = 1.0e-6); void ComputeFastRayCastingVisibility(ViewMap *ioViewMap, real epsilon = 1.0e-6); @@ -257,10 +253,10 @@ class ViewMapBuilder { * The epsilon used for computation * oShapeId * fe is the border (in 2D) between 2 2D spaces. - * if fe is a silhouette, One of these 2D spaces is occupied by the shape to which fe belongs (on its left) - * and the other one is either occupied by another shape or empty or occupied by the same shape. - * We use this ray csating operation to determine which shape lies on fe's right. - * The result is the shape id stored in oShapeId + * if fe is a silhouette, One of these 2D spaces is occupied by the shape to which fe + * belongs (on its left) and the other one is either occupied by another shape or empty or + * occupied by the same shape. We use this ray csating operation to determine which shape lies on + * fe's right. The result is the shape id stored in oShapeId */ int ComputeRayCastingVisibility(FEdge *fe, Grid *iGrid, diff --git a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp index 65336f593c7..24ed798709a 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp @@ -801,8 +801,8 @@ static int save(ostream &out, SVertex *sv) WRITE_IF_NON_NULL(sv->viewvertex()); // Normals (List) - // Note: the 'size()' method of a set doesn't seem to return the actual size of the given set, so we have to - // hack it... + // Note: the 'size()' method of a set doesn't seem to return the actual size of the given set, so + // we have to hack it... set<Vec3r>::const_iterator i; for (i = sv->normals().begin(), tmp = 0; i != sv->normals().end(); i++, tmp++) ; @@ -955,7 +955,7 @@ int load(istream &in, ViewMap *vm, ProgressBar *pb) if (!vm) return 1; - //soc unused - unsigned tmp; + // soc unused - unsigned tmp; int err = 0; Internal::g_vm = vm; diff --git a/source/blender/freestyle/intern/view_map/ViewMapIterators.h b/source/blender/freestyle/intern/view_map/ViewMapIterators.h index 7182c5d3362..0fb5438a153 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapIterators.h +++ b/source/blender/freestyle/intern/view_map/ViewMapIterators.h @@ -46,10 +46,9 @@ namespace Freestyle { namespace ViewVertexInternal { -/*! Class representing an iterator over oriented ViewEdges around a ViewVertex. This iterator allows a CCW iteration - * (in the image plane). - * An instance of an orientedViewEdgeIterator can only be obtained from a ViewVertex by calling edgesBegin() - * or edgesEnd(). +/*! Class representing an iterator over oriented ViewEdges around a ViewVertex. This iterator + * allows a CCW iteration (in the image plane). An instance of an orientedViewEdgeIterator can only + * be obtained from a ViewVertex by calling edgesBegin() or edgesEnd(). */ class orientedViewEdgeIterator : public Iterator { public: @@ -127,7 +126,8 @@ class orientedViewEdgeIterator : public Iterator { } public: - /*! Tells whether the ViewEdge pointed by this iterator is the first one of the iteration list or not. */ + /*! Tells whether the ViewEdge pointed by this iterator is the first one of the iteration list or + * not. */ virtual bool isBegin() const { if (_Nature & Nature::T_VERTEX) @@ -136,7 +136,8 @@ class orientedViewEdgeIterator : public Iterator { return (_nontvertex_iter == _begin); } - /*! Tells whether the ViewEdge pointed by this iterator is after the last one of the iteration list or not. */ + /*! Tells whether the ViewEdge pointed by this iterator is after the last one of the iteration + * list or not. */ virtual bool isEnd() const { if (_Nature & Nature::T_VERTEX) @@ -186,7 +187,7 @@ class orientedViewEdgeIterator : public Iterator { virtual ViewVertex::directedViewEdge &operator*() const { if (_Nature & Nature::T_VERTEX) - //return _tvertex_iter; + // return _tvertex_iter; return **_tvertex_iter; else return (*_nontvertex_iter); @@ -406,8 +407,8 @@ class SVertexIterator : public Interface0DIteratorNested { /////////////////////////////////////////////////////////// /*! Base class for iterators over ViewEdges of the ViewMap Graph. - * Basically the "increment()" operator of this class should be able to take the decision of "where" (on which - * ViewEdge) to go when pointing on a given ViewEdge. + * Basically the "increment()" operator of this class should be able to take the decision of + * "where" (on which ViewEdge) to go when pointing on a given ViewEdge. * ::Caution::: the dereferencing operator returns a *pointer* to the pointed ViewEdge. */ class ViewEdgeIterator : public Iterator { @@ -416,8 +417,9 @@ class ViewEdgeIterator : public Iterator { * \param begin: * The ViewEdge from where to start the iteration. * \param orientation: - * If true, we'll look for the next ViewEdge among the ViewEdges that surround the ending ViewVertex of begin. - * If false, we'll search over the ViewEdges surrounding the ending ViewVertex of begin. + * If true, we'll look for the next ViewEdge among the ViewEdges that surround the ending + * ViewVertex of begin. If false, we'll search over the ViewEdges surrounding the ending + * ViewVertex of begin. */ ViewEdgeIterator(ViewEdge *begin = NULL, bool orientation = true) { diff --git a/source/blender/freestyle/intern/view_map/ViewMapTesselator.h b/source/blender/freestyle/intern/view_map/ViewMapTesselator.h index 2173ea42fab..f8ae885f5d7 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapTesselator.h +++ b/source/blender/freestyle/intern/view_map/ViewMapTesselator.h @@ -57,11 +57,12 @@ class ViewMapTesselator { { } - /*! Builds a set of lines rep contained under a a NodeShape, itself contained under a NodeGroup from a ViewMap */ + /*! Builds a set of lines rep contained under a a NodeShape, itself contained under a NodeGroup + * from a ViewMap */ NodeGroup *Tesselate(ViewMap *iViewMap); - /*! Builds a set of lines rep contained under a a NodeShape, itself contained under a NodeGroup from a set of - * view edges + /*! Builds a set of lines rep contained under a a NodeShape, itself contained under a NodeGroup + * from a set of view edges */ template<class ViewEdgesIterator> NodeGroup *Tesselate(ViewEdgesIterator begin, ViewEdgesIterator end); @@ -156,7 +157,7 @@ NodeGroup *ViewMapTesselator::Tesselate(ViewEdgesIterator begin, ViewEdgesIterat NodeGroup *group = new NodeGroup; NodeShape *tshape = new NodeShape; group->AddChild(tshape); - //tshape->frs_material().setDiffuse(0.0f, 0.0f, 0.0f, 1.0f); + // tshape->frs_material().setDiffuse(0.0f, 0.0f, 0.0f, 1.0f); tshape->setFrsMaterial(_FrsMaterial); LineRep *line; @@ -165,7 +166,8 @@ NodeGroup *ViewMapTesselator::Tesselate(ViewEdgesIterator begin, ViewEdgesIterat FEdge *nextFEdge, *currentEdge; int id = 0; - //for (vector<ViewEdge*>::const_iterator c = viewedges.begin(), cend = viewedges.end(); c != cend; c++) + // for (vector<ViewEdge*>::const_iterator c = viewedges.begin(), cend = viewedges.end(); c != + // cend; c++) for (ViewEdgesIterator c = begin, cend = end; c != cend; c++) { #if 0 if ((*c)->qi() > 0) { @@ -189,25 +191,25 @@ NodeGroup *ViewMapTesselator::Tesselate(ViewEdgesIterator begin, ViewEdgesIterat // there might be chains containing a single element if (0 == (firstEdge)->nextEdge()) { line->setStyle(LineRep::LINES); - //line->AddVertex((*c)->vertexA()->point3D()); - //line->AddVertex((*c)->vertexB()->point3D()); + // line->AddVertex((*c)->vertexA()->point3D()); + // line->AddVertex((*c)->vertexB()->point3D()); AddVertexToLine(line, firstEdge->vertexA()); AddVertexToLine(line, firstEdge->vertexB()); } else { line->setStyle(LineRep::LINE_STRIP); - //firstEdge = (*c); + // firstEdge = (*c); nextFEdge = firstEdge; currentEdge = firstEdge; do { - //line->AddVertex(nextFEdge->vertexA()->point3D()); + // line->AddVertex(nextFEdge->vertexA()->point3D()); AddVertexToLine(line, nextFEdge->vertexA()); currentEdge = nextFEdge; nextFEdge = nextFEdge->nextEdge(); } while ((nextFEdge != NULL) && (nextFEdge != firstEdge)); // Add the last vertex - //line->AddVertex(currentEdge->vertexB()->point3D()); + // line->AddVertex(currentEdge->vertexB()->point3D()); AddVertexToLine(line, currentEdge->vertexB()); } |