diff options
author | Campbell Barton <ideasman42@gmail.com> | 2019-04-30 10:50:57 +0300 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2019-05-01 00:58:27 +0300 |
commit | 1e8697cd8094183a3f356bf8564284a31ffb89fc (patch) | |
tree | 554b1ac7856f3f168c58476ce53d1953beaa760e /source/blender/freestyle/intern/stroke | |
parent | 5ca8ac51d04c6feb9d29d75fb2525168d30fbe74 (diff) |
Cleanup: comments (long lines) in freestyle
Diffstat (limited to 'source/blender/freestyle/intern/stroke')
30 files changed, 348 insertions, 355 deletions
diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h b/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h index 24c710bd163..dcab48fd12f 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.h @@ -38,15 +38,15 @@ namespace Functions0D { // DensityF0D /*! Returns the density of the (result) image evaluated at an Interface0D. - * This density is evaluated using a pixels square window around the evaluation point and integrating - * these values using a gaussian. + * This density is evaluated using a pixels square window around the evaluation point and + * integrating these values using a gaussian. */ class DensityF0D : public UnaryFunction0D<double> { public: /*! Builds the functor from the gaussian sigma value. * \param sigma: - * sigma indicates the x value for which the gaussian function is 0.5. It leads to the window size value. - * (the larger, the smoother) + * sigma indicates the x value for which the gaussian function is 0.5. + * It leads to the window size value. (the larger, the smoother) */ DensityF0D(double sigma = 2) : UnaryFunction0D<double>() { diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp index eadc8993dc6..fd97138c91b 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp @@ -104,14 +104,14 @@ int GetSteerableViewMapDensityF1D::operator()(Interface1D &inter) int GetDirectionalViewMapDensityF1D::operator()(Interface1D &inter) { - //soc unsigned size; + // soc unsigned size; result = integrate(_fun, inter.pointsBegin(_sampling), inter.pointsEnd(_sampling), _integration); return 0; } int GetCompleteViewMapDensityF1D::operator()(Interface1D &inter) { - //soc unsigned size; + // soc unsigned size; /* Id id = inter.getId(); */ /* UNUSED */ result = integrate(_fun, inter.pointsBegin(_sampling), inter.pointsEnd(_sampling), _integration); return 0; diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h index 76a70d4f50d..a1fd3fb2665 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h @@ -37,8 +37,9 @@ namespace Functions1D { // DensityF1D /*! Returns the density evaluated for an Interface1D. - * The density is evaluated for a set of points along the Interface1D (using the DensityF0D functor) with a - * user-defined sampling and then integrated into a single value using a user-defined integration method. + * The density is evaluated for a set of points along the Interface1D (using the DensityF0D + * functor) with a user-defined sampling and then integrated into a single value using a + * user-defined integration method. */ class DensityF1D : public UnaryFunction1D<double> { private: @@ -51,9 +52,9 @@ class DensityF1D : public UnaryFunction1D<double> { * \param iType: * The integration method used to compute a single value from a set of values. * \param sampling: - * The resolution used to sample the chain: the corresponding 0D function is evaluated at each sample point and - * the result is obtained by combining the resulting values into a single one, following the method specified - * by iType. + * The resolution used to sample the chain: the corresponding 0D function is evaluated at each + * sample point and the result is obtained by combining the resulting values into a single one, + * following the method specified by iType. */ DensityF1D(double sigma = 2, IntegrationType iType = MEAN, float sampling = 2.0f) : UnaryFunction1D<double>(iType), _fun(sigma) @@ -86,8 +87,9 @@ class DensityF1D : public UnaryFunction1D<double> { // LocalAverageDepthF1D /*! Returns the average depth evaluated for an Interface1D. - * The average depth is evaluated for a set of points along the Interface1D (using the LocalAverageDepthF0D functor) - * with a user-defined sampling and then integrated into a single value using a user-defined integration method. + * The average depth is evaluated for a set of points along the Interface1D (using the + * LocalAverageDepthF0D functor) with a user-defined sampling and then integrated into a single + * value using a user-defined integration method. */ class LocalAverageDepthF1D : public UnaryFunction1D<double> { public: @@ -121,8 +123,9 @@ class LocalAverageDepthF1D : public UnaryFunction1D<double> { // GetCompleteViewMapDensity /*! Returns the density evaluated for an Interface1D in the complete viewmap image. - * The density is evaluated for a set of points along the Interface1D (using the ReadCompleteViewMapPixelF0D functor) - * and then integrated into a single value using a user-defined integration method. + * The density is evaluated for a set of points along the Interface1D (using the + * ReadCompleteViewMapPixelF0D functor) and then integrated into a single value using a + * user-defined integration method. */ class GetCompleteViewMapDensityF1D : public UnaryFunction1D<double> { public: @@ -162,7 +165,8 @@ class GetCompleteViewMapDensityF1D : public UnaryFunction1D<double> { // GetDirectionalViewMapDensity /*! Returns the density evaluated for an Interface1D in of the steerable viewmaps image. * The direction telling which Directional map to choose is explicitly specified by the user. - * The density is evaluated for a set of points along the Interface1D (using the ReadSteerableViewMapPixelF0D functor) + * The density is evaluated for a set of points along the Interface1D + * (using the ReadSteerableViewMapPixelF0D functor) * and then integrated into a single value using a user-defined integration method. */ class GetDirectionalViewMapDensityF1D : public UnaryFunction1D<double> { @@ -175,9 +179,9 @@ class GetDirectionalViewMapDensityF1D : public UnaryFunction1D<double> { * \param iType: * The integration method used to compute a single value from a set of values. * \param sampling: - * The resolution used to sample the chain: the corresponding 0D function is evaluated at each sample point and - * the result is obtained by combining the resulting values into a single one, following the method specified - * by iType. + * The resolution used to sample the chain: the corresponding 0D function is evaluated at + * each sample point and the result is obtained by combining the resulting values into a + * single one, following the method specified by iType. */ GetDirectionalViewMapDensityF1D(unsigned iOrientation, unsigned level, @@ -203,8 +207,8 @@ class GetDirectionalViewMapDensityF1D : public UnaryFunction1D<double> { }; // GetSteerableViewMapDensityF1D -/*! Returns the density of the viewmap for a given Interface1D. The density of each FEdge is evaluated - * in the proper steerable ViewMap depending on its oorientation. +/*! Returns the density of the viewmap for a given Interface1D. The density of each FEdge is + * evaluated in the proper steerable ViewMap depending on its oorientation. */ class GetSteerableViewMapDensityF1D : public UnaryFunction1D<double> { private: @@ -218,9 +222,9 @@ class GetSteerableViewMapDensityF1D : public UnaryFunction1D<double> { * \param iType: * The integration method used to compute a single value from a set of values. * \param sampling: - * The resolution used to sample the chain: the corresponding 0D function is evaluated at each sample point and - * the result is obtained by combining the resulting values into a single one, following the method specified - * by iType. + * The resolution used to sample the chain: the corresponding 0D function is evaluated at each + * sample point and the result is obtained by combining the resulting values into a single one, + * following the method specified by iType. */ GetSteerableViewMapDensityF1D(int level, IntegrationType iType = MEAN, float sampling = 2.0f) : UnaryFunction1D<double>(iType) @@ -245,8 +249,8 @@ class GetSteerableViewMapDensityF1D : public UnaryFunction1D<double> { }; // GetViewMapGradientNormF1D -/*! Returns the density of the viewmap for a given Interface1D. The density of each FEdge is evaluated in - * the proper steerable ViewMap depending on its oorientation. +/*! Returns the density of the viewmap for a given Interface1D. The density of each FEdge is + * evaluated in the proper steerable ViewMap depending on its oorientation. */ class GetViewMapGradientNormF1D : public UnaryFunction1D<double> { private: @@ -261,9 +265,9 @@ class GetViewMapGradientNormF1D : public UnaryFunction1D<double> { * \param iType: * The integration method used to compute a single value from a set of values. * \param sampling: - * The resolution used to sample the chain: the corresponding 0D function is evaluated at each sample point and - * the result is obtained by combining the resulting values into a single one, following the method specified - * by iType. + * The resolution used to sample the chain: the corresponding 0D function is evaluated at each + * sample point and the result is obtained by combining the resulting values into a single + * one, following the method specified by iType. */ GetViewMapGradientNormF1D(int level, IntegrationType iType = MEAN, float sampling = 2.0f) : UnaryFunction1D<double>(iType), _func(level) diff --git a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp index a7883187066..6a0d3b0b793 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp +++ b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp @@ -261,7 +261,7 @@ void Smoother::iteration() edgeStopping(diffC2, _anisoCurvature) * diffC2; //_factorCurvatureDifference; motionCurvature *= _factorCurvatureDifference; - //motionCurvature = _factorCurvatureDifference * (diffC1 + diffC2); + // motionCurvature = _factorCurvatureDifference * (diffC1 + diffC2); if (_safeTest) _vertex[i] = Vec2r(_vertex[i] + (motionNormal + motionCurvature) * _normal[i]); Vec2r v1(_vertex[i - 1] - _vertex[i]); @@ -283,7 +283,7 @@ void Smoother::iteration() edgeStopping(diffC2, _anisoCurvature) * diffC2; //_factorCurvatureDifference; motionCurvature *= _factorCurvatureDifference; - //motionCurvature = _factorCurvatureDifference * (diffC1 + diffC2); + // motionCurvature = _factorCurvatureDifference * (diffC1 + diffC2); _vertex[0] = Vec2r(_vertex[0] + (motionNormal + motionCurvature) * _normal[0]); _vertex[_nbVertices - 1] = _vertex[0]; } diff --git a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h index 17b180531a2..8f05db28194 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h +++ b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.h @@ -27,9 +27,9 @@ namespace Freestyle { /*! [ Thickness Shader ]. - * Assigns thicknesses to the stroke vertices so that the stroke looks like made with a calligraphic tool. - * i.e. The stroke will be the thickest in a main direction, the thinest in the direction perpendicular to this one, - * and an interpolation inbetween. + * Assigns thicknesses to the stroke vertices so that the stroke looks like made with a + * calligraphic tool. i.e. The stroke will be the thickest in a main direction, the thinest in the + * direction perpendicular to this one, and an interpolation inbetween. */ class CalligraphicShader : public StrokeShader { public: @@ -103,9 +103,9 @@ class SpatialNoiseShader : public StrokeShader { /*! [ Geometry Shader ]. * Smoothes the stroke. * (Moves the vertices to make the stroke smoother). - * Uses curvature flow to converge towards a curve of constant curvature. The diffusion method we use is anisotropic - * to prevent the diffusion accross corners. - * \see \htmlonly <a href=/smoothing/smoothing.html>smoothing/smoothing.html</a> \endhtmlonly + * Uses curvature flow to converge towards a curve of constant curvature. The diffusion method we + * use is anisotropic to prevent the diffusion accross corners. \see \htmlonly <a + * href=/smoothing/smoothing.html>smoothing/smoothing.html</a> \endhtmlonly */ class SmoothingShader : public StrokeShader { public: diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp index 15541c1f438..9bdad9f1b32 100644 --- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp +++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp @@ -57,7 +57,8 @@ int ConstantThicknessShader::shade(Stroke &stroke) const int i = 0; int size = stroke.strokeVerticesSize(); for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v) { - // XXX What's the use of i here? And is not the thickness always overriden by the last line of the loop? + // XXX What's the use of i here? And is not the thickness always overriden by the last line of + // the loop? if ((1 == i) || (size - 2 == i)) v->attribute().setThickness(_thickness / 4.0, _thickness / 4.0); if ((0 == i) || (size - 1 == i)) @@ -74,7 +75,8 @@ int ConstantExternThicknessShader::shade(Stroke &stroke) const int i = 0; int size = stroke.strokeVerticesSize(); for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v) { - // XXX What's the use of i here? And is not the thickness always overriden by the last line of the loop? + // XXX What's the use of i here? And is not the thickness always overriden by the last line of + // the loop? if ((1 == i) || (size - 2 == i)) v->attribute().setThickness(_thickness / 2.0, 0); if ((0 == i) || (size - 1 == i)) @@ -109,7 +111,8 @@ int ConstrainedIncreasingThicknessShader::shade(Stroke &stroke) const StrokeInternal::StrokeVertexIterator v, vend; for (i = 0, v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v, ++i) { - // XXX Why not using an if/else here? Else, if last condition is true, everything else is computed for nothing! + // XXX Why not using an if/else here? Else, if last condition is true, everything else is + // computed for nothing! float t; if (i < (float)n / 2.0f) t = (1.0 - (float)i / (float)n) * _ThicknessMin + (float)i / (float)n * maxT; @@ -140,7 +143,8 @@ int LengthDependingThicknessShader::shade(Stroke &stroke) const int i = 0; int size = stroke.strokeVerticesSize(); for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v) { - // XXX What's the use of i here? And is not the thickness always overriden by the last line of the loop? + // XXX What's the use of i here? And is not the thickness always overriden by the last line of + // the loop? if ((1 == i) || (size - 2 == i)) v->attribute().setThickness(thickness / 4.0, thickness / 4.0); if ((0 == i) || (size - 1 == i)) @@ -337,7 +341,7 @@ int SamplingShader::shade(Stroke &stroke) const int ExternalContourStretcherShader::shade(Stroke &stroke) const { - //float l = stroke.getLength2D(); + // float l = stroke.getLength2D(); Interface0DIterator it; Functions0D::Normal2DF0D fun; StrokeVertex *sv; @@ -362,7 +366,7 @@ int BezierCurveShader::shade(Stroke &stroke) const // Build the Bezier curve from this set of data points: vector<Vec2d> data; StrokeInternal::StrokeVertexIterator v = stroke.strokeVerticesBegin(), vend; - data.push_back(Vec2d(v->x(), v->y())); //first one + data.push_back(Vec2d(v->x(), v->y())); // first one StrokeInternal::StrokeVertexIterator previous = v; ++v; for (vend = stroke.strokeVerticesEnd(); v != vend; ++v) { @@ -562,7 +566,7 @@ int PolygonalizationShader::shade(Stroke &stroke) const Vec2d u = (*cp)->B - (*cp)->A; Vec2d n(u[1], -u[0]); n.normalize(); - //Vec2d n(0, 0); + // Vec2d n(0, 0); float offset = ((*cp)->_error); StrokeInternal::StrokeVertexIterator v; for (v = a; v != b; ++v) { @@ -653,7 +657,7 @@ int TipRemoverShader::shade(Stroke &stroke) const // Resample so that our new stroke have the same number of vertices than before stroke.Resample(originalSize); - if ((int)stroke.strokeVerticesSize() != originalSize) //soc + if ((int)stroke.strokeVerticesSize() != originalSize) // soc cerr << "Warning: resampling problem" << endl; // assign old attributes to new stroke vertices: diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h index e128817ffa5..db5738449e6 100644 --- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h +++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h @@ -81,9 +81,9 @@ class ConstantThicknessShader : public StrokeShader { }; /* [ Thickness Shader ]. - * Assigns an absolute constant external thickness to every vertices of the Stroke. The external thickness of a point - * is its thickness from the point to the strip border in the direction pointing outside the object the - * Stroke delimitates. + * Assigns an absolute constant external thickness to every vertices of the Stroke. The external + * thickness of a point is its thickness from the point to the strip border in the direction + * pointing outside the object the Stroke delimitates. */ class ConstantExternThicknessShader : public StrokeShader { public: @@ -108,10 +108,10 @@ class ConstantExternThicknessShader : public StrokeShader { }; /*! [ Thickness Shader ]. - * Assigns thicknesses values such as the thickness increases from a thickness value A to a thickness value B between - * the first vertex to the midpoint vertex and then decreases from B to a A between this midpoint vertex - * and the last vertex. - * The thickness is linearly interpolated from A to B. + * Assigns thicknesses values such as the thickness increases from a thickness value A to a + * thickness value B between the first vertex to the midpoint vertex and then decreases from B to a + * A between this midpoint vertex and the last vertex. The thickness is linearly interpolated from + * A to B. */ class IncreasingThicknessShader : public StrokeShader { public: @@ -146,8 +146,8 @@ class IncreasingThicknessShader : public StrokeShader { }; /*! [ Thickness shader ]. - * Same as previous but here we allow the user to control the ratio thickness/length so that we don't get - * fat short lines + * Same as previous but here we allow the user to control the ratio thickness/length so that we + * don't get fat short lines */ class ConstrainedIncreasingThicknessShader : public StrokeShader { private: @@ -288,8 +288,8 @@ class ConstantColorShader : public StrokeShader { /*! [ Color Shader ]. * Assigns a varying color to the stroke. - * The user specifies 2 colors A and B. The stroke color will change linearly from A to B between the - * first and the last vertex. + * The user specifies 2 colors A and B. The stroke color will change linearly from A to B between + * the first and the last vertex. */ class IncreasingColorShader : public StrokeShader { private: @@ -346,7 +346,8 @@ class IncreasingColorShader : public StrokeShader { }; /* [ Color Shader ]. - * Assigns a color to the stroke depending on the material of the shape to which ot belongs to. (Disney shader) + * Assigns a color to the stroke depending on the material of the shape to which ot belongs to. + * (Disney shader) */ class MaterialColorShader : public StrokeShader { private: @@ -399,7 +400,8 @@ class ColorNoiseShader : public StrokeShader { // /////////////////////////////////////////////////////////////////////////////// /*! [ Geometry Shader ]. - * Stretches the stroke at its two extremities and following the respective directions: v(1)v(0) and v(n-1)v(n). + * Stretches the stroke at its two extremities and following the respective directions: v(1)v(0) + * and v(n-1)v(n). */ class BackboneStretcherShader : public StrokeShader { private: @@ -471,9 +473,9 @@ class ExternalContourStretcherShader : public StrokeShader { // Bezier curve stroke shader /*! [ Geometry Shader ]. - * Transforms the stroke backbone geometry so that it corresponds to a Bezier Curve approximation of the - * original backbone geometry. - * \see \htmlonly <a href=bezier/bezier.html>bezier/bezier.html</a> \endhtmlonly + * Transforms the stroke backbone geometry so that it corresponds to a Bezier Curve approximation + * of the original backbone geometry. \see \htmlonly <a + * href=bezier/bezier.html>bezier/bezier.html</a> \endhtmlonly */ class BezierCurveShader : public StrokeShader { private: @@ -501,8 +503,9 @@ class BezierCurveShader : public StrokeShader { /*! [ Geometry Shader ]. * Shader to modify the Stroke geometry so that it looks more "polygonal". - * The basic idea is to start from the minimal stroke approximation consisting in a line joining the first vertex - * to the last one and to subdivide using the original stroke vertices until a certain error is reached. + * The basic idea is to start from the minimal stroke approximation consisting in a line joining + * the first vertex to the last one and to subdivide using the original stroke vertices until a + * certain error is reached. */ class PolygonalizationShader : public StrokeShader { private: @@ -511,9 +514,9 @@ class PolygonalizationShader : public StrokeShader { public: /*! Builds the shader. * \param iError: - * The error we want our polygonal approximation to have with respect to the original geometry. - * The smaller, the closer the new stroke to the orinal one. - * This error corresponds to the maximum distance between the new stroke and the old one. + * The error we want our polygonal approximation to have with respect to the original + * geometry. The smaller, the closer the new stroke to the orinal one. This error corresponds to + * the maximum distance between the new stroke and the old one. */ PolygonalizationShader(float iError) : StrokeShader() { @@ -542,8 +545,9 @@ class GuidingLinesShader : public StrokeShader { public: /*! Builds a Guiding Lines shader * \param iOffset: - * The line that replaces the stroke is initially in the middle of the initial stroke "bbox". - * iOffset is the value of the displacement which is applied to this line along its normal. + * The line that replaces the stroke is initially in the middle of the initial stroke + * "bbox". iOffset is the value of the displacement which is applied to this line along its + * normal. */ GuidingLinesShader(float iOffset) : StrokeShader() { diff --git a/source/blender/freestyle/intern/stroke/Canvas.cpp b/source/blender/freestyle/intern/stroke/Canvas.cpp index b497b470492..95bbafc0aa0 100644 --- a/source/blender/freestyle/intern/stroke/Canvas.cpp +++ b/source/blender/freestyle/intern/stroke/Canvas.cpp @@ -38,8 +38,8 @@ #include "BKE_global.h" -//soc #include <qimage.h> -//soc #include <QString> +// soc #include <qimage.h> +// soc #include <QString> extern "C" { #include "IMB_imbuf.h" @@ -325,7 +325,7 @@ void Canvas::loadMap(const char *iFileName, filePath = iFileName; } -#if 0 //soc +#if 0 // soc QImage *qimg; QImage newMap(filePath.c_str()); if (newMap.isNull()) { @@ -402,7 +402,7 @@ void Canvas::loadMap(const char *iFileName, GaussianPyramid *pyramid = new GaussianPyramid(tmp, iNbLevels, iSigma); int ow = pyramid->width(0); int oh = pyramid->height(0); - string base(iMapName); //soc + string base(iMapName); // soc for (int i = 0; i < pyramid->getNumberOfLevels(); ++i) { // save each image: #if 0 @@ -410,19 +410,19 @@ void Canvas::loadMap(const char *iFileName, h = pyramid.height(i); #endif - //soc QImage qtmp(ow, oh, QImage::Format_RGB32); + // soc QImage qtmp(ow, oh, QImage::Format_RGB32); ImBuf *qtmp = IMB_allocImBuf(ow, oh, 32, IB_rect); - //int k = (1 << i); + // int k = (1 << i); for (y = 0; y < oh; ++y) { for (x = 0; x < ow; ++x) { int c = pyramid->pixel(x, y, i); // 255 * pyramid->pixel(x, y, i); - //soc qtmp.setPixel(x, y, qRgb(c, c, c)); + // soc qtmp.setPixel(x, y, qRgb(c, c, c)); pix = (char *)qtmp->rect + y * rowbytes + x * 4; pix[0] = pix[1] = pix[2] = c; } } - //soc qtmp.save(base + QString::number(i) + ".bmp", "BMP"); + // soc qtmp.save(base + QString::number(i) + ".bmp", "BMP"); stringstream filename; filename << base; filename << i << ".bmp"; @@ -443,7 +443,7 @@ void Canvas::loadMap(const char *iFileName, #endif _maps[iMapName] = pyramid; - //newMap->save("toto.bmp", "BMP"); + // newMap->save("toto.bmp", "BMP"); } float Canvas::readMapPixel(const char *iMapName, int level, int x, int y) diff --git a/source/blender/freestyle/intern/stroke/Canvas.h b/source/blender/freestyle/intern/stroke/Canvas.h index e059bb07eda..2a0ebbe17c5 100644 --- a/source/blender/freestyle/intern/stroke/Canvas.h +++ b/source/blender/freestyle/intern/stroke/Canvas.h @@ -137,8 +137,8 @@ class Canvas { } /* Maps management */ - /*! Loads an image map. The map will be scaled (without preserving the ratio in order to fit the actual - * canvas size.). + /*! Loads an image map. The map will be scaled + * (without preserving the ratio in order to fit the actual canvas size.). * The image must be a gray values image... * \param iFileName: * The name of the image file @@ -160,9 +160,11 @@ class Canvas { * \param level: * The level of the pyramid from which the pixel must be read. * \param x: - * The abscissa 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. + * The ordinate of the desired pixel specified in level0 coordinate system. + * The origin is the lower left corner. */ float readMapPixel(const char *iMapName, int level, int x, int y); diff --git a/source/blender/freestyle/intern/stroke/Chain.cpp b/source/blender/freestyle/intern/stroke/Chain.cpp index 32b3ec2de31..d4cc4fd68c3 100644 --- a/source/blender/freestyle/intern/stroke/Chain.cpp +++ b/source/blender/freestyle/intern/stroke/Chain.cpp @@ -76,7 +76,7 @@ void Chain::push_viewedge_back(ViewEdge *iViewEdge, bool orientation) } while ((v != vend) && (v != vfirst)); if (v == vfirst) { - //Add last one: + // Add last one: current = (*v)->point2d(); Curve::push_vertex_back(*v); //_Length += (current - previous).norm(); @@ -138,7 +138,7 @@ void Chain::push_viewedge_front(ViewEdge *iViewEdge, bool orientation) } while ((v != vend) && (v != vfirst)); if (v == vfirst) { - //Add last one: + // Add last one: current = (*v)->point2d(); Curve::push_vertex_front(*v); //_Length += (current - previous).norm(); diff --git a/source/blender/freestyle/intern/stroke/ChainingIterators.cpp b/source/blender/freestyle/intern/stroke/ChainingIterators.cpp index de6c50fe571..551b9aa4043 100644 --- a/source/blender/freestyle/intern/stroke/ChainingIterators.cpp +++ b/source/blender/freestyle/intern/stroke/ChainingIterators.cpp @@ -143,10 +143,11 @@ int ChainSilhouetteIterator::traverse(const AdjacencyIterator &ait) return 0; } if (nextVertex->getNature() & Nature::NON_T_VERTEX) { - //soc NonTVertex *nontvertex = (NonTVertex*)nextVertex; + // soc NonTVertex *nontvertex = (NonTVertex*)nextVertex; ViewEdge *newEdge(0); // we'll try to chain the edges by keeping the same nature... - // the preseance order is : SILHOUETTE, BORDER, CREASE, MATERIAL_BOUNDARY, EDGE_MARK, SUGGESTIVE, VALLEY, RIDGE + // the preseance order is : SILHOUETTE, BORDER, CREASE, MATERIAL_BOUNDARY, EDGE_MARK, + // SUGGESTIVE, VALLEY, RIDGE Nature::EdgeNature natures[8] = { Nature::SILHOUETTE, Nature::BORDER, diff --git a/source/blender/freestyle/intern/stroke/ChainingIterators.h b/source/blender/freestyle/intern/stroke/ChainingIterators.h index 57a73c64b3d..94b41083eba 100644 --- a/source/blender/freestyle/intern/stroke/ChainingIterators.h +++ b/source/blender/freestyle/intern/stroke/ChainingIterators.h @@ -32,7 +32,7 @@ #include "../view_map/ViewMapIterators.h" #include "../view_map/ViewMapAdvancedIterators.h" -//using namespace ViewEdgeInternal; +// using namespace ViewEdgeInternal; namespace Freestyle { @@ -98,7 +98,8 @@ class AdjacencyIterator : public Iterator { return _internalIterator.isBegin(); } - /*! Returns true if the current ViewEdge is coming towards the iteration vertex. False otherwise. */ + /*! Returns true if the current ViewEdge is coming towards the iteration vertex. False otherwise. + */ bool isIncoming() const; /*! Returns a *pointer* to the pointed ViewEdge. */ @@ -144,14 +145,15 @@ class AdjacencyIterator : public Iterator { * It makes the works of chaining rules description easier. * The two main methods that need to overloaded are traverse() and init(). * traverse() tells which ViewEdge to follow, among the adjacent ones. - * If you specify restriction rules (such as "Chain only ViewEdges of the selection"), they will be included - * in the adjacency iterator. (i.e, the adjacent iterator will only stop on "valid" edges). + * If you specify restriction rules (such as "Chain only ViewEdges of the selection"), they will + * be included in the adjacency iterator. (i.e, the adjacent iterator will only stop on "valid" + * edges). */ class ChainingIterator : public ViewEdgeInternal::ViewEdgeIterator { protected: bool _restrictToSelection; bool _restrictToUnvisited; - bool _increment; //true if we're currently incrementing, false when decrementing + bool _increment; // true if we're currently incrementing, false when decrementing public: ViewEdge *result; @@ -159,13 +161,11 @@ class ChainingIterator : public ViewEdgeInternal::ViewEdgeIterator { /*! Builds a Chaining Iterator from the first ViewEdge used for iteration and its orientation. * \param iRestrictToSelection: - * Indicates whether to force the chaining to stay within the set of selected ViewEdges or not. - * \param iRestrictToUnvisited: - * Indicates whether a ViewEdge that has already been chained must be ignored ot not. - * \param begin: - * The ViewEdge from which to start the chain. - * \param orientation: - * The direction to follow to explore the graph. If true, the direction indicated by the first ViewEdge is used. + * Indicates whether to force the chaining to stay within the set of selected ViewEdges or + * not. \param iRestrictToUnvisited: Indicates whether a ViewEdge that has already been chained + * must be ignored ot not. \param begin: The ViewEdge from which to start the chain. \param + * orientation: The direction to follow to explore the graph. If true, the direction indicated by + * the first ViewEdge is used. */ ChainingIterator(bool iRestrictToSelection = true, bool iRestrictToUnvisited = true, @@ -200,17 +200,19 @@ class ChainingIterator : public ViewEdgeInternal::ViewEdgeIterator { */ virtual int init(); - /*! This method iterates over the potential next ViewEdges and returns the one that will be followed next. - * returns the next ViewEdge to follow or 0 when the end of the chain is reached. + /*! This method iterates over the potential next ViewEdges and returns the one that will be + * followed next. returns the next ViewEdge to follow or 0 when the end of the chain is reached. * \param it: * The iterator over the ViewEdges adjacent to the end vertex of the current ViewEdge. - * The Adjacency iterator reflects the restriction rules by only iterating over the valid ViewEdges. + * The Adjacency iterator reflects the restriction rules by only iterating over the valid + * ViewEdges. */ virtual int traverse(const AdjacencyIterator &it); /* accessors */ - /*! Returns true if the orientation of the current ViewEdge corresponds to its natural orientation */ - //inline bool getOrientation() const {} + /*! Returns true if the orientation of the current ViewEdge corresponds to its natural + * orientation */ + // inline bool getOrientation() const {} /*! Returns the vertex which is the next crossing */ inline ViewVertex *getVertex() @@ -251,20 +253,18 @@ class ChainingIterator : public ViewEdgeInternal::ViewEdgeIterator { /*! A ViewEdge Iterator used to follow ViewEdges the most naturally. * For example, it will follow visible ViewEdges of same nature. - * As soon, as the nature or the visibility changes, the iteration stops (by setting the pointed ViewEdge to 0). - * In the case of an iteration over a set of ViewEdge that are both Silhouette and Crease, there will be a precedence - * of the silhouette over the crease criterion. + * As soon, as the nature or the visibility changes, the iteration stops (by setting the pointed + * ViewEdge to 0). In the case of an iteration over a set of ViewEdge that are both Silhouette and + * Crease, there will be a precedence of the silhouette over the crease criterion. */ class ChainSilhouetteIterator : public ChainingIterator { public: - /*! Builds a ChainSilhouetteIterator from the first ViewEdge used for iteration and its orientation. - * \param iRestrictToSelection: - * Indicates whether to force the chaining to stay within the set of selected ViewEdges or not. - * \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. + /*! Builds a ChainSilhouetteIterator from the first ViewEdge used for iteration and its + * orientation. \param iRestrictToSelection: Indicates whether to force the chaining to stay + * within the set of selected ViewEdges or not. \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. */ ChainSilhouetteIterator(bool iRestrictToSelection = true, ViewEdge *begin = NULL, @@ -284,8 +284,8 @@ class ChainSilhouetteIterator : public ChainingIterator { return "ChainSilhouetteIterator"; } - /*! This method iterates over the potential next ViewEdges and returns the one that will be followed next. - * When reaching the end of a chain, 0 is returned. + /*! This method iterates over the potential next ViewEdges and returns the one that will be + * followed next. When reaching the end of a chain, 0 is returned. */ virtual int traverse(const AdjacencyIterator &it); @@ -301,13 +301,13 @@ class ChainSilhouetteIterator : public ChainingIterator { // /////////////////////////////////////////////////////////// -/*! A "generic" user-controlled ViewEdge iterator. This iterator is in particular built from a unary predicate and - * a binary predicate. - * First, the unary predicate is evaluated for all potential next ViewEdges in order to only keep the ones respecting - * a certain constraint. - * Then, the binary predicate is evaluated on the current ViewEdge together with each ViewEdge of the previous - * selection. The first ViewEdge respecting both the unary predicate and the binary predicate is kept as the next one. - * If none of the potential next ViewEdge respects these 2 predicates, 0 is returned. +/*! A "generic" user-controlled ViewEdge iterator. This iterator is in particular built from a + * unary predicate and a binary predicate. First, the unary predicate is evaluated for all + * potential next ViewEdges in order to only keep the ones respecting a certain constraint. Then, + * the binary predicate is evaluated on the current ViewEdge together with each ViewEdge of the + * previous selection. The first ViewEdge respecting both the unary predicate and the binary + * predicate is kept as the next one. If none of the potential next ViewEdge respects these 2 + * predicates, 0 is returned. */ class ChainPredicateIterator : public ChainingIterator { protected: @@ -318,14 +318,12 @@ class ChainPredicateIterator : public ChainingIterator { public: /*! Builds a ChainPredicateIterator from a starting ViewEdge and its orientation. * \param iRestrictToSelection: - * Indicates whether to force the chaining to stay within the set of selected ViewEdges or not. - * \param iRestrictToUnvisited: - * Indicates whether a ViewEdge that has already been chained must be ignored ot not. - * \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. + * Indicates whether to force the chaining to stay within the set of selected ViewEdges or + * not. \param iRestrictToUnvisited: Indicates whether a ViewEdge that has already been chained + * must be ignored ot not. \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. */ ChainPredicateIterator(bool iRestrictToSelection = true, bool iRestrictToUnvisited = true, @@ -337,21 +335,18 @@ class ChainPredicateIterator : public ChainingIterator { _unary_predicate = 0; } - /*! Builds a ChainPredicateIterator from a unary predicate, a binary predicate, a starting ViewEdge and - * its orientation. - * \param iRestrictToSelection: - * Indicates whether to force the chaining to stay within the set of selected ViewEdges or not. - * \param iRestrictToUnvisited: + /*! Builds a ChainPredicateIterator from a unary predicate, a binary predicate, a starting + * ViewEdge and its orientation. \param iRestrictToSelection: Indicates whether to force the + * chaining to stay within the set of selected ViewEdges or not. \param iRestrictToUnvisited: * Indicates whether a ViewEdge that has already been chained must be ignored ot not. * \param upred: * The unary predicate that the next ViewEdge must satisfy. * \param bpred: - * The binary predicate that the next ViewEdge must satisfy together with the actual pointed ViewEdge. - * \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. + * The binary predicate that the next ViewEdge must satisfy together with the actual pointed + * ViewEdge. \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. */ ChainPredicateIterator(UnaryPredicate1D &upred, BinaryPredicate1D &bpred, @@ -385,8 +380,8 @@ class ChainPredicateIterator : public ChainingIterator { return "ChainPredicateIterator"; } - /*! This method iterates over the potential next ViewEdges and returns the one that will be followed next. - * When reaching the end of a chain, 0 is returned. + /*! This method iterates over the potential next ViewEdges and returns the one that will be + * followed next. When reaching the end of a chain, 0 is returned. */ virtual int traverse(const AdjacencyIterator &it); diff --git a/source/blender/freestyle/intern/stroke/Curve.cpp b/source/blender/freestyle/intern/stroke/Curve.cpp index a0709b0e2be..fe617646442 100644 --- a/source/blender/freestyle/intern/stroke/Curve.cpp +++ b/source/blender/freestyle/intern/stroke/Curve.cpp @@ -527,7 +527,7 @@ Curve::point_iterator Curve::points_begin(float step) ++second; return point_iterator( _Vertices.begin(), second, _Vertices.begin(), _Vertices.end(), _nSegments, step, 0.0f, 0.0f); - //return point_iterator(_Vertices.begin(), second, _nSegments, step, 0.0f, 0.0f); + // return point_iterator(_Vertices.begin(), second, _nSegments, step, 0.0f, 0.0f); } Curve::const_point_iterator Curve::points_begin(float step) const @@ -536,7 +536,7 @@ Curve::const_point_iterator Curve::points_begin(float step) const ++second; return const_point_iterator( _Vertices.begin(), second, _Vertices.begin(), _Vertices.end(), _nSegments, step, 0.0f, 0.0f); - //return const_point_iterator(_Vertices.begin(), second, _nSegments, step, 0.0f, 0.0f); + // return const_point_iterator(_Vertices.begin(), second, _nSegments, step, 0.0f, 0.0f); } Curve::point_iterator Curve::points_end(float step) @@ -549,7 +549,7 @@ Curve::point_iterator Curve::points_end(float step) step, 1.0f, _Length); - //return point_iterator(_Vertices.end(), _Vertices.end(), _nSegments, step, 1.0f, _Length); + // return point_iterator(_Vertices.end(), _Vertices.end(), _nSegments, step, 1.0f, _Length); } Curve::const_point_iterator Curve::points_end(float step) const @@ -562,7 +562,8 @@ Curve::const_point_iterator Curve::points_end(float step) const step, 1.0f, _Length); - //return const_point_iterator(_Vertices.end(), _Vertices.end(), _nSegments, step, 1.0f, _Length); + // return const_point_iterator(_Vertices.end(), _Vertices.end(), _nSegments, step, 1.0f, + // _Length); } // Adavnced Iterators access diff --git a/source/blender/freestyle/intern/stroke/Curve.h b/source/blender/freestyle/intern/stroke/Curve.h index 2a1d80f3029..b84ce45fb6d 100644 --- a/source/blender/freestyle/intern/stroke/Curve.h +++ b/source/blender/freestyle/intern/stroke/Curve.h @@ -55,10 +55,10 @@ using namespace Geometry; /*! Class to represent a point of a curve. * A CurvePoint can be any point of a 1D curve (it doesn't have to be a vertex of the curve). - * Any Interface1D is built upon ViewEdges, themselves built upon FEdges. Therefore, a curve is basically - * a polyline made of a list SVertex. - * Thus, a CurvePoint is built by lineraly interpolating two SVertex. - * CurvePoint can be used as virtual points while querying 0D information along a curve at a given resolution. + * Any Interface1D is built upon ViewEdges, themselves built upon FEdges. Therefore, a curve is + * basically a polyline made of a list SVertex. Thus, a CurvePoint is built by lineraly + * interpolating two SVertex. CurvePoint can be used as virtual points while querying 0D + * information along a curve at a given resolution. */ class CurvePoint : public Interface0D { public: // Implementation of Interface0D @@ -188,7 +188,7 @@ class CurvePoint : public Interface0D { SVertex *__A; SVertex *__B; float _t2d; - //float _t3d; + // float _t3d; Vec3r _Point2d; Vec3r _Point3d; @@ -216,7 +216,7 @@ class CurvePoint : public Interface0D { */ CurvePoint(CurvePoint *iA, CurvePoint *iB, float t2d); - //CurvePoint(SVertex *iA, SVertex *iB, float t2d, float t3d); + // CurvePoint(SVertex *iA, SVertex *iB, float t2d, float t3d); /*! Copy Constructor. */ CurvePoint(const CurvePoint &iBrother); @@ -302,12 +302,12 @@ class CurvePoint : public Interface0D { } Vec3r normal() const; - //FrsMaterial material() const; - //Id shape_id() const; + // FrsMaterial material() const; + // Id shape_id() const; const SShape *shape() const; - //float shape_importance() const; + // float shape_importance() const; - //const unsigned qi() const; + // const unsigned qi() const; occluder_container::const_iterator occluders_begin() const; occluder_container::const_iterator occluders_end() const; bool occluders_empty() const; @@ -564,25 +564,25 @@ class Curve : public Interface1D { CurveInternal::CurvePointIterator curveVerticesEnd(); // Iterators access - /*! Returns an Interface0DIterator pointing onto the first vertex of the Curve and that can iterate - * over the \a vertices of the Curve. + /*! Returns an Interface0DIterator pointing onto the first vertex of the Curve and that can + * iterate over the \a vertices of the Curve. */ virtual Interface0DIterator verticesBegin(); - /*! Returns an Interface0DIterator pointing after the last vertex of the Curve and that can iterate - * over the \a vertices of the Curve. + /*! Returns an Interface0DIterator pointing after the last vertex of the Curve and that can + * iterate over the \a vertices of the Curve. */ virtual Interface0DIterator verticesEnd(); - /*! Returns an Interface0DIterator pointing onto the first point of the Curve and that can iterate - * over the \a points of the Curve at any resolution. - * At each iteration a virtual temporary CurvePoint is created. + /*! Returns an Interface0DIterator pointing onto the first point of the Curve and that can + * iterate over the \a points of the Curve at any resolution. At each iteration a virtual + * temporary CurvePoint is created. */ virtual Interface0DIterator pointsBegin(float t = 0.0f); - /*! Returns an Interface0DIterator pointing after the last point of the Curve and that can iterate - * over the \a points of the Curve at any resolution. - * At each iteration a virtual temporary CurvePoint is created. + /*! Returns an Interface0DIterator pointing after the last point of the Curve and that can + * iterate over the \a points of the Curve at any resolution. At each iteration a virtual + * temporary CurvePoint is created. */ virtual Interface0DIterator pointsEnd(float t = 0.0f); diff --git a/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h b/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h index f993c21ddb6..5cbdd26be57 100644 --- a/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h +++ b/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h @@ -50,8 +50,8 @@ class CurvePoint_nonconst_traits : public Nonconst_traits<CurvePoint *> { /* */ /**********************************/ -/*! iterator on a curve. Allows an iterating outside initial vertices. A CurvePoint is instanciated an returned - * when the iterator is dereferenced. +/*! iterator on a curve. Allows an iterating outside initial vertices. A CurvePoint is + * instanciated an returned when the iterator is dereferenced. */ template<class Traits> class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Traits> { @@ -86,7 +86,7 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr friend class __point_iterator<CurvePoint_nonconst_traits>; friend class iterator; #endif - //protected: + // protected: public: float _CurvilinearLength; float _step; @@ -169,7 +169,7 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr delete _Point; } - //protected: //FIXME + // protected: //FIXME public: inline __point_iterator(vertex_container_iterator iA, vertex_container_iterator iB, @@ -307,7 +307,7 @@ class __point_iterator : public IteratorBase<Traits, BidirectionalIteratorTag_Tr else { _t = 1.0f; // AB is a null segment, we're directly at its end } - //if normAB ~= 0, we don't change these values + // if normAB ~= 0, we don't change these values if (_t >= 1) { _CurvilinearLength -= normAB * (_t - 1); if (_currentn == _n - 1) { diff --git a/source/blender/freestyle/intern/stroke/CurveIterators.h b/source/blender/freestyle/intern/stroke/CurveIterators.h index 428ea022dfd..b05c9838a3b 100644 --- a/source/blender/freestyle/intern/stroke/CurveIterators.h +++ b/source/blender/freestyle/intern/stroke/CurveIterators.h @@ -187,7 +187,7 @@ class CurvePointIterator : public Interface0DIteratorNested { return false; } - //protected: + // protected: virtual int increment() { if ((_currentn == _n - 1) && (_t == 1.0f)) { @@ -223,7 +223,7 @@ class CurvePointIterator : public Interface0DIteratorNested { else { _t = 1.0f; // AB is a null segment, we're directly at its end } - //if normAB ~= 0, we don't change these values + // if normAB ~= 0, we don't change these values if (_t >= 1) { _CurvilinearLength -= normAB * (_t - 1); if (_currentn == _n - 1) { @@ -241,7 +241,7 @@ class CurvePointIterator : public Interface0DIteratorNested { virtual int decrement() { - if (_t == 0.0f) { //we're at the beginning of the edge + if (_t == 0.0f) { // we're at the beginning of the edge _t = 1.0f; --_currentn; --__A; diff --git a/source/blender/freestyle/intern/stroke/Operators.cpp b/source/blender/freestyle/intern/stroke/Operators.cpp index fc4d099061c..0374e605ff2 100644 --- a/source/blender/freestyle/intern/stroke/Operators.cpp +++ b/source/blender/freestyle/intern/stroke/Operators.cpp @@ -278,7 +278,7 @@ void Operators::bidirectionalChain(ViewEdgeIterator &it, UnaryPredicate1D &pred) Chain *new_chain = new Chain(id); ++id; -# if 0 //FIXME +# if 0 // FIXME ViewEdgeIterator it_back(it); --it_back; # endif @@ -841,7 +841,7 @@ static int __recursiveSplit(Chain *_curve, real _min = FLT_MAX; ++it; real mean = 0.f; - //soc unused - real variance = 0.0f; + // soc unused - real variance = 0.0f; unsigned count = 0; CurveInternal::CurvePointIterator next = it; ++next; @@ -865,7 +865,7 @@ static int __recursiveSplit(Chain *_curve, } mean /= (float)count; - //if ((!bsplit) || (mean - _min > mean)) { // we didn't find any minimum + // if ((!bsplit) || (mean - _min > mean)) { // we didn't find any minimum if (!bsplit) { // we didn't find any minimum newChains.push_back(_curve); return 0; @@ -1210,7 +1210,7 @@ inline int applyShading(Stroke &stroke, vector<StrokeShader *> &shaders) int Operators::create(UnaryPredicate1D &pred, vector<StrokeShader *> shaders) { - //Canvas* canvas = Canvas::getInstance(); + // Canvas* canvas = Canvas::getInstance(); if (!_current_set) { cerr << "Warning: current set empty" << endl; return 0; @@ -1229,7 +1229,7 @@ int Operators::create(UnaryPredicate1D &pred, vector<StrokeShader *> shaders) delete stroke; goto error; } - //canvas->RenderStroke(stroke); + // canvas->RenderStroke(stroke); new_strokes_set.push_back(stroke); } } diff --git a/source/blender/freestyle/intern/stroke/Operators.h b/source/blender/freestyle/intern/stroke/Operators.h index 9d63108a813..517f63e99d4 100644 --- a/source/blender/freestyle/intern/stroke/Operators.h +++ b/source/blender/freestyle/intern/stroke/Operators.h @@ -43,8 +43,9 @@ namespace Freestyle { /*! Class defining the operators used in a style module. - * There are 4 classes of operators: Selection, Chaining, Splitting and Creating. All these operators are - * user controlled in the scripting language through Functors, Predicates and Shaders that are taken as arguments. + * There are 4 classes of operators: Selection, Chaining, Splitting and Creating. All these + * operators are user controlled in the scripting language through Functors, Predicates and Shaders + * that are taken as arguments. */ class Operators { @@ -63,146 +64,127 @@ class Operators { static int select(UnaryPredicate1D &pred); /*! Builds a set of chains from the current set of ViewEdges. - * Each ViewEdge of the current list starts a new chain. The chaining operator then iterates over the ViewEdges - * of the ViewMap using the user specified iterator. - * This operator only iterates using the increment operator and is therefore unidirectional. - * \param it: - * The iterator on the ViewEdges of the ViewMap. It contains the chaining rule. - * \param pred: - * The predicate on the ViewEdge that expresses the stopping condition. - * \param modifier: - * A function that takes a ViewEdge as argument and that is used to modify the processed ViewEdge - * state (the timestamp incrementation is a typical illustration of such a modifier) + * Each ViewEdge of the current list starts a new chain. The chaining operator then iterates + * over the ViewEdges of the ViewMap using the user specified iterator. This operator only + * iterates using the increment operator and is therefore unidirectional. \param it: The iterator + * on the ViewEdges of the ViewMap. It contains the chaining rule. \param pred: The predicate on + * the ViewEdge that expresses the stopping condition. \param modifier: A function that takes a + * ViewEdge as argument and that is used to modify the processed ViewEdge state (the timestamp + * incrementation is a typical illustration of such a modifier) */ static int chain(ViewEdgeInternal::ViewEdgeIterator &it, UnaryPredicate1D &pred, UnaryFunction1D_void &modifier); /*! Builds a set of chains from the current set of ViewEdges. - * Each ViewEdge of the current list starts a new chain. The chaining operator then iterates over the ViewEdges - * of the ViewMap using the user specified iterator. - * This operator only iterates using the increment operator and is therefore unidirectional. - * This chaining operator is different from the previous one because it doesn't take any modifier as argument. - * Indeed, the time stamp (insuring that a ViewEdge is processed one time) is automatically managed in this case. - * \param it: - * The iterator on the ViewEdges of the ViewMap. It contains the chaining rule. - * \param pred: - * The predicate on the ViewEdge that expresses the stopping condition. + * Each ViewEdge of the current list starts a new chain. The chaining operator then iterates + * over the ViewEdges of the ViewMap using the user specified iterator. This operator only + * iterates using the increment operator and is therefore unidirectional. This chaining operator + * is different from the previous one because it doesn't take any modifier as argument. Indeed, + * the time stamp (insuring that a ViewEdge is processed one time) is automatically managed in + * this case. \param it: The iterator on the ViewEdges of the ViewMap. It contains the chaining + * rule. \param pred: The predicate on the ViewEdge that expresses the stopping condition. */ static int chain(ViewEdgeInternal::ViewEdgeIterator &it, UnaryPredicate1D &pred); /*! Builds a set of chains from the current set of ViewEdges. - * Each ViewEdge of the current list potentially starts a new chain. The chaining operator then iterates over - * the ViewEdges of the ViewMap using the user specified iterator. - * This operator iterates both using the increment and decrement operators and is therefore bidirectional. - * This operator works with a ChainingIterator which contains the chaining rules. It is this last one which can - * be told to chain only edges that belong to the selection or not to process twice a ViewEdge during the chaining. - * Each time a ViewEdge is added to a chain, its chaining time stamp is incremented. This allows you to keep track - * of the number of chains to which a ViewEdge belongs to. - * \param it: - * The ChainingIterator on the ViewEdges of the ViewMap. It contains the chaining rule. - * \param pred: - * The predicate on the ViewEdge that expresses the stopping condition. + * Each ViewEdge of the current list potentially starts a new chain. The chaining operator then + * iterates over the ViewEdges of the ViewMap using the user specified iterator. This operator + * iterates both using the increment and decrement operators and is therefore bidirectional. This + * operator works with a ChainingIterator which contains the chaining rules. It is this last one + * which can be told to chain only edges that belong to the selection or not to process twice a + * ViewEdge during the chaining. Each time a ViewEdge is added to a chain, its chaining time + * stamp is incremented. This allows you to keep track of the number of chains to which a + * ViewEdge belongs to. \param it: The ChainingIterator on the ViewEdges of the ViewMap. It + * contains the chaining rule. \param pred: The predicate on the ViewEdge that expresses the + * stopping condition. */ static int bidirectionalChain(ChainingIterator &it, UnaryPredicate1D &pred); - /*! The only difference with the above bidirectional chaining algorithm is that we don't need to pass a stopping - * criterion. This might be desirable when the stopping criterion is already contained in the iterator definition. - * Builds a set of chains from the current set of ViewEdges. - * Each ViewEdge of the current list potentially starts a new chain. The chaining operator then iterates over - * the ViewEdges of the ViewMap using the user specified iterator. - * This operator iterates both using the increment and decrement operators and is therefore bidirectional. - * This operator works with a ChainingIterator which contains the chaining rules. It is this last one which can be - * told to chain only edges that belong to the selection or not to process twice a ViewEdge during the chaining. - * Each time a ViewEdge is added to a chain, its chaining time stamp is incremented. This allows you to keep track - * of the number of chains to which a ViewEdge belongs to. - * \param it: - * The ChainingIterator on the ViewEdges of the ViewMap. It contains the chaining rule. + /*! The only difference with the above bidirectional chaining algorithm is that we don't need to + * pass a stopping criterion. This might be desirable when the stopping criterion is already + * contained in the iterator definition. Builds a set of chains from the current set of + * ViewEdges. Each ViewEdge of the current list potentially starts a new chain. The chaining + * operator then iterates over the ViewEdges of the ViewMap using the user specified iterator. + * This operator iterates both using the increment and decrement operators and is therefore + * bidirectional. This operator works with a ChainingIterator which contains the chaining rules. + * It is this last one which can be told to chain only edges that belong to the selection or not + * to process twice a ViewEdge during the chaining. Each time a ViewEdge is added to a chain, its + * chaining time stamp is incremented. This allows you to keep track of the number of chains to + * which a ViewEdge belongs to. \param it: The ChainingIterator on the ViewEdges of the ViewMap. + * It contains the chaining rule. */ static int bidirectionalChain(ChainingIterator &it); /*! Splits each chain of the current set of chains in a sequential way. * The points of each chain are processed (with a specified sampling) sequentially. - * Each time a user specified starting condition is verified, a new chain begins and ends as soon as a - * user-defined stopping predicate is verified. - * This allows chains overlapping rather than chains partitioning. - * The first point of the initial chain is the first point of one of the resulting chains. - * The splitting ends when no more chain can start. - * \param startingPred: + * Each time a user specified starting condition is verified, a new chain begins and ends as + * soon as a user-defined stopping predicate is verified. This allows chains overlapping rather + * than chains partitioning. The first point of the initial chain is the first point of one of + * the resulting chains. The splitting ends when no more chain can start. \param startingPred: * The predicate on a point that expresses the starting condition * \param stoppingPred: * The predicate on a point that expresses the stopping condition * \param sampling: - * The resolution used to sample the chain for the predicates evaluation. (The chain is not actually - * resampled, a virtual point only progresses along the curve using this resolution) + * The resolution used to sample the chain for the predicates evaluation. (The chain is + * not actually resampled, a virtual point only progresses along the curve using this resolution) */ static int sequentialSplit(UnaryPredicate0D &startingPred, UnaryPredicate0D &stoppingPred, float sampling = 0.0f); /*! Splits each chain of the current set of chains in a sequential way. - * The points of each chain are processed (with a specified sampling) sequentially and each time a user - * specified condition is verified, the chain is split into two chains. - * The resulting set of chains is a partition of the initial chain - * \param pred: - * The predicate on a point that expresses the splitting condition - * \param sampling: - * The resolution used to sample the chain for the predicate evaluation. (The chain is not actually - * resampled, a virtual point only progresses along the curve using this resolution) + * The points of each chain are processed (with a specified sampling) sequentially and each time + * a user specified condition is verified, the chain is split into two chains. The resulting set + * of chains is a partition of the initial chain \param pred: The predicate on a point that + * expresses the splitting condition \param sampling: The resolution used to sample the chain for + * the predicate evaluation. (The chain is not actually resampled, a virtual point only + * progresses along the curve using this resolution) */ static int sequentialSplit(UnaryPredicate0D &pred, float sampling = 0.0f); /*! Splits the current set of chains in a recursive way. - * We process the points of each chain (with a specified sampling) to find the point minimizing a specified - * function. The chain is split in two at this point and the two new chains are processed in the same way. - * The recursivity level is controlled through a predicate 1D that expresses a stopping condition - * on the chain that is about to be processed. - * \param func: - * The Unary Function evaluated at each point of the chain. - * The splitting point is the point minimizing this function - * \param pred: - * The Unary Predicate ex pressing the recursivity stopping condition. - * This predicate is evaluated for each curve before it actually gets split. - * If pred(chain) is true, the curve won't be split anymore. - * \param sampling: - * The resolution used to sample the chain for the predicates evaluation. (The chain is not actually - * resampled, a virtual point only progresses along the curve using this resolution) + * We process the points of each chain (with a specified sampling) to find the point minimizing + * a specified function. The chain is split in two at this point and the two new chains are + * processed in the same way. The recursivity level is controlled through a predicate 1D that + * expresses a stopping condition on the chain that is about to be processed. \param func: The + * Unary Function evaluated at each point of the chain. The splitting point is the point + * minimizing this function \param pred: The Unary Predicate ex pressing the recursivity stopping + * condition. This predicate is evaluated for each curve before it actually gets split. If + * pred(chain) is true, the curve won't be split anymore. \param sampling: The resolution used to + * sample the chain for the predicates evaluation. (The chain is not actually resampled, a + * virtual point only progresses along the curve using this resolution) */ static int recursiveSplit(UnaryFunction0D<double> &func, UnaryPredicate1D &pred, float sampling = 0); /*! Splits the current set of chains in a recursive way. - * We process the points of each chain (with a specified sampling) to find the point minimizing a specified - * function. The chain is split in two at this point and the two new chains are processed in the same way. - * The user can specify a 0D predicate to make a first selection on the points that can potentially be split. - * A point that doesn't verify the 0D predicate won't be candidate in realizing the min. - * The recursivity level is controlled through a predicate 1D that expresses a stopping condition - * on the chain that is about to be processed. - * \param func: + * We process the points of each chain (with a specified sampling) to find the point minimizing + * a specified function. The chain is split in two at this point and the two new chains are + * processed in the same way. The user can specify a 0D predicate to make a first selection on + * the points that can potentially be split. A point that doesn't verify the 0D predicate won't + * be candidate in realizing the min. The recursivity level is controlled through a predicate 1D + * that expresses a stopping condition on the chain that is about to be processed. \param func: * The Unary Function evaluated at each point of the chain. * The splitting point is the point minimizing this function * \param pred0d: - * The Unary Predicate 0D used to select the candidate points where the split can occur. - * For example, it is very likely that would rather have your chain splitting around its middle point - * than around one of its extremities. A 0D predicate working on the curvilinear abscissa allows - * to add this kind of constraints. - * \param pred: - * The Unary Predicate ex pressing the recursivity stopping condition. - * This predicate is evaluated for each curve before it actually gets split. - * If pred(chain) is true, the curve won't be split anymore. - * \param sampling: - * The resolution used to sample the chain for the predicates evaluation. (The chain is not actually - * resampled, a virtual point only progresses along the curve using this resolution) + * The Unary Predicate 0D used to select the candidate points where the split can + * occur. For example, it is very likely that would rather have your chain splitting around its + * middle point than around one of its extremities. A 0D predicate working on the curvilinear + * abscissa allows to add this kind of constraints. \param pred: The Unary Predicate ex pressing + * the recursivity stopping condition. This predicate is evaluated for each curve before it + * actually gets split. If pred(chain) is true, the curve won't be split anymore. \param + * sampling: The resolution used to sample the chain for the predicates evaluation. (The chain is + * not actually resampled, a virtual point only progresses along the curve using this resolution) */ static int recursiveSplit(UnaryFunction0D<double> &func, UnaryPredicate0D &pred0d, UnaryPredicate1D &pred, float sampling = 0.0f); - /*! Sorts the current set of chains (or viewedges) according to the comparison predicate given as argument. - * \param pred: - * The binary predicate used for the comparison + /*! Sorts the current set of chains (or viewedges) according to the comparison predicate given as + * argument. \param pred: The binary predicate used for the comparison */ static int sort(BinaryPredicate1D &pred); diff --git a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp index 20dac647cdc..e7428c795fc 100644 --- a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp @@ -70,8 +70,8 @@ void PSStrokeRenderer::RenderStrokeRepBasic(StrokeRep *iStrokeRep) const svRep[2] = *(v[2]); color[0] = svRep[0]->color(); - //color[1] = svRep[1]->color(); - //color[2] = svRep[2]->color(); + // color[1] = svRep[1]->color(); + // color[2] = svRep[2]->color(); _ofstream << "newpath" << endl; _ofstream << (color[0])[0] << " " << (color[0])[1] << " " << (color[0])[2] << " setrgbcolor" diff --git a/source/blender/freestyle/intern/stroke/Predicates0D.h b/source/blender/freestyle/intern/stroke/Predicates0D.h index f511c0ceade..90b6d99f2db 100644 --- a/source/blender/freestyle/intern/stroke/Predicates0D.h +++ b/source/blender/freestyle/intern/stroke/Predicates0D.h @@ -65,8 +65,8 @@ class UnaryPredicate0D { /*! The () operator. Must be overload by inherited classes. * \param it: - * The Interface0DIterator pointing onto the Interface0D at which we wish to evaluate the predicate. - * \return true if the condition is satisfied, false otherwise. + * The Interface0DIterator pointing onto the Interface0D at which we wish to evaluate the + * predicate. \return true if the condition is satisfied, false otherwise. */ virtual int operator()(Interface0DIterator &it); diff --git a/source/blender/freestyle/intern/stroke/Predicates1D.h b/source/blender/freestyle/intern/stroke/Predicates1D.h index be70907b51b..3560f29ee36 100644 --- a/source/blender/freestyle/intern/stroke/Predicates1D.h +++ b/source/blender/freestyle/intern/stroke/Predicates1D.h @@ -183,8 +183,8 @@ class FalseUP1D : public UnaryPredicate1D { }; // QuantitativeInvisibilityUP1D -/*! Returns true if the Quantitative Invisibility evaluated at an Interface1D, using the QuantitativeInvisibilityF1D - * functor, equals a certain user-defined value. +/*! Returns true if the Quantitative Invisibility evaluated at an Interface1D, using the + * QuantitativeInvisibilityF1D functor, equals a certain user-defined value. */ class QuantitativeInvisibilityUP1D : public UnaryPredicate1D { public: @@ -344,7 +344,8 @@ class EqualToChainingTimeStampUP1D : public UnaryPredicate1D { }; // ShapeUP1D -/*! Returns true if the shape to which the Interface1D belongs to has the same Id as the one specified by the user. */ +/*! Returns true if the shape to which the Interface1D belongs to has the same Id as the one + * specified by the user. */ class ShapeUP1D : public UnaryPredicate1D { private: Id _id; @@ -487,7 +488,8 @@ class FalseBP1D : public BinaryPredicate1D { }; // Length2DBP1D -/*! Returns true if the 2D length of the Interface1D i1 is less than the 2D length of the Interface1D i2. */ +/*! Returns true if the 2D length of the Interface1D i1 is less than the 2D length of the + * Interface1D i2. */ class Length2DBP1D : public BinaryPredicate1D { public: /*! Returns the string "Length2DBP1D" */ @@ -538,7 +540,8 @@ class SameShapeIdBP1D : public BinaryPredicate1D { }; // ViewMapGradientNormBP1D -/*! Returns true if the evaluation of the Gradient norm Function is higher for Interface1D i1 than for i2. */ +/*! Returns true if the evaluation of the Gradient norm Function is higher for Interface1D i1 than + * for i2. */ class ViewMapGradientNormBP1D : public BinaryPredicate1D { private: Functions1D::GetViewMapGradientNormF1D _func; diff --git a/source/blender/freestyle/intern/stroke/QInformationMap.h b/source/blender/freestyle/intern/stroke/QInformationMap.h index 99393a8949c..d3a4218f9d7 100644 --- a/source/blender/freestyle/intern/stroke/QInformationMap.h +++ b/source/blender/freestyle/intern/stroke/QInformationMap.h @@ -38,7 +38,7 @@ class QInformationMap : public InformationMap { QInformationMap(const QInformationMap &); QInformationMap &operator=(const QInformationMap &); - //float getSmoothedPixel(int x, int y, float sigma = 0.2f);1 + // float getSmoothedPixel(int x, int y, float sigma = 0.2f);1 virtual float getMean(int x, int y); virtual void retrieveMeanAndVariance(int x, int y, float &oMean, float &oVariance); diff --git a/source/blender/freestyle/intern/stroke/Stroke.cpp b/source/blender/freestyle/intern/stroke/Stroke.cpp index ef40865ecf1..ff0cd64fdaa 100644 --- a/source/blender/freestyle/intern/stroke/Stroke.cpp +++ b/source/blender/freestyle/intern/stroke/Stroke.cpp @@ -484,7 +484,7 @@ void Stroke::setLength(float iLength) float Stroke::ComputeSampling(int iNVertices) { - if (iNVertices <= (int)_Vertices.size()) //soc + if (iNVertices <= (int)_Vertices.size()) // soc return _sampling; float sampling = _Length / (float)(iNVertices - _Vertices.size() + 1); @@ -563,7 +563,7 @@ int Stroke::Resample(int iNPoints) if (s->_resampled == false) { if ((!checkEveryone) && (s->_length < meanlength)) continue; - //resample + // resample s->_n = s->_n + 1; s->_sampling = s->_length / (float)(s->_n + 1); s->_resampled = resampled = true; @@ -577,10 +577,11 @@ int Stroke::Resample(int iNPoints) checkEveryone = true; } if (N < NPointsToAdd) { - // fatal error, likely because _Length is inconsistent with the stroke length computed with the vertices + // fatal error, likely because _Length is inconsistent with the stroke length computed with the + // vertices return -1; } - //actually resample: + // actually resample: for (vector<StrokeSegment>::iterator s = strokeSegments.begin(), send = strokeSegments.end(); s != send; ++s) { @@ -617,7 +618,7 @@ int Stroke::Resample(int iNPoints) int Stroke::Resample(float iSampling) { - //cerr << "old size :" << strokeVerticesSize() << endl; + // cerr << "old size :" << strokeVerticesSize() << endl; if (iSampling == 0) return 0; if (iSampling >= _sampling) @@ -625,7 +626,7 @@ int Stroke::Resample(float iSampling) _sampling = iSampling; // Resample... - //real curvilinearLength = 0.0f; + // real curvilinearLength = 0.0f; vertex_container newVertices; real t = 0.0f; const real limit = 0.99; @@ -641,17 +642,17 @@ int Stroke::Resample(float iSampling) Vec2r vec_tmp(b - a); real norm_var = vec_tmp.norm(); if (norm_var <= _sampling) { - //curvilinearLength += norm_var; + // curvilinearLength += norm_var; ++it; ++next; continue; } - //curvilinearLength += _sampling; + // curvilinearLength += _sampling; t = _sampling / norm_var; while (t < limit) { newVertex = new StrokeVertex(&(*it), &(*next), t); - //newVertex->setCurvilinearAbscissa(curvilinearLength); + // newVertex->setCurvilinearAbscissa(curvilinearLength); newVertices.push_back(newVertex); t = t + _sampling / norm_var; } @@ -798,7 +799,7 @@ Stroke::vertex_iterator Stroke::vertices_begin(float sampling) if ((sampling != 0) && (sampling < _sampling)) Resample(sampling); return vertex_iterator(_Vertices.begin(), _Vertices.begin(), _Vertices.end()); - //return _Vertices.begin(); + // return _Vertices.begin(); } #if 0 diff --git a/source/blender/freestyle/intern/stroke/Stroke.h b/source/blender/freestyle/intern/stroke/Stroke.h index 3eae5e91b6a..ec722516d2a 100644 --- a/source/blender/freestyle/intern/stroke/Stroke.h +++ b/source/blender/freestyle/intern/stroke/Stroke.h @@ -143,8 +143,8 @@ class StrokeAttribute { } /*! Returns the attribute's thickness. - * \return an array of 2 floats. the first value is the thickness on the right of the vertex when following - * the stroke, the second one is the thickness on the left. + * \return an array of 2 floats. the first value is the thickness on the right of the vertex + * when following the stroke, the second one is the thickness on the left. */ inline const float *getThickness() const { @@ -163,7 +163,8 @@ class StrokeAttribute { return _thickness[1]; } - /*! Returns the thickness on the right and on the left of the vertex when following the stroke. */ + /*! Returns the thickness on the right and on the left of the vertex when following the stroke. + */ inline Vec2f getThicknessRL() const { return Vec2f(_thickness[0], _thickness[1]); @@ -462,8 +463,8 @@ class StrokeVertex : public CurvePoint { _CurvilignAbscissa = iAbscissa; } - /*! sets the Stroke's length (it's only a value stored by the Stroke Vertex, it won't change the real - * Stroke's length.) + /*! sets the Stroke's length (it's only a value stored by the Stroke Vertex, it won't change the + * real Stroke's length.) */ inline void setStrokeLength(float iLength) { @@ -498,7 +499,8 @@ class StrokeVertexIterator; /*! Class to define a stroke. * A stroke is made of a set of 2D vertices (StrokeVertex), regularly spaced out. * This set of vertices defines the stroke's backbone geometry. - * Each of these stroke vertices defines the stroke's shape and appearance at this vertex position. + * Each of these stroke vertices defines the stroke's shape and appearance at this vertex + * position. */ class Stroke : public Interface1D { public: // Implementation of Interface1D @@ -532,7 +534,7 @@ class Stroke : public Interface1D { const_vertex_iterator; public: - //typedef StrokeVertex vertex_type; + // typedef StrokeVertex vertex_type; private: vertex_container _Vertices; //! The stroke's backbone vertices @@ -575,8 +577,8 @@ class Stroke : public Interface1D { Stroke &operator=(const Stroke &iBrother); /*! Compute the sampling needed to get iNVertices vertices. - * If the specified number of vertices is less than the actual number of vertices, the actual sampling value - * is returned. (To remove Vertices, use the RemoveVertex() method of this class). + * If the specified number of vertices is less than the actual number of vertices, the actual + * sampling value is returned. (To remove Vertices, use the RemoveVertex() method of this class). * \param iNVertices: * The number of StrokeVertices we eventually want in our Stroke. * \return the sampling that must be used in the Resample(float) method. @@ -586,11 +588,10 @@ class Stroke : public Interface1D { float ComputeSampling(int iNVertices); /*! Resampling method. - * Resamples the curve so that it eventually has iNPoints. That means it is going to add iNPoints-vertices_size, - * if vertices_size is the number of points we already have. - * If vertices_size >= iNPoints, no resampling is done. - * \param iNPoints: - * The number of vertices we eventually want in our stroke. + * Resamples the curve so that it eventually has iNPoints. That means it is going to add + * iNPoints-vertices_size, if vertices_size is the number of points we already have. If + * vertices_size >= iNPoints, no resampling is done. \param iNPoints: The number of vertices we + * eventually want in our stroke. */ int Resample(int iNPoints); @@ -838,11 +839,9 @@ class Stroke : public Interface1D { const_vertex_iterator vertices_end() const; vertex_iterator vertices_end(); - /*! Returns a StrokeVertexIterator pointing on the first StrokeVertex of the Stroke. One can specify a sampling - * value to resample the Stroke on the fly if needed. - * \param t: - * The resampling value with which we want our Stroke to be resampled. - * If 0 is specified, no resampling is done. + /*! Returns a StrokeVertexIterator pointing on the first StrokeVertex of the Stroke. One can + * specify a sampling value to resample the Stroke on the fly if needed. \param t: The resampling + * value with which we want our Stroke to be resampled. If 0 is specified, no resampling is done. */ StrokeInternal::StrokeVertexIterator strokeVerticesBegin(float t = 0.0f); diff --git a/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h b/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h index e9d4659f320..ccf5773a4c8 100644 --- a/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h +++ b/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h @@ -51,7 +51,7 @@ class vertex_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTa typedef vertex_iterator_base<vertex_nonconst_traits> iterator; typedef vertex_iterator_base<vertex_const_traits> const_iterator; - //protected: + // protected: public: vertex_container_iterator _it; vertex_container_iterator _begin; @@ -59,7 +59,7 @@ class vertex_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTa public: friend class Stroke; - //friend class vertex_iterator; + // friend class vertex_iterator; inline vertex_iterator_base() : parent_class() { @@ -79,7 +79,7 @@ class vertex_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTa _end = iBrother._end; } - //protected: //FIXME + // protected: //FIXME public: inline vertex_iterator_base(vertex_container_iterator it, vertex_container_iterator begin, diff --git a/source/blender/freestyle/intern/stroke/StrokeIterators.h b/source/blender/freestyle/intern/stroke/StrokeIterators.h index 1999b028424..624f2a03877 100644 --- a/source/blender/freestyle/intern/stroke/StrokeIterators.h +++ b/source/blender/freestyle/intern/stroke/StrokeIterators.h @@ -34,15 +34,14 @@ namespace StrokeInternal { ///////////////////////////////////////////////// /*! Class defining an iterator designed to iterate over the StrokeVertex of a Stroke. - * An instance of a StrokeVertexIterator can only be obtained from a Stroke by calling strokeVerticesBegin() or - * strokeVerticesEnd(). - * It is iterating over the same vertices as an Interface0DIterator. - * The difference resides in the object access. Indeed, an Interface0DIterator allows only an access to an - * Interface0D whereas we could need to access the specialized StrokeVertex type. In this case, one - * should use a StrokeVertexIterator. - * The castToInterface0DIterator() method is useful to get an Interface0DIterator from a StrokeVertexIterator in - * order to call any functions of the type UnaryFunction0D. - * \attention In the scripting language, you must call \code it2 = StrokeVertexIterator(it1) \endcode instead of + * An instance of a StrokeVertexIterator can only be obtained from a Stroke by calling + * strokeVerticesBegin() or strokeVerticesEnd(). It is iterating over the same vertices as an + * Interface0DIterator. The difference resides in the object access. Indeed, an Interface0DIterator + * allows only an access to an Interface0D whereas we could need to access the specialized + * StrokeVertex type. In this case, one should use a StrokeVertexIterator. The + * castToInterface0DIterator() method is useful to get an Interface0DIterator from a + * StrokeVertexIterator in order to call any functions of the type UnaryFunction0D. \attention In + * the scripting language, you must call \code it2 = StrokeVertexIterator(it1) \endcode instead of * \code it2 = it1 \endcode where \a it1 and \a it2 are 2 StrokeVertexIterator. * Otherwise, incrementing \a it1 will also increment \a it2. */ @@ -84,9 +83,9 @@ class StrokeVertexIterator : public Interface0DIteratorNested { } /*! operator= - * \attention In the scripting language, you must call \code it2 = StrokeVertexIterator(it1) \endcode instead of - * \code it2 = it1 \endcode where \a it1 and \a it2 are 2 StrokeVertexIterator. - * Otherwise, incrementing \a it1 will also increment \a it2. + * \attention In the scripting language, you must call \code it2 = StrokeVertexIterator(it1) + * \endcode instead of \code it2 = it1 \endcode where \a it1 and \a it2 are 2 + * StrokeVertexIterator. Otherwise, incrementing \a it1 will also increment \a it2. */ StrokeVertexIterator &operator=(const StrokeVertexIterator &vi) { diff --git a/source/blender/freestyle/intern/stroke/StrokeRenderer.h b/source/blender/freestyle/intern/stroke/StrokeRenderer.h index 03e6893b578..79767b48d83 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRenderer.h +++ b/source/blender/freestyle/intern/stroke/StrokeRenderer.h @@ -116,7 +116,8 @@ class TextureManager { /* */ /**********************************/ -/*! Class to render a stroke. Creates a triangle strip and stores it strip is lazily created at the first rendering */ +/*! Class to render a stroke. Creates a triangle strip and stores it strip is lazily created at the + * first rendering */ class StrokeRenderer { public: StrokeRenderer(); @@ -130,7 +131,7 @@ class StrokeRenderer { // lazy, checks if it has already been done static bool loadTextures(); - //static unsigned int getTextureIndex(unsigned int index); + // static unsigned int getTextureIndex(unsigned int index); static TextureManager *_textureManager; #ifdef WITH_CXX_GUARDEDALLOC diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.cpp b/source/blender/freestyle/intern/stroke/StrokeRep.cpp index f1483e80083..a6c00f66056 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRep.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeRep.cpp @@ -113,7 +113,7 @@ static real crossP(const Vec2r &A, const Vec2r &B) void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices) { - //computeParameterization(); + // computeParameterization(); if (iStrokeVertices.size() < 2) { if (G.debug & G_DEBUG_FREESTYLE) { cout << "Warning: strip has less than 2 vertices" << endl; @@ -134,11 +134,11 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices) StrokeVertex *sv, *sv2, *svPrev; int orientationErrors = 0; - //special case of first vertex + // special case of first vertex v2 = v = iStrokeVertices.begin(); ++v2; sv = *v; - vPrev = v; //in case the stroke has only 2 vertices; + vPrev = v; // in case the stroke has only 2 vertices; sv2 = *v2; Vec2r dir(sv2->getPoint() - sv->getPoint()); Vec2r orthDir(-dir[1], dir[0]); @@ -195,7 +195,7 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices) svPrev = (*vPrev); Vec2r p(sv->getPoint()), p2(sv2->getPoint()), pPrev(svPrev->getPoint()); - //direction and orthogonal vector to the next segment + // direction and orthogonal vector to the next segment Vec2r dir(p2 - p); float dirNorm = dir.norm(); dir.normalize(); @@ -215,7 +215,7 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices) } } - //direction and orthogonal vector to the previous segment + // direction and orthogonal vector to the previous segment Vec2r dirPrev(p - pPrev); float dirPrevNorm = dirPrev.norm(); dirPrev.normalize(); @@ -287,7 +287,7 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices) } } // end of for - //special case of last vertex + // special case of last vertex sv = *v; sv2 = *vPrev; dir = Vec2r(sv->getPoint() - sv2->getPoint()); @@ -342,7 +342,7 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices) #endif _averageThickness /= float(iStrokeVertices.size() - 2); - //I did not use the first and last vertex for the average + // I did not use the first and last vertex for the average if (iStrokeVertices.size() < 3) _averageThickness = 0.5 * (thicknessLast[1] + thicknessLast[0] + thickness[0] + thickness[1]); @@ -379,7 +379,7 @@ void Strip::cleanUpSingularities(const vector<StrokeVertex *> &iStrokeVertices) } } - //return; + // return; if (iStrokeVertices.size() < 2) return; int i = 0, j; @@ -389,7 +389,7 @@ void Strip::cleanUpSingularities(const vector<StrokeVertex *> &iStrokeVertices) bool singu1 = false, singu2 = false; int timeSinceSingu1 = 0, timeSinceSingu2 = 0; - //special case of first vertex + // special case of first vertex v = iStrokeVertices.begin(); for (vend = iStrokeVertices.end(); v != vend; v++) { v2 = v; @@ -416,7 +416,7 @@ void Strip::cleanUpSingularities(const vector<StrokeVertex *> &iStrokeVertices) int toto = i - timeSinceSingu1; if (toto < 0) cerr << "Stephane dit \"Toto\"" << endl; - //traverse all the vertices of the singularity and average them + // traverse all the vertices of the singularity and average them Vec2r avP(0.0, 0.0); for (j = i - timeSinceSingu1; j <= i; j++) avP = Vec2r(avP + _vertices[2 * j]->point2d()); @@ -437,7 +437,7 @@ void Strip::cleanUpSingularities(const vector<StrokeVertex *> &iStrokeVertices) int toto = i - timeSinceSingu2; if (toto < 0) cerr << "Stephane dit \"Toto\"" << endl; - //traverse all the vertices of the singularity and average them + // traverse all the vertices of the singularity and average them Vec2r avP(0.0, 0.0); for (j = i - timeSinceSingu2; j <= i; j++) avP = Vec2r(avP + _vertices[2 * j + 1]->point2d()); @@ -453,7 +453,7 @@ void Strip::cleanUpSingularities(const vector<StrokeVertex *> &iStrokeVertices) } if (singu1) { - //traverse all the vertices of the singularity and average them + // traverse all the vertices of the singularity and average them Vec2r avP(0.0, 0.0); for (j = i - timeSinceSingu1; j < i; j++) avP = Vec2r(avP + _vertices[2 * j]->point2d()); @@ -462,7 +462,7 @@ void Strip::cleanUpSingularities(const vector<StrokeVertex *> &iStrokeVertices) _vertices[2 * j]->setPoint2d(avP); } if (singu2) { - //traverse all the vertices of the singularity and average them + // traverse all the vertices of the singularity and average them Vec2r avP(0.0, 0.0); for (j = i - timeSinceSingu2; j < i; j++) avP = Vec2r(avP + _vertices[2 * j + 1]->point2d()); @@ -760,7 +760,7 @@ StrokeRep::StrokeRep(Stroke *iStroke) StrokeRep::StrokeRep(const StrokeRep &iBrother) { - //soc unused - int i = 0; + // soc unused - int i = 0; _stroke = iBrother._stroke; _strokeType = iBrother._strokeType; _textureId = iBrother._textureId; diff --git a/source/blender/freestyle/intern/stroke/StrokeShader.h b/source/blender/freestyle/intern/stroke/StrokeShader.h index 3f312395559..7b1f12a8c9d 100644 --- a/source/blender/freestyle/intern/stroke/StrokeShader.h +++ b/source/blender/freestyle/intern/stroke/StrokeShader.h @@ -44,20 +44,17 @@ class Stroke; * Any Stroke Shader must inherit from this class and overload the shade() method. * A StrokeShader is designed to modify any Stroke's attribute such as Thickness, Color, * Geometry, Texture, Blending mode... - * The basic way to achieve this operation consists in iterating over the StrokeVertices of the Stroke - * and to modify each one's StrokeAttribute. - * Here is a python code example of such an iteration: - * \code - * it = ioStroke.strokeVerticesBegin() - * while not it.isEnd(): - * att = it.getObject().attribute() + * The basic way to achieve this operation consists in iterating over the StrokeVertices of the + * Stroke and to modify each one's StrokeAttribute. Here is a python code example of such an + * iteration: \code it = ioStroke.strokeVerticesBegin() while not it.isEnd(): att = + * it.getObject().attribute() * ## perform here any attribute modification * it.increment() * \endcode * Here is a C++ code example of such an iteration: * \code - * for (StrokeInternal::StrokeVertexIterator v = ioStroke.strokeVerticesBegin(), vend = ioStroke.strokeVerticesEnd(); - * v != vend; + * for (StrokeInternal::StrokeVertexIterator v = ioStroke.strokeVerticesBegin(), vend = + * ioStroke.strokeVerticesEnd(); v != vend; * ++v) * { * StrokeAttribute& att = v->attribute(); diff --git a/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp b/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp index e135f83cfef..8d2e554a67b 100644 --- a/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp @@ -72,7 +72,7 @@ NodeGroup *StrokeTesselator::Tesselate(StrokeVertexIterator begin, StrokeVertexI NodeGroup *group = new NodeGroup; NodeShape *tshape = new NodeShape; group->AddChild(tshape); - //tshape->material().setDiffuse(0.0f, 0.0f, 0.0f, 1.0f); + // tshape->material().setDiffuse(0.0f, 0.0f, 0.0f, 1.0f); tshape->setFrsMaterial(_FrsMaterial); for (StrokeVertexIterator c = begin, cend = end; c != cend; c++) { |