diff options
author | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-03-11 10:56:51 +0400 |
---|---|---|
committer | Tamito Kajiyama <rd6t-kjym@asahi-net.or.jp> | 2013-03-11 10:56:51 +0400 |
commit | 2d801f2bec3c4de663f33b0f0f198a12f09ef989 (patch) | |
tree | dfe16a3ca2213bd5b6579ed3bc2ac2902b678067 /source/blender/freestyle/intern/stroke | |
parent | 4a92d82626980d6d1690113b9d27aae282fd48eb (diff) |
Another big code clean-up patch from Bastien Montagne, thanks again!
Diffstat (limited to 'source/blender/freestyle/intern/stroke')
33 files changed, 192 insertions, 176 deletions
diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp b/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp index 9d955722ac7..25b5bdb26dc 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp @@ -43,11 +43,12 @@ namespace Functions0D { int DensityF0D::operator()(Interface0DIterator& iter) { - Canvas* canvas = Canvas::getInstance(); + Canvas *canvas = Canvas::getInstance(); int bound = _filter.getBound(); - if ((iter->getProjectedX()-bound < 0) || (iter->getProjectedX()+bound>canvas->width()) || - (iter->getProjectedY()-bound < 0) || (iter->getProjectedY()+bound>canvas->height())) { + if ((iter->getProjectedX() - bound < 0) || (iter->getProjectedX() + bound>canvas->width()) || + (iter->getProjectedY() - bound < 0) || (iter->getProjectedY() + bound>canvas->height())) + { result = 0.0; return 0; } @@ -63,17 +64,18 @@ int DensityF0D::operator()(Interface0DIterator& iter) int LocalAverageDepthF0D::operator()(Interface0DIterator& iter) { - Canvas * iViewer = Canvas::getInstance(); + Canvas *iViewer = Canvas::getInstance(); int bound = _filter.getBound(); - if ((iter->getProjectedX()-bound < 0) || (iter->getProjectedX()+bound>iViewer->width()) || - (iter->getProjectedY()-bound < 0) || (iter->getProjectedY()+bound>iViewer->height())) { + if ((iter->getProjectedX() - bound < 0) || (iter->getProjectedX() + bound>iViewer->width()) || + (iter->getProjectedY() - bound < 0) || (iter->getProjectedY() + bound>iViewer->height())) + { result = 0.0; return 0; } GrayImage image; - iViewer->readDepthPixels((int)iter->getProjectedX() - bound, (int)iter->getProjectedY()-bound, + iViewer->readDepthPixels((int)iter->getProjectedX() - bound, (int)iter->getProjectedY() - bound, _filter.maskSize(), _filter.maskSize(), image); result = _filter.getSmoothedPixel(&image, (int)iter->getProjectedX(), (int)iter->getProjectedY()); @@ -82,7 +84,7 @@ int LocalAverageDepthF0D::operator()(Interface0DIterator& iter) int ReadMapPixelF0D::operator()(Interface0DIterator& iter) { - Canvas * canvas = Canvas::getInstance(); + Canvas *canvas = Canvas::getInstance(); result = canvas->readMapPixel(_mapName, _level, (int)iter->getProjectedX(), (int)iter->getProjectedY()); return 0; } @@ -98,7 +100,7 @@ int ReadSteerableViewMapPixelF0D::operator()(Interface0DIterator& iter) int ReadCompleteViewMapPixelF0D::operator()(Interface0DIterator& iter) { SteerableViewMap *svm = Canvas::getInstance()->getSteerableViewMap(); - result = svm->readCompleteViewMapPixel(_level,(int)iter->getProjectedX(), (int)iter->getProjectedY()); + result = svm->readCompleteViewMapPixel(_level, (int)iter->getProjectedX(), (int)iter->getProjectedY()); return 0; } @@ -106,10 +108,10 @@ int GetViewMapGradientNormF0D::operator()(Interface0DIterator& iter) { SteerableViewMap *svm = Canvas::getInstance()->getSteerableViewMap(); float pxy = svm->readCompleteViewMapPixel(_level, (int)iter->getProjectedX(), (int)iter->getProjectedY()); - float gx = svm->readCompleteViewMapPixel(_level, (int)iter->getProjectedX() + _step, (int)iter->getProjectedY()) - - pxy; - float gy = svm->readCompleteViewMapPixel(_level, (int)iter->getProjectedX(), (int)iter->getProjectedY() + _step) - - pxy; + float gx = svm->readCompleteViewMapPixel(_level, (int)iter->getProjectedX() + _step, + (int)iter->getProjectedY()) - pxy; + float gy = svm->readCompleteViewMapPixel(_level, (int)iter->getProjectedX(), + (int)iter->getProjectedY() + _step) - pxy; result = Vec2f(gx, gy).norm(); return 0; } diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp index 2df4d19195e..e07afb2566e 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp @@ -43,7 +43,7 @@ namespace Functions1D { int GetSteerableViewMapDensityF1D::operator()(Interface1D& inter) { - SteerableViewMap * svm = Canvas::getInstance()->getSteerableViewMap(); + SteerableViewMap *svm = Canvas::getInstance()->getSteerableViewMap(); Interface0DIterator it = inter.pointsBegin(_sampling); Interface0DIterator itnext = it; ++itnext; @@ -56,8 +56,8 @@ int GetSteerableViewMapDensityF1D::operator()(Interface1D& inter) Interface0D& i0Dnext = (*itnext); fe = i0D.getFEdge(i0Dnext); if (fe == 0) { - cerr << "GetSteerableViewMapDensityF1D warning: no FEdge between " << i0D.getId() << " and " - << i0Dnext.getId() << endl; + cerr << "GetSteerableViewMapDensityF1D warning: no FEdge between " << i0D.getId() << " and " << + i0Dnext.getId() << endl; // compute the direction between these two ??? Vec2f dir = i0Dnext.getPoint2D() - i0D.getPoint2D(); nSVM = svm->getSVMNumber(dir); diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h index 35f516cd781..8373450d440 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h @@ -64,8 +64,9 @@ public: * \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) @@ -187,8 +188,9 @@ public: * \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, IntegrationType iType = MEAN, float sampling = 2.0f) @@ -228,10 +230,11 @@ public: * \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) + GetSteerableViewMapDensityF1D(int level, IntegrationType iType = MEAN, float sampling = 2.0f) : UnaryFunction1D<real>(iType) { _level = level; @@ -269,10 +272,11 @@ public: * \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) + GetViewMapGradientNormF1D(int level, IntegrationType iType = MEAN, float sampling = 2.0f) : UnaryFunction1D<real>(iType), _func(level) { _level = level; diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp index a083c6b2f1b..7aa66841859 100644 --- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp +++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp @@ -79,7 +79,7 @@ static void convert(ImBuf *imBuf, float **oArray, unsigned &oSize) char *pix; for (unsigned int i = 0; i < oSize; ++i) { - pix = (char*) imBuf->rect + i * 4; + pix = (char *) imBuf->rect + i * 4; (*oArray)[i] = ((float) pix[2]) / 255.0f; } } @@ -146,7 +146,7 @@ int IncreasingThicknessShader::shade(Stroke& stroke) const int ConstrainedIncreasingThicknessShader::shade(Stroke& stroke) const { float slength = stroke.getLength2D(); - float maxT = min(_ratio*slength,_ThicknessMax); + float maxT = min(_ratio * slength, _ThicknessMax); int n = stroke.strokeVerticesSize() - 1, i; StrokeInternal::StrokeVertexIterator v, vend; for (i = 0, v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); @@ -233,7 +233,7 @@ int ThicknessVariationPatternShader::shade(Stroke& stroke) const int vert_size = stroke.strokeVerticesSize(); int sig = 0; unsigned index; - const float* originalThickness; + const float *originalThickness; for (v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v) { originalThickness = v->attribute().getThickness(); if (_stretch) { @@ -248,13 +248,13 @@ int ThicknessVariationPatternShader::shade(Stroke& stroke) const index %= _size; float thicknessR = array[index] * originalThickness[0]; float thicknessL = array[index] * originalThickness[1]; - if (thicknessR+thicknessL < _minThickness) { - thicknessL = _minThickness/2.0f; - thicknessR = _minThickness/2.0f; + if (thicknessR + thicknessL < _minThickness) { + thicknessL = _minThickness / 2.0f; + thicknessR = _minThickness / 2.0f; } - if (thicknessR+thicknessL > _maxThickness) { - thicknessL = _maxThickness/2.0f; - thicknessR = _maxThickness/2.0f; + if (thicknessR + thicknessL > _maxThickness) { + thicknessL = _maxThickness / 2.0f; + thicknessR = _maxThickness / 2.0f; } if ((sig == 0) || (sig == vert_size - 1)) v->attribute().setThickness(1, 1); @@ -564,9 +564,9 @@ int BackboneStretcherShader::shade(Stroke& stroke) const Vec2d first((v0)->x(), (v0)->y()); Vec2d last((vn)->x(), (vn)->y()); - Vec2d d1(first-Vec2d((v1)->x(), (v1)->y())); + Vec2d d1(first - Vec2d((v1)->x(), (v1)->y())); d1.normalize(); - Vec2d dn(last-Vec2d((vn_1)->x(), (vn_1)->y())); + Vec2d dn(last - Vec2d((vn_1)->x(), (vn_1)->y())); dn.normalize(); Vec2d newFirst(first + _amount * d1); @@ -590,7 +590,7 @@ int ExternalContourStretcherShader::shade(Stroke& stroke) const //float l = stroke.getLength2D(); Interface0DIterator it; Functions0D::Normal2DF0D fun; - StrokeVertex* sv; + StrokeVertex *sv; for (it = stroke.verticesBegin(); !it.isEnd(); ++it) { if (fun(it) < 0) return -1; @@ -900,7 +900,7 @@ int InflateShader::shade(Stroke& stroke) const if (norm_fun(stroke) < 0) return -1; Vec2f strokeN(norm_fun.result); - if (n*strokeN < 0) { + if (n * strokeN < 0) { n[0] = -n[0]; n[1] = -n[1]; } diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h index 58647861390..97667211729 100644 --- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h +++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.h @@ -875,7 +875,7 @@ public: /*! Builds the shader from the output file name */ fstreamShader(const char *iFileName) : StrokeShader() { - _stream .open(iFileName); + _stream.open(iFileName); if (!_stream.is_open()) { cerr << "couldn't open file " << iFileName << endl; } diff --git a/source/blender/freestyle/intern/stroke/Canvas.cpp b/source/blender/freestyle/intern/stroke/Canvas.cpp index 3fd2f9252d9..ddcf83b0616 100644 --- a/source/blender/freestyle/intern/stroke/Canvas.cpp +++ b/source/blender/freestyle/intern/stroke/Canvas.cpp @@ -182,7 +182,7 @@ void Canvas::Erase() void Canvas::PushBackStyleModule(StyleModule *iStyleModule) { - StrokeLayer* layer = new StrokeLayer(); + StrokeLayer *layer = new StrokeLayer(); _StyleModules.push_back(iStyleModule); _Layers.push_back(layer); } @@ -313,7 +313,7 @@ void Canvas::loadMap(const char *iFileName, const char *iMapName, unsigned int i mapsMap::iterator m = _maps.find(iMapName); if (m != _maps.end()) { // lazy check for size changes - ImagePyramid * pyramid = (*m).second; + ImagePyramid *pyramid = (*m).second; if ((pyramid->width() != width()) || (pyramid->height() != height())) { delete pyramid; } @@ -389,7 +389,7 @@ void Canvas::loadMap(const char *iFileName, const char *iMapName, unsigned int i for (y = 0; y < h; ++y) { for (x = 0; x < w; ++x) { - pix = (char*)qimg->rect + y * rowbytes + x * 4; + pix = (char *)qimg->rect + y * rowbytes + x * 4; float c = (pix[0] * 11 + pix[1] * 16 + pix[2] * 5) / 32; tmp.setPixel(x, y, c); } @@ -426,8 +426,8 @@ void Canvas::loadMap(const char *iFileName, const char *iMapName, unsigned int i 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)); - pix = (char*)qtmp->rect + y * rowbytes + x * 4; - pix[0] = pix [1] = pix[2] = 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"); diff --git a/source/blender/freestyle/intern/stroke/Canvas.h b/source/blender/freestyle/intern/stroke/Canvas.h index 9931bf3c97e..a583381599f 100644 --- a/source/blender/freestyle/intern/stroke/Canvas.h +++ b/source/blender/freestyle/intern/stroke/Canvas.h @@ -51,7 +51,7 @@ using namespace Geometry; struct ltstr { - bool operator()(const char* s1, const char* s2) const + bool operator()(const char *s1, const char *s2) const { return strcmp(s1, s2) < 0; } @@ -81,7 +81,7 @@ public: return _pInstance; } - typedef std::map<const char*, ImagePyramid*, ltstr> mapsMap; + typedef std::map<const char *, ImagePyramid *, ltstr> mapsMap; static const int NB_STEERABLE_VIEWMAP = 5; protected: @@ -131,9 +131,9 @@ public: virtual void Erase(); /* Reads a pixel area from the canvas */ - virtual void readColorPixels(int x, int y,int w, int h, RGBImage& oImage) const = 0; + virtual void readColorPixels(int x, int y, int w, int h, RGBImage& oImage) const = 0; /* Reads a depth pixel area from the canvas */ - virtual void readDepthPixels(int x, int y,int w, int h, GrayImage& oImage) const = 0; + virtual void readDepthPixels(int x, int y, int w, int h, GrayImage& oImage) const = 0; /* update the canvas (display) */ virtual void update() = 0; @@ -172,13 +172,13 @@ public: float readMapPixel(const char *iMapName, int level, int x, int y); /*! Sets the steerable viewmap */ - void loadSteerableViewMap(SteerableViewMap * iSVM) + void loadSteerableViewMap(SteerableViewMap *iSVM) { _steerableViewMap = iSVM; } /*! Returns the steerable VM */ - SteerableViewMap * getSteerableViewMap() + SteerableViewMap *getSteerableViewMap() { return _steerableViewMap; } diff --git a/source/blender/freestyle/intern/stroke/Chain.cpp b/source/blender/freestyle/intern/stroke/Chain.cpp index 59cebbd5da0..68ae8b70003 100644 --- a/source/blender/freestyle/intern/stroke/Chain.cpp +++ b/source/blender/freestyle/intern/stroke/Chain.cpp @@ -25,7 +25,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/freestyle/intern/stroke/Chain.h +/** \file blender/freestyle/intern/stroke/Chain.cpp * \ingroup freestyle * \brief Class to define a chain of viewedges. * \author Stephane Grabli diff --git a/source/blender/freestyle/intern/stroke/Chain.h b/source/blender/freestyle/intern/stroke/Chain.h index 425761d28ef..688d55f1f0c 100644 --- a/source/blender/freestyle/intern/stroke/Chain.h +++ b/source/blender/freestyle/intern/stroke/Chain.h @@ -46,7 +46,7 @@ class Chain : public Curve { protected: // tmp - Id * _splittingId; + Id *_splittingId; FEdge *_fedgeB; // the last FEdge of the ViewEdge passed to the last call for push_viewedge_back(). public: @@ -107,7 +107,7 @@ public: _splittingId = sid; } - inline Id* getSplittingId() + inline Id *getSplittingId() { return _splittingId; } diff --git a/source/blender/freestyle/intern/stroke/ChainingIterators.cpp b/source/blender/freestyle/intern/stroke/ChainingIterators.cpp index 1883e494eab..ccf944a7fcc 100644 --- a/source/blender/freestyle/intern/stroke/ChainingIterators.cpp +++ b/source/blender/freestyle/intern/stroke/ChainingIterators.cpp @@ -36,7 +36,7 @@ #include "../system/TimeStamp.h" -ViewEdge* AdjacencyIterator::operator*() +ViewEdge *AdjacencyIterator::operator*() { return (*_internalIterator).first; } @@ -49,12 +49,12 @@ bool AdjacencyIterator::isIncoming() const int AdjacencyIterator::increment() { ++_internalIterator; - while((!_internalIterator.isEnd()) && (!isValid((*_internalIterator).first))) + while ((!_internalIterator.isEnd()) && (!isValid((*_internalIterator).first))) ++_internalIterator; return 0; } -bool AdjacencyIterator::isValid(ViewEdge* edge) +bool AdjacencyIterator::isValid(ViewEdge *edge) { if (_restrictToSelection) { if (edge->getTimeStamp() != TimeStamp::instance()->getTimeStamp()) @@ -70,7 +70,7 @@ bool AdjacencyIterator::isValid(ViewEdge* edge) int ChainingIterator::increment() { _increment = true; - ViewVertex * vertex = getVertex(); + ViewVertex *vertex = getVertex(); if (!vertex) { _edge = 0; return 0; @@ -83,9 +83,9 @@ int ChainingIterator::increment() if (traverse(it) < 0) return -1; _edge = result; - if(_edge == 0) + if (_edge == 0) return 0; - if(_edge->A() == vertex) + if (_edge->A() == vertex) _orientation = true; else _orientation = false; @@ -95,7 +95,7 @@ int ChainingIterator::increment() int ChainingIterator::decrement() { _increment = false; - ViewVertex * vertex = getVertex(); + ViewVertex *vertex = getVertex(); if (!vertex) { _edge = 0; return 0; @@ -108,9 +108,9 @@ int ChainingIterator::decrement() if (traverse(it) < 0) return -1; _edge = result; - if(_edge == 0) + if (_edge == 0) return 0; - if(_edge->B() == vertex) + if (_edge->B() == vertex) _orientation = true; else _orientation = false; @@ -125,10 +125,10 @@ int ChainingIterator::decrement() int ChainSilhouetteIterator::traverse(const AdjacencyIterator& ait) { AdjacencyIterator it(ait); - ViewVertex* nextVertex = getVertex(); + ViewVertex *nextVertex = getVertex(); // we can't get a NULL nextVertex here, it was intercepted before if (nextVertex->getNature() & Nature::T_VERTEX) { - TVertex * tvertex = (TVertex*)nextVertex; + TVertex *tvertex = (TVertex *)nextVertex; ViewEdge *mate = (tvertex)->mate(getCurrentEdge()); while (!it.isEnd()) { ViewEdge *ve = *it; @@ -142,8 +142,8 @@ int ChainSilhouetteIterator::traverse(const AdjacencyIterator& ait) return 0; } if (nextVertex->getNature() & Nature::NON_T_VERTEX) { - //soc NonTVertex * nontvertex = (NonTVertex*)nextVertex; - ViewEdge * newEdge(0); + //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, SUGGESTIVE, VALLEY, RIDGE Nature::EdgeNature natures[6] = { @@ -159,7 +159,7 @@ int ChainSilhouetteIterator::traverse(const AdjacencyIterator& ait) int n = 0; while (!it.isEnd()) { ViewEdge *ve = *it; - if(ve->getNature() & natures[i]) { + if (ve->getNature() & natures[i]) { ++n; newEdge = ve; } diff --git a/source/blender/freestyle/intern/stroke/ChainingIterators.h b/source/blender/freestyle/intern/stroke/ChainingIterators.h index 66a57061ec9..522513d09ef 100644 --- a/source/blender/freestyle/intern/stroke/ChainingIterators.h +++ b/source/blender/freestyle/intern/stroke/ChainingIterators.h @@ -112,9 +112,9 @@ public: bool isIncoming() const; /*! Returns a *pointer* to the pointed ViewEdge. */ - virtual ViewEdge* operator*(); + virtual ViewEdge *operator*(); - virtual ViewEdge* operator->() + virtual ViewEdge *operator->() { return operator*(); } @@ -141,7 +141,7 @@ public: } protected: - bool isValid(ViewEdge* edge); + bool isValid(ViewEdge *edge); }; // @@ -178,14 +178,14 @@ public: * \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, ViewEdge* begin = 0, + ChainingIterator(bool iRestrictToSelection = true, bool iRestrictToUnvisited = true, ViewEdge *begin = NULL, bool orientation = true) : ViewEdgeIterator(begin, orientation) { _restrictToSelection = iRestrictToSelection; _restrictToUnvisited = iRestrictToUnvisited; _increment = true; - py_c_it = 0; + py_c_it = NULL; } /*! Copy constructor */ @@ -229,7 +229,7 @@ public: //inline bool getOrientation() const {} /*! Returns the vertex which is the next crossing */ - inline ViewVertex * getVertex() + inline ViewVertex *getVertex() { if (_increment) { if (_orientation) { @@ -283,7 +283,7 @@ public: * 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, bool orientation = true) + ChainSilhouetteIterator(bool iRestrictToSelection = true, ViewEdge *begin = NULL, bool orientation = true) : ChainingIterator(iRestrictToSelection, true, begin, orientation) { } @@ -340,7 +340,7 @@ public: * 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, ViewEdge* begin = NULL, + ChainPredicateIterator(bool iRestrictToSelection = true, bool iRestrictToUnvisited = true, ViewEdge *begin = NULL, bool orientation = true) : ChainingIterator(iRestrictToSelection, iRestrictToUnvisited, begin, orientation) { @@ -365,7 +365,7 @@ public: * If false, we'll search over the ViewEdges surrounding the ending ViewVertex of begin. */ ChainPredicateIterator(UnaryPredicate1D& upred, BinaryPredicate1D& bpred, bool iRestrictToSelection = true, - bool iRestrictToUnvisited = true, ViewEdge* begin = NULL, bool orientation = true) + bool iRestrictToUnvisited = true, ViewEdge *begin = NULL, bool orientation = true) : ChainingIterator(iRestrictToSelection, iRestrictToUnvisited, begin, orientation) { _unary_predicate = &upred; diff --git a/source/blender/freestyle/intern/stroke/ContextFunctions.cpp b/source/blender/freestyle/intern/stroke/ContextFunctions.cpp index 7723c57921d..5dfa212ee83 100644 --- a/source/blender/freestyle/intern/stroke/ContextFunctions.cpp +++ b/source/blender/freestyle/intern/stroke/ContextFunctions.cpp @@ -58,7 +58,7 @@ unsigned GetCanvasHeightCF() void LoadMapCF(const char *iFileName, const char *iMapName, unsigned iNbLevels, float iSigma) { - return Canvas::getInstance()->loadMap(iFileName, iMapName, iNbLevels,iSigma); + return Canvas::getInstance()->loadMap(iFileName, iMapName, iNbLevels, iSigma); } float ReadMapPixelCF(const char *iMapName, int level, unsigned x, unsigned y) @@ -79,7 +79,7 @@ float ReadDirectionalViewMapPixelCF(int iOrientation, int level, unsigned x, uns return svm->readSteerableViewMapPixel(iOrientation, level, x, y); } -FEdge * GetSelectedFEdgeCF() +FEdge *GetSelectedFEdgeCF() { return Canvas::getInstance()->selectedFEdge(); } diff --git a/source/blender/freestyle/intern/stroke/Curve.cpp b/source/blender/freestyle/intern/stroke/Curve.cpp index 30d651421a4..0a95771d201 100644 --- a/source/blender/freestyle/intern/stroke/Curve.cpp +++ b/source/blender/freestyle/intern/stroke/Curve.cpp @@ -204,7 +204,7 @@ FEdge *CurvePoint::fedge() FEdge *CurvePoint::getFEdge(Interface0D& inter) { - CurvePoint* iVertexB = dynamic_cast<CurvePoint*>(&inter); + CurvePoint *iVertexB = dynamic_cast<CurvePoint*>(&inter); if (!iVertexB) { cerr << "Warning: CurvePoint::getFEdge() failed to cast the given 0D element to CurvePoint." << endl; return 0; @@ -261,7 +261,8 @@ FEdge *CurvePoint::getFEdge(Interface0D& inter) printf("iVertexB->B() 0x%p p (%f, %f)\n", iVertexB->B(), iVertexB->B()->getPoint2D().x(), iVertexB->B()->getPoint2D().y()); printf("_t2d %f p (%f, %f)\n", _t2d, getPoint2D().x(), getPoint2D().y()); - printf("iVertexB->t2d() %f p (%f, %f)\n", iVertexB->t2d(), iVertexB->getPoint2D().x(), iVertexB->getPoint2D().y()); + printf("iVertexB->t2d() %f p (%f, %f)\n", iVertexB->t2d(), iVertexB->getPoint2D().x(), + iVertexB->getPoint2D().y()); } #endif cerr << "Warning: CurvePoint::getFEdge() failed." << endl; diff --git a/source/blender/freestyle/intern/stroke/Curve.h b/source/blender/freestyle/intern/stroke/Curve.h index f451d83d65b..c8dbf368323 100644 --- a/source/blender/freestyle/intern/stroke/Curve.h +++ b/source/blender/freestyle/intern/stroke/Curve.h @@ -124,7 +124,7 @@ public: // Implementation of Interface0D return Vec2f((float)_Point2d.x(), (float)_Point2d.y()); } - virtual FEdge* getFEdge(Interface0D& inter); + virtual FEdge *getFEdge(Interface0D& inter); /*! Returns the CurvePoint's Id */ virtual Id getId() const @@ -149,7 +149,7 @@ public: // Implementation of Interface0D } /*! Cast the Interface0D in SVertex if it can be. */ - virtual SVertex * castToSVertex() + virtual SVertex *castToSVertex() { if (_t2d == 0) return __A; @@ -159,7 +159,7 @@ public: // Implementation of Interface0D } /*! Cast the Interface0D in ViewVertex if it can be. */ - virtual ViewVertex * castToViewVertex() + virtual ViewVertex *castToViewVertex() { if (_t2d == 0) return __A->castToViewVertex(); @@ -169,7 +169,7 @@ public: // Implementation of Interface0D } /*! Cast the Interface0D in NonTVertex if it can be. */ - virtual NonTVertex * castToNonTVertex() + virtual NonTVertex *castToNonTVertex() { if (_t2d == 0) return __A->castToNonTVertex(); @@ -179,7 +179,7 @@ public: // Implementation of Interface0D } /*! Cast the Interface0D in TVertex if it can be. */ - virtual TVertex * castToTVertex() + virtual TVertex *castToTVertex() { if (_t2d == 0) return __A->castToTVertex(); diff --git a/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h b/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h index 0c053bf1845..b87af512220 100644 --- a/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h +++ b/source/blender/freestyle/intern/stroke/CurveAdvancedIterators.h @@ -86,7 +86,7 @@ public: typedef CurvePoint<Vertex> Point; typedef Point point_type; #endif - typedef IteratorBase<Traits,BidirectionalIteratorTag_Traits> parent_class; + typedef IteratorBase<Traits, BidirectionalIteratorTag_Traits> parent_class; #if 0 #if defined(__GNUC__) && (__GNUC__ < 3) typedef bidirectional_iterator<CurvePoint<Vertex>, ptrdiff_t> bidirectional_point_iterator; @@ -294,7 +294,7 @@ protected: if (0 == _step) { // means we iterate over initial vertices Vec3r vec_tmp((*__B)->point2d() - (*__A)->point2d()); _CurvilinearLength += vec_tmp.norm(); - if (_currentn == _n-1) { + if (_currentn == _n - 1) { _t = 1.0f; return; } diff --git a/source/blender/freestyle/intern/stroke/CurveIterators.h b/source/blender/freestyle/intern/stroke/CurveIterators.h index 7d9e0e00ef1..e3c63aefd5b 100644 --- a/source/blender/freestyle/intern/stroke/CurveIterators.h +++ b/source/blender/freestyle/intern/stroke/CurveIterators.h @@ -41,9 +41,9 @@ namespace CurveInternal { /*! iterator on a curve. Allows an iterating outside -* initial vertices. A CurvePoint is instanciated an returned -* when the iterator is dereferenced. -*/ + * initial vertices. A CurvePoint is instanciated an returned + * when the iterator is dereferenced. + */ class CurvePointIterator : public Interface0DIteratorNested { @@ -128,7 +128,7 @@ protected: } public: - virtual CurvePointIterator* copy() const + virtual CurvePointIterator *copy() const { return new CurvePointIterator(*this); } @@ -160,7 +160,7 @@ public: // comparibility virtual bool operator==(const Interface0DIteratorNested& b) const { - const CurvePointIterator* it_exact = dynamic_cast<const CurvePointIterator*>(&b); + const CurvePointIterator *it_exact = dynamic_cast<const CurvePointIterator*>(&b); if (!it_exact) return false; return ((__A == it_exact->__A) && (__B == it_exact->__B) && (_t == it_exact->_t)); @@ -172,7 +172,7 @@ public: return (_Point = CurvePoint(*__A, *__B, _t)); } - virtual CurvePoint* operator->() + virtual CurvePoint *operator->() { return &(operator*()); } diff --git a/source/blender/freestyle/intern/stroke/Module.h b/source/blender/freestyle/intern/stroke/Module.h index da6708e6ea9..99cb5a08ded 100644 --- a/source/blender/freestyle/intern/stroke/Module.h +++ b/source/blender/freestyle/intern/stroke/Module.h @@ -72,7 +72,7 @@ public: } private: - static StyleModule* getCurrentStyleModule() + static StyleModule *getCurrentStyleModule() { Canvas *canvas = Canvas::getInstance(); return canvas->getCurrentStyleModule(); diff --git a/source/blender/freestyle/intern/stroke/Operators.cpp b/source/blender/freestyle/intern/stroke/Operators.cpp index e35a811fcab..df2c3dad175 100644 --- a/source/blender/freestyle/intern/stroke/Operators.cpp +++ b/source/blender/freestyle/intern/stroke/Operators.cpp @@ -515,7 +515,7 @@ int Operators::sequentialSplit(UnaryPredicate0D& pred, float sampling) point = dynamic_cast<CurvePoint*>(&(*it)); new_curve->push_vertex_back(point); ++it; - for (; it!= end; ++it) { + for (; it != end; ++it) { point = dynamic_cast<CurvePoint*>(&(*it)); new_curve->push_vertex_back(point); if (pred(it) < 0) { @@ -623,14 +623,14 @@ int Operators::sequentialSplit(UnaryPredicate0D& startingPred, UnaryPredicate0D& splitted_chains.push_back(new_curve); } // find next start - do{ + do { ++itStart; if (itStart == end) break; if (startingPred(itStart) < 0) goto error; } while (!startingPred.result); - } while ((itStart!=end) && (itStart!=last)); + } while ((itStart != end) && (itStart != last)); } // Update the current set of chains: diff --git a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp index 0b527f9f2af..ddb58e2b54a 100644 --- a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.cpp @@ -46,8 +46,8 @@ PSStrokeRenderer::PSStrokeRenderer(const char *iFileName) : StrokeRenderer() } _ofstream << "%!PS-Adobe-2.0 EPSF-2.0" << endl; _ofstream << "%%Creator: Freestyle (http://artis.imag.fr/Software/Freestyle)" << endl; - _ofstream << "%%BoundingBox: " << 0 << " "<< 0 << " " << Canvas::getInstance()->width() << " " - << Canvas::getInstance()->height() << endl; + _ofstream << "%%BoundingBox: " << 0 << " "<< 0 << " " << Canvas::getInstance()->width() << " " << + Canvas::getInstance()->height() << endl; _ofstream << "%%EndComments" << endl; } diff --git a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.h b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.h index e01ec531471..fad15ece6d8 100644 --- a/source/blender/freestyle/intern/stroke/PSStrokeRenderer.h +++ b/source/blender/freestyle/intern/stroke/PSStrokeRenderer.h @@ -52,7 +52,7 @@ class LIB_STROKE_EXPORT PSStrokeRenderer : public StrokeRenderer { public: - PSStrokeRenderer(const char * iFileName = 0); + PSStrokeRenderer(const char *iFileName = NULL); virtual ~PSStrokeRenderer(); /*! Renders a stroke rep */ diff --git a/source/blender/freestyle/intern/stroke/Predicates1D.h b/source/blender/freestyle/intern/stroke/Predicates1D.h index 18e4328c4d5..cf19bf2c03c 100644 --- a/source/blender/freestyle/intern/stroke/Predicates1D.h +++ b/source/blender/freestyle/intern/stroke/Predicates1D.h @@ -342,8 +342,7 @@ public: int operator()(Interface1D& inter) { ViewEdge *edge = dynamic_cast<ViewEdge*>(&inter); - if (!edge) - { + if (!edge) { result = false; return 0; } diff --git a/source/blender/freestyle/intern/stroke/Stroke.cpp b/source/blender/freestyle/intern/stroke/Stroke.cpp index 7e6aa62ac59..b043afba036 100644 --- a/source/blender/freestyle/intern/stroke/Stroke.cpp +++ b/source/blender/freestyle/intern/stroke/Stroke.cpp @@ -371,7 +371,7 @@ StrokeVertex::~StrokeVertex() {} StrokeVertex& StrokeVertex::operator=(const StrokeVertex& iBrother) { - ((CurvePoint*)this)->operator=(iBrother); + ((CurvePoint *)this)->operator=(iBrother); _Attribute = iBrother._Attribute; _CurvilignAbscissa = 0.0f; @@ -883,7 +883,7 @@ inline const polygon3d& occludee() const } #endif -const SShape * Stroke::occluded_shape() const +const SShape *Stroke::occluded_shape() const { const_vertex_iterator v = vertices_begin(), vend = vertices_end(); const SShape *sshape = (*v)->occluded_shape(); @@ -905,7 +905,7 @@ const bool Stroke::occludee_empty() const return empty; } -const SShape * Stroke::shape() const +const SShape *Stroke::shape() const { const_vertex_iterator v = vertices_begin(), vend = vertices_end(); const SShape *sshape = (*v)->shape(); diff --git a/source/blender/freestyle/intern/stroke/Stroke.h b/source/blender/freestyle/intern/stroke/Stroke.h index 51733a058a9..a2ff7e4dc07 100644 --- a/source/blender/freestyle/intern/stroke/Stroke.h +++ b/source/blender/freestyle/intern/stroke/Stroke.h @@ -292,9 +292,9 @@ public: void setAttributeVec3f(const char *iName, const Vec3f& att); private: - typedef std::map<const char*, float, StringUtils::ltstr> realMap; - typedef std::map<const char*, Vec2f, StringUtils::ltstr> Vec2fMap; - typedef std::map<const char*, Vec3f, StringUtils::ltstr> Vec3fMap; + typedef std::map<const char *, float, StringUtils::ltstr> realMap; + typedef std::map<const char *, Vec2f, StringUtils::ltstr> Vec2fMap; + typedef std::map<const char *, Vec3f, StringUtils::ltstr> Vec3fMap; float _color[3]; //! the color float _alpha; //! alpha diff --git a/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h b/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h index adaa5548bf9..3d0f13276fb 100644 --- a/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h +++ b/source/blender/freestyle/intern/stroke/StrokeAdvancedIterators.h @@ -56,13 +56,13 @@ public: template<class Traits> -class vertex_iterator_base : public IteratorBase<Traits,BidirectionalIteratorTag_Traits> +class vertex_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTag_Traits> { public: typedef vertex_iterator_base<Traits> Self; protected: - typedef IteratorBase<Traits,BidirectionalIteratorTag_Traits> parent_class; + typedef IteratorBase<Traits, BidirectionalIteratorTag_Traits> parent_class; typedef typename Traits::vertex_container_iterator vertex_container_iterator; typedef vertex_iterator_base<vertex_nonconst_traits> iterator; typedef vertex_iterator_base<vertex_const_traits> const_iterator; diff --git a/source/blender/freestyle/intern/stroke/StrokeIO.cpp b/source/blender/freestyle/intern/stroke/StrokeIO.cpp index a101ec67618..182ae258480 100644 --- a/source/blender/freestyle/intern/stroke/StrokeIO.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeIO.cpp @@ -39,10 +39,11 @@ ostream& operator<<(ostream& out, const StrokeAttribute& iStrokeAttribute) { out << " StrokeAttribute" << endl; - out << " color : (" << iStrokeAttribute.getColorR() << "," << iStrokeAttribute.getColorG() - << "," << iStrokeAttribute.getColorB() << ")" << endl; + out << " color : (" << iStrokeAttribute.getColorR() << "," << iStrokeAttribute.getColorG() << + "," << iStrokeAttribute.getColorB() << ")" << endl; out << " alpha : " << iStrokeAttribute.getAlpha() << endl; - out << " thickness : " << iStrokeAttribute.getThicknessR() << ", " << iStrokeAttribute.getThicknessL() << endl; + out << " thickness : " << iStrokeAttribute.getThicknessR() << ", " << iStrokeAttribute.getThicknessL() << + endl; out << " visible : " << iStrokeAttribute.isVisible() << endl; return out; } @@ -52,10 +53,10 @@ ostream& operator<<(ostream& out, const StrokeVertex& iStrokeVertex) out << " StrokeVertex" << endl; out << " id : " << iStrokeVertex.getId() << endl; out << " curvilinear length : " << iStrokeVertex.curvilinearAbscissa() << endl; - out << " 2d coordinates : (" << iStrokeVertex.getProjectedX() << "," << iStrokeVertex.getProjectedY() - << "," << iStrokeVertex.getProjectedZ() << ")" << endl; - out << " 3d coordinates : (" << iStrokeVertex.getX() << "," << iStrokeVertex.getY() - << "," << iStrokeVertex.getZ() << ")" << endl; + out << " 2d coordinates : (" << iStrokeVertex.getProjectedX() << "," << iStrokeVertex.getProjectedY() << + "," << iStrokeVertex.getProjectedZ() << ")" << endl; + out << " 3d coordinates : (" << iStrokeVertex.getX() << "," << iStrokeVertex.getY() << + "," << iStrokeVertex.getZ() << ")" << endl; out << iStrokeVertex.attribute() << endl; return out; } @@ -66,7 +67,10 @@ ostream& operator<<(ostream& out, const Stroke& iStroke) out << " id : " << iStroke.getId() << endl; out << " length : " << iStroke.getLength2D() << endl; out << " medium type : " << iStroke.getMediumType() << endl; - for(Stroke::const_vertex_iterator v = iStroke.vertices_begin(), vend = iStroke.vertices_end(); v != vend; ++v) { + for (Stroke::const_vertex_iterator v = iStroke.vertices_begin(), vend = iStroke.vertices_end(); + v != vend; + ++v) + { out << *(*v) << endl; } return out; diff --git a/source/blender/freestyle/intern/stroke/StrokeIterators.h b/source/blender/freestyle/intern/stroke/StrokeIterators.h index 37f6a8843bd..9cb8f517684 100644 --- a/source/blender/freestyle/intern/stroke/StrokeIterators.h +++ b/source/blender/freestyle/intern/stroke/StrokeIterators.h @@ -121,7 +121,7 @@ public: /*! Returns a pointer to the pointed StrokeVertex. * Can't be called in the scripting language. */ - virtual StrokeVertex* operator->() + virtual StrokeVertex *operator->() { return &(operator*()); } @@ -185,7 +185,7 @@ public: /*! operator == */ virtual bool operator==(const Interface0DIteratorNested& it) const { - const StrokeVertexIterator* it_exact = dynamic_cast<const StrokeVertexIterator*>(&it); + const StrokeVertexIterator *it_exact = dynamic_cast<const StrokeVertexIterator *>(&it); if (!it_exact) return false; return (_it == it_exact->_it); @@ -204,7 +204,7 @@ public: } /*! Cloning method */ - virtual StrokeVertexIterator* copy() const + virtual StrokeVertexIterator *copy() const { return new StrokeVertexIterator(*this); } diff --git a/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp b/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp index 56c5f2b5001..604cf6bd93d 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp @@ -70,7 +70,7 @@ bool StrokeRenderer::loadTextures() LIB_STROKE_EXPORT -TextureManager* TextureManager::_pInstance = 0; +TextureManager *TextureManager::_pInstance = 0; LIB_STROKE_EXPORT string TextureManager::_patterns_path; @@ -102,7 +102,7 @@ void TextureManager::load() unsigned TextureManager::getBrushTextureIndex(string name, Stroke::MediumType loadingMode) { - BrushTexture bt(name,loadingMode); + BrushTexture bt(name, loadingMode); brushesMap::iterator b = _brushesMap.find(bt); if (b == _brushesMap.end()) { unsigned texId = loadBrush(name, loadingMode); diff --git a/source/blender/freestyle/intern/stroke/StrokeRenderer.h b/source/blender/freestyle/intern/stroke/StrokeRenderer.h index ab451a14496..db169fb3fa2 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRenderer.h +++ b/source/blender/freestyle/intern/stroke/StrokeRenderer.h @@ -92,7 +92,7 @@ protected: virtual void loadStandardBrushes() = 0; virtual unsigned loadBrush(string fileName, Stroke::MediumType = Stroke::OPAQUE_MEDIUM) = 0; - typedef std::pair<string,Stroke::MediumType> BrushTexture; + typedef std::pair<string, Stroke::MediumType> BrushTexture; struct cmpBrushTexture { bool operator()(const BrushTexture& bt1, const BrushTexture& bt2) const diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.cpp b/source/blender/freestyle/intern/stroke/StrokeRep.cpp index bc117925a4c..10c3c2efe18 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRep.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeRep.cpp @@ -124,7 +124,7 @@ void Strip::createStrip (const vector<StrokeVertex*>& iStrokeVertices) } _averageThickness = 0.0; - vector<StrokeVertex*>::const_iterator v ,vend, v2, vPrev; + vector<StrokeVertex *>::const_iterator v, vend, v2, vPrev; StrokeVertex *sv, *sv2, *svPrev; //special case of first vertex @@ -350,7 +350,7 @@ void Strip::cleanUpSingularities (const vector<StrokeVertex*>& iStrokeVertices) if (iStrokeVertices.size() < 2) return; int i = 0, j; - vector<StrokeVertex*>::const_iterator v ,vend, v2, vPrev; + vector<StrokeVertex *>::const_iterator v, vend, v2, vPrev; StrokeVertex *sv, *sv2; //soc unused - *svPrev; bool singu1 = false, singu2 = false; @@ -367,7 +367,7 @@ void Strip::cleanUpSingularities (const vector<StrokeVertex*>& iStrokeVertices) sv2 = (*v2); Vec2r p(sv->getPoint()), p2(sv2->getPoint()); - Vec2r dir(p2-p); + Vec2r dir(p2 - p); if (dir.norm() > ZERO) dir.normalize(); Vec2r dir1, dir2; @@ -386,7 +386,7 @@ void Strip::cleanUpSingularities (const vector<StrokeVertex*>& iStrokeVertices) //traverse all the vertices of the singularity and average them Vec2r avP(0.0, 0.0); for (j = i - timeSinceSingu1; j < i + 1; j++) - avP=Vec2r(avP + _vertices[2 * j]->point2d()); + avP = Vec2r(avP + _vertices[2 * j]->point2d()); avP = Vec2r( 1.0 / float(timeSinceSingu1 + 1) * avP); for (j = i - timeSinceSingu1; j < i + 1; j++) _vertices[2 * j]->setPoint2d(avP); @@ -438,7 +438,7 @@ void Strip::cleanUpSingularities (const vector<StrokeVertex*>& iStrokeVertices) _vertices[2 * j + 1]->setPoint2d(avP); } - for (k=0; k<sizeStrip; k++) { + for (k = 0; k < sizeStrip; k++) { if (notValid(_vertices[k]->point2d())) { cerr << "Warning: strip vertex " << k << " non valid after cleanup" << endl; return; @@ -450,9 +450,9 @@ void Strip::cleanUpSingularities (const vector<StrokeVertex*>& iStrokeVertices) // Texture coordinates //////////////////////////////// -void Strip::computeTexCoord (const vector<StrokeVertex*>& iStrokeVertices) +void Strip::computeTexCoord (const vector<StrokeVertex *>& iStrokeVertices) { - vector<StrokeVertex*>::const_iterator v ,vend; + vector<StrokeVertex *>::const_iterator v, vend; StrokeVertex *sv; int i = 0; for (v = iStrokeVertices.begin(), vend = iStrokeVertices.end(); v != vend; v++) { diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.h b/source/blender/freestyle/intern/stroke/StrokeRep.h index c8d84cb237a..419659d1427 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRep.h +++ b/source/blender/freestyle/intern/stroke/StrokeRep.h @@ -63,7 +63,7 @@ using namespace Geometry; class StrokeVertexRep { public: - StrokeVertexRep(){} + StrokeVertexRep() {} StrokeVertexRep(const Vec2r& iPoint2d) { @@ -72,7 +72,7 @@ public: StrokeVertexRep(const StrokeVertexRep& iBrother); - virtual ~StrokeVertexRep(){} + virtual ~StrokeVertexRep() {} inline Vec2r& point2d() { @@ -197,7 +197,7 @@ public: return _strips.size(); } - inline Stroke * getStroke() + inline Stroke *getStroke() { return _stroke; } diff --git a/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp b/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp index 43cf1818fb0..b6805e4220d 100644 --- a/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp @@ -44,10 +44,10 @@ LineRep *StrokeTesselator::Tesselate(Stroke *iStroke) if (0 == iStroke) return 0; - LineRep* line; + LineRep *line; line = new OrientedLineRep(); - Stroke::vertex_iterator v,vend; + Stroke::vertex_iterator v, vend; if (2 == iStroke->vertices_size()) { line->setStyle(LineRep::LINES); v = iStroke->vertices_begin(); diff --git a/source/blender/freestyle/intern/stroke/TextStrokeRenderer.cpp b/source/blender/freestyle/intern/stroke/TextStrokeRenderer.cpp index ea5af287bbe..37583660dd2 100644 --- a/source/blender/freestyle/intern/stroke/TextStrokeRenderer.cpp +++ b/source/blender/freestyle/intern/stroke/TextStrokeRenderer.cpp @@ -23,51 +23,57 @@ # include "Canvas.h" # include "StrokeIterators.h" -TextStrokeRenderer::TextStrokeRenderer(const char* iFileName) -:StrokeRenderer(){ - if(!iFileName) - iFileName = "freestyle.txt"; - // open the stream: - _ofstream.open(iFileName, ios::out); - if(!_ofstream.is_open()){ - cerr << "couldn't open the output file " << iFileName << endl; - } - _ofstream << "%!FREESTYLE" << endl; - _ofstream << "%Creator: Freestyle (http://artis.imag.fr/Software/Freestyle)" << endl; - // Bounding box - _ofstream << 0 << " "<< 0 << " " << Canvas::getInstance()->width() << " " << Canvas::getInstance()->height() << endl; - _ofstream << "%u x y z tleft tright r g b ..." << endl; +TextStrokeRenderer::TextStrokeRenderer(const char *iFileName) +:StrokeRenderer() +{ + if (!iFileName) + iFileName = "freestyle.txt"; + // open the stream: + _ofstream.open(iFileName, ios::out); + if (!_ofstream.is_open()) { + cerr << "couldn't open the output file " << iFileName << endl; + } + _ofstream << "%!FREESTYLE" << endl; + _ofstream << "%Creator: Freestyle (http://artis.imag.fr/Software/Freestyle)" << endl; + // Bounding box + _ofstream << 0 << " "<< 0 << " " << Canvas::getInstance()->width() << " " << Canvas::getInstance()->height() << + endl; + _ofstream << "%u x y z tleft tright r g b ..." << endl; } -TextStrokeRenderer::~TextStrokeRenderer(){ - Close(); +TextStrokeRenderer::~TextStrokeRenderer() +{ + Close(); } -void TextStrokeRenderer::RenderStrokeRep(StrokeRep *iStrokeRep) const{ - RenderStrokeRepBasic(iStrokeRep); +void TextStrokeRenderer::RenderStrokeRep(StrokeRep *iStrokeRep) const +{ + RenderStrokeRepBasic(iStrokeRep); } -void TextStrokeRenderer::RenderStrokeRepBasic(StrokeRep *iStrokeRep) const{ - Stroke *stroke = iStrokeRep->getStroke(); - if(!stroke){ - cerr << "no stroke associated with Rep" << endl; - return; - } - - StrokeInternal::StrokeVertexIterator v = stroke->strokeVerticesBegin(); - StrokeAttribute att; - while(!v.isEnd()){ - att = v->attribute(); - _ofstream << v->u() << " " << v->getProjectedX() << " " << v->getProjectedY() << " " << v->getProjectedZ() << " " \ - << att.getThicknessL() << " " << att.getThicknessR() << " " \ - << att.getColorR() << " " << att.getColorG() << " " << att.getColorB() << " "; - ++v; - } - _ofstream << endl; +void TextStrokeRenderer::RenderStrokeRepBasic(StrokeRep *iStrokeRep) const +{ + Stroke *stroke = iStrokeRep->getStroke(); + if (!stroke) { + cerr << "no stroke associated with Rep" << endl; + return; + } + + StrokeInternal::StrokeVertexIterator v = stroke->strokeVerticesBegin(); + StrokeAttribute att; + while (!v.isEnd()) { + att = v->attribute(); + _ofstream << v->u() << " " << v->getProjectedX() << " " << v->getProjectedY() << " " << v->getProjectedZ() << + " " << att.getThicknessL() << " " << att.getThicknessR() << " " << + att.getColorR() << " " << att.getColorG() << " " << att.getColorB() << " "; + ++v; + } + _ofstream << endl; } -void TextStrokeRenderer::Close(){ - if(_ofstream.is_open()) - _ofstream.close(); +void TextStrokeRenderer::Close() +{ + if (_ofstream.is_open()) + _ofstream.close(); } diff --git a/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h b/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h index cc6f5c05073..144724f26f8 100644 --- a/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h +++ b/source/blender/freestyle/intern/stroke/TextStrokeRenderer.h @@ -50,7 +50,7 @@ class LIB_STROKE_EXPORT TextStrokeRenderer : public StrokeRenderer { public: - TextStrokeRenderer(const char * iFileName = 0); + TextStrokeRenderer(const char *iFileName = NULL); virtual ~TextStrokeRenderer(); /*! Renders a stroke rep */ |