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 | |
parent | 4a92d82626980d6d1690113b9d27aae282fd48eb (diff) |
Another big code clean-up patch from Bastien Montagne, thanks again!
Diffstat (limited to 'source/blender')
74 files changed, 788 insertions, 762 deletions
diff --git a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp index f373b730d0f..20c33713db4 100644 --- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp +++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.cpp @@ -231,8 +231,7 @@ IndexedFaceSet::~IndexedFaceSet() _Vertices = NULL; } - if (NULL != _Normals) - { + if (NULL != _Normals) { delete[] _Normals; _Normals = NULL; } diff --git a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h index 6ec769f4caf..c2715812eee 100644 --- a/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h +++ b/source/blender/freestyle/intern/scene_graph/IndexedFaceSet.h @@ -185,12 +185,12 @@ public: } /*! Accessors */ - virtual const real * vertices() const + virtual const real *vertices() const { return _Vertices; } - virtual const real * normals() const + virtual const real *normals() const { return _Normals; } @@ -200,7 +200,7 @@ public: return _FrsMaterials; } - virtual const real* texCoords() const + virtual const real *texCoords() const { return _TexCoords; } @@ -230,37 +230,37 @@ public: return _NumFaces; } - virtual const unsigned * numVertexPerFaces() const + virtual const unsigned *numVertexPerFaces() const { return _NumVertexPerFace; } - virtual const TRIANGLES_STYLE * trianglesStyle() const + virtual const TRIANGLES_STYLE *trianglesStyle() const { return _FaceStyle; } - virtual const unsigned char * faceEdgeMarks() const + virtual const unsigned char *faceEdgeMarks() const { return _FaceEdgeMarks; } - virtual const unsigned* vindices() const + virtual const unsigned *vindices() const { return _VIndices; } - virtual const unsigned* nindices() const + virtual const unsigned *nindices() const { return _NIndices; } - virtual const unsigned* mindices() const + virtual const unsigned *mindices() const { return _MIndices; } - virtual const unsigned* tindices() const + virtual const unsigned *tindices() const { return _TIndices; } diff --git a/source/blender/freestyle/intern/scene_graph/Node.h b/source/blender/freestyle/intern/scene_graph/Node.h index 626a0913233..03e9343f7e7 100644 --- a/source/blender/freestyle/intern/scene_graph/Node.h +++ b/source/blender/freestyle/intern/scene_graph/Node.h @@ -57,7 +57,7 @@ public: _BBox = iBrother.bbox(); } - virtual ~Node(){} + virtual ~Node() {} /*! Accept the corresponding visitor * Each inherited node must overload this method @@ -85,10 +85,10 @@ public: /*! Makes the union of _BBox and iBox */ virtual void AddBBox(const BBox<Vec3r>& iBox) { - if(iBox.empty()) + if (iBox.empty()) return; - if(_BBox.empty()) + if (_BBox.empty()) _BBox = iBox; else _BBox += iBox; diff --git a/source/blender/freestyle/intern/scene_graph/NodeGroup.h b/source/blender/freestyle/intern/scene_graph/NodeGroup.h index 1c5b106d5c6..aed9562903e 100644 --- a/source/blender/freestyle/intern/scene_graph/NodeGroup.h +++ b/source/blender/freestyle/intern/scene_graph/NodeGroup.h @@ -48,7 +48,7 @@ class LIB_SCENE_GRAPH_EXPORT NodeGroup : public Node { public: inline NodeGroup(): Node() {} - virtual ~NodeGroup(){} + virtual ~NodeGroup() {} /*! Adds a child. Makes a addRef on the iChild reference counter */ virtual void AddChild(Node *iChild); diff --git a/source/blender/freestyle/intern/scene_graph/OrientedLineRep.h b/source/blender/freestyle/intern/scene_graph/OrientedLineRep.h index 45cda3610f2..28b620f5c80 100644 --- a/source/blender/freestyle/intern/scene_graph/OrientedLineRep.h +++ b/source/blender/freestyle/intern/scene_graph/OrientedLineRep.h @@ -49,7 +49,7 @@ public: * v2 * second vertex */ - inline OrientedLineRep(const Vec3r& v1, const Vec3r& v2) : LineRep(v1,v2) {} + inline OrientedLineRep(const Vec3r& v1, const Vec3r& v2) : LineRep(v1, v2) {} /*! Builds a line rep from a vertex chain */ inline OrientedLineRep(const vector<Vec3r>& vertices) : LineRep(vertices) {} diff --git a/source/blender/freestyle/intern/scene_graph/Rep.h b/source/blender/freestyle/intern/scene_graph/Rep.h index c1b29d3fceb..055ec0674f8 100644 --- a/source/blender/freestyle/intern/scene_graph/Rep.h +++ b/source/blender/freestyle/intern/scene_graph/Rep.h @@ -70,10 +70,10 @@ public: inline void swap(Rep& ioOther) { - std::swap(_BBox,ioOther._BBox); + std::swap(_BBox, ioOther._BBox); std::swap(_Id, ioOther._Id); std::swap(_Name, ioOther._Name); - std::swap(_FrsMaterial,ioOther._FrsMaterial); + std::swap(_FrsMaterial, ioOther._FrsMaterial); } Rep& operator=(const Rep& iBrother) @@ -137,7 +137,7 @@ public: return _Name; } - inline const FrsMaterial * frs_material() const + inline const FrsMaterial *frs_material() const { return _FrsMaterial; } 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 */ diff --git a/source/blender/freestyle/intern/system/FreestyleConfig.h b/source/blender/freestyle/intern/system/FreestyleConfig.h index 9d81af1be3b..7c79caa5259 100644 --- a/source/blender/freestyle/intern/system/FreestyleConfig.h +++ b/source/blender/freestyle/intern/system/FreestyleConfig.h @@ -28,7 +28,7 @@ #ifndef __FREESTYLE_CONFIG_H__ #define __FREESTYLE_CONFIG_H__ -/** \file blender/freestyle/intern/system/Config.h +/** \file blender/freestyle/intern/system/FreestyleConfig.h * \ingroup freestyle * \brief Configuration definitions * \author Emmanuel Turquin diff --git a/source/blender/freestyle/intern/system/RenderMonitor.h b/source/blender/freestyle/intern/system/RenderMonitor.h index bd50e0c5392..6052c0abe01 100644 --- a/source/blender/freestyle/intern/system/RenderMonitor.h +++ b/source/blender/freestyle/intern/system/RenderMonitor.h @@ -28,7 +28,7 @@ #ifndef __FREESTYLE_RENDER_MONITOR_H__ #define __FREESTYLE_RENDER_MONITOR_H__ -/** \file blender/freestyle/intern/system/BaseIterator.h +/** \file blender/freestyle/intern/system/RenderMonitor.h * \ingroup freestyle * \brief Classes defining the basic "Iterator" design pattern * \author Stephane Grabli diff --git a/source/blender/freestyle/intern/view_map/BoxGrid.cpp b/source/blender/freestyle/intern/view_map/BoxGrid.cpp index c83ab44a259..2be2fe2cb5a 100644 --- a/source/blender/freestyle/intern/view_map/BoxGrid.cpp +++ b/source/blender/freestyle/intern/view_map/BoxGrid.cpp @@ -83,9 +83,9 @@ BoxGrid::Iterator::Iterator (BoxGrid& grid, Vec3r& center, real epsilon) _cell = grid.findCell(_target); #if BOX_GRID_LOGGING if (G.debug & G_DEBUG_FREESTYLE) { - cout << "Searching for occluders of edge centered at " << _target << " in cell [" - << _cell->boundary[0] << ", " << _cell->boundary[1] << ", " << _cell->boundary[2] - << ", " << _cell->boundary[3] << "] (" << _cell->faces.size() << " occluders)" << endl; + cout << "Searching for occluders of edge centered at " << _target << " in cell [" << + 1_cell->boundary[0] << ", " << _cell->boundary[1] << ", " << _cell->boundary[2] << + ", " << _cell->boundary[3] << "] (" << _cell->faces.size() << " occluders)" << endl; } #endif @@ -159,7 +159,7 @@ void BoxGrid::assignCells (OccluderSource& source, GridDensityProvider& density, height = _cellSize; // Initialize cell - Cell* b = _cells[i * _cellsY + j] = new Cell(); + Cell *b = _cells[i * _cellsY + j] = new Cell(); b->setDimensions(x, y, width, height); } } @@ -211,7 +211,7 @@ void BoxGrid::getCellCoordinates(const Vec3r& point, unsigned& x, unsigned& y) y = min(_cellsY - 1, (unsigned) floor (max((double) 0.0f, point[1] - _cellOrigin[1]) / _cellSize)); } -BoxGrid::Cell* BoxGrid::findCell(const Vec3r& point) +BoxGrid::Cell *BoxGrid::findCell(const Vec3r& point) { unsigned int x, y; getCellCoordinates(point, x, y); diff --git a/source/blender/freestyle/intern/view_map/BoxGrid.h b/source/blender/freestyle/intern/view_map/BoxGrid.h index 50ca1622e99..22f3b6fa698 100644 --- a/source/blender/freestyle/intern/view_map/BoxGrid.h +++ b/source/blender/freestyle/intern/view_map/BoxGrid.h @@ -70,7 +70,7 @@ public: // N.B. We could, of course, store face in poly's userdata member, like the old ViewMapBuilder code does. // However, code comments make it clear that userdata is deprecated, so we avoid the temptation // to save 4 or 8 bytes. - WFace* face; + WFace *face; }; private: @@ -194,21 +194,21 @@ inline void BoxGrid::Iterator::initBeforeTarget() inline void BoxGrid::Iterator::initAfterTarget() { if (_foundOccludee) { - #if BOX_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\tStarting occludee search from occludeeCandidate at depth " - << _occludeeDepth << std::endl; - } - #endif +#if BOX_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\tStarting occludee search from occludeeCandidate at depth " << + _occludeeDepth << std::endl; + } +#endif _current = _occludeeCandidate; return; } - #if BOX_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\tStarting occludee search from current position" << std::endl; - } - #endif +#if BOX_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\tStarting occludee search from current position" << std::endl; + } +#endif while (_current != _cell->faces.end() && !testOccluder(true)) { ++_current; @@ -223,23 +223,23 @@ inline bool BoxGrid::Iterator::testOccluder(bool wantOccludee) // and _current = _cell->face.end() will make the calling routine give up. return true; } - #if BOX_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\tTesting occluder " << (*_current)->poly.getVertices()[0]; - for (unsigned int i = 1; i < (*_current)->poly.getVertices().size(); ++i) { - std::cout << ", " << (*_current)->poly.getVertices()[i]; - } - std::cout << " from shape " << (*_current)->face->GetVertex(0)->shape()->GetId() << std::endl; +#if BOX_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\tTesting occluder " << (*_current)->poly.getVertices()[0]; + for (unsigned int i = 1; i < (*_current)->poly.getVertices().size(); ++i) { + std::cout << ", " << (*_current)->poly.getVertices()[i]; } - #endif + std::cout << " from shape " << (*_current)->face->GetVertex(0)->shape()->GetId() << std::endl; + } +#endif // If we have an occluder candidate and we are unambiguously after it, abort if (_foundOccludee && (*_current)->shallowest > _occludeeDepth) { - #if BOX_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\t\tAborting: shallowest > occludeeCandidate->deepest" << std::endl; - } - #endif +#if BOX_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tAborting: shallowest > occludeeCandidate->deepest" << std::endl; + } +#endif _current = _cell->faces.end(); // See note above @@ -249,21 +249,21 @@ inline bool BoxGrid::Iterator::testOccluder(bool wantOccludee) // Specific continue or stop conditions when searching for each type if (wantOccludee) { if ((*_current)->deepest < _target[2]) { - #if BOX_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\t\tSkipping: shallower than target while looking for occludee" << std::endl; - } - #endif +#if BOX_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tSkipping: shallower than target while looking for occludee" << std::endl; + } +#endif return false; } } else { if ((*_current)->shallowest > _target[2]) { - #if BOX_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\t\tStopping: deeper than target while looking for occluder" << std::endl; - } - #endif +#if BOX_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tStopping: deeper than target while looking for occluder" << std::endl; + } +#endif return true; } } @@ -274,11 +274,11 @@ inline bool BoxGrid::Iterator::testOccluder(bool wantOccludee) Vec3r bbMin, bbMax; (*_current)->poly.getBBox(bbMin, bbMax); if (_target[0] < bbMin[0] || _target[0] > bbMax[0] || _target[1] < bbMin[1] || _target[1] > bbMax[1]) { - #if BOX_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\t\tSkipping: bounding box violation" << std::endl; - } - #endif +#if BOX_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tSkipping: bounding box violation" << std::endl; + } +#endif return false; } @@ -298,22 +298,22 @@ inline void BoxGrid::Iterator::reportDepth(Vec3r origin, Vec3r u, real t) } #endif if (depth > _target[2]) { - #if BOX_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << " is deeper than target" << std::endl; - } - #endif +#if BOX_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << " is deeper than target" << std::endl; + } +#endif // If the current occluder is the best occludee so far, save it. if (! _foundOccludee || _occludeeDepth > depth) { markCurrentOccludeeCandidate(depth); } } else { - #if BOX_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << std::endl; - } - #endif +#if BOX_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << std::endl; + } +#endif } } @@ -347,22 +347,22 @@ inline bool BoxGrid::Iterator::validAfterTarget() inline void BoxGrid::Iterator::markCurrentOccludeeCandidate(real depth) { - #if BOX_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\t\tFound occludeeCandidate at depth " << depth << std::endl; - } - #endif +#if BOX_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tFound occludeeCandidate at depth " << depth << std::endl; + } +#endif _occludeeCandidate = _current; _occludeeDepth = depth; _foundOccludee = true; } -inline WFace* BoxGrid::Iterator::getWFace() const +inline WFace *BoxGrid::Iterator::getWFace() const { return (*_current)->face; } -inline Polygon3r* BoxGrid::Iterator::getCameraSpacePolygon() +inline Polygon3r *BoxGrid::Iterator::getCameraSpacePolygon() { return &((*_current)->cameraSpacePolygon); } diff --git a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp index 2c9a9def4fc..53bd76b81f2 100644 --- a/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp +++ b/source/blender/freestyle/intern/view_map/CulledOccluderSource.cpp @@ -127,8 +127,8 @@ void CulledOccluderSource::cullViewEdges(ViewMap& viewMap, bool extensiveFEdgeSe prosceniumOrigin[1] = (viewProscenium[3] - viewProscenium[2]) / 2.0; if (G.debug & G_DEBUG_FREESTYLE) { cout << "Proscenium culling:" << endl; - cout << "Proscenium: [" << viewProscenium[0] << ", " << viewProscenium[1] << ", " << viewProscenium[2] - << ", " << viewProscenium[3] << "]"<< endl; + cout << "Proscenium: [" << viewProscenium[0] << ", " << viewProscenium[1] << ", " << viewProscenium[2] << + ", " << viewProscenium[3] << "]"<< endl; cout << "Origin: [" << prosceniumOrigin[0] << ", " << prosceniumOrigin[1] << "]"<< endl; } diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp index 2ded242e9ea..e95bbe44627 100644 --- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp +++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.cpp @@ -129,7 +129,7 @@ void FEdgeXDetector::preProcessShape(WXShape *iWShape) vector<WFace*>::iterator f, fend; // view dependant stuff for (f = wfaces.begin(), fend = wfaces.end(); f != fend; ++f) { - preProcessFace((WXFace*)(*f)); + preProcessFace((WXFace *)(*f)); } if (_computeRidgesAndValleys || _computeSuggestiveContours) { @@ -257,14 +257,14 @@ void FEdgeXDetector::processSilhouetteShape(WXShape *iWShape) vector<WFace*>& wfaces = iWShape->GetFaceList(); vector<WFace*>::iterator f, fend; for (f = wfaces.begin(), fend = wfaces.end(); f != fend; ++f) { - ProcessSilhouetteFace((WXFace*)(*f)); + ProcessSilhouetteFace((WXFace *)(*f)); } // Make a pass on the edges to detect the silhouette edges that are not smooth vector<WEdge*>::iterator we, weend; vector<WEdge*> &wedges = iWShape->getEdgeList(); for (we = wedges.begin(), weend = wedges.end(); we != weend; ++we) { - ProcessSilhouetteEdge((WXEdge*)(*we)); + ProcessSilhouetteEdge((WXEdge *)(*we)); } } @@ -321,8 +321,8 @@ void FEdgeXDetector::ProcessSilhouetteEdge(WXEdge *iEdge) WXFace *fB = (WXFace *)iEdge->GetaOEdge()->GetbFace(); if ((fA->front()) ^ (fB->front())) { // fA->visible XOR fB->visible (true if one is 0 and the other is 1) - // The only edges we want to set as silhouette edges in this way are the ones with 2 different normals for 1 vertex - // for these two faces + // The only edges we want to set as silhouette edges in this way are the ones with 2 different normals + // for 1 vertex for these two faces //-------------------- // In reality we only test the normals for 1 of the 2 vertices. if (fA->GetVertexNormal(iEdge->GetaVertex()) == fB->GetVertexNormal(iEdge->GetaVertex())) @@ -403,7 +403,7 @@ void FEdgeXDetector::processRidgesAndValleysShape(WXShape *iWShape) vector<WFace*>& wfaces = iWShape->GetFaceList(); vector<WFace*>::iterator f, fend; for (f = wfaces.begin(), fend = wfaces.end(); f != fend; ++f) { - ProcessRidgeFace((WXFace*)(*f)); + ProcessRidgeFace((WXFace *)(*f)); } } @@ -412,7 +412,7 @@ void FEdgeXDetector::processRidgesAndValleysShape(WXShape *iWShape) ///////// void FEdgeXDetector::ProcessRidgeFace(WXFace *iFace) { - WXFaceLayer *flayer = new WXFaceLayer(iFace, Nature::RIDGE|Nature::VALLEY, false); + WXFaceLayer *flayer = new WXFaceLayer(iFace, Nature::RIDGE | Nature::VALLEY, false); iFace->AddSmoothLayer(flayer); unsigned int numVertices = iFace->numberOfVertices(); @@ -549,7 +549,7 @@ void FEdgeXDetector::processSuggestiveContourShape(WXShape *iWShape) vector<WFace*>& wfaces = iWShape->GetFaceList(); vector<WFace*>::iterator f, fend; for (f = wfaces.begin(), fend = wfaces.end(); f != fend; ++f) { - ProcessSuggestiveContourFace((WXFace*)(*f)); + ProcessSuggestiveContourFace((WXFace *)(*f)); } } @@ -583,13 +583,14 @@ void FEdgeXDetector::postProcessSuggestiveContourShape(WXShape *iShape) vector<WFace*>& wfaces = iShape->GetFaceList(); vector<WFace*>::iterator f, fend; for (f = wfaces.begin(), fend = wfaces.end(); f != fend; ++f) { - postProcessSuggestiveContourFace((WXFace*)(*f)); + postProcessSuggestiveContourFace((WXFace *)(*f)); } } void FEdgeXDetector::postProcessSuggestiveContourFace(WXFace *iFace) { - // Compute the derivative of the radial curvature in the radial direction, at the two extremities of the smooth edge. + // Compute the derivative of the radial curvature in the radial direction, at the two extremities + // of the smooth edge. // If the derivative is smaller than a given threshold _kr_derivative_epsilon, discard the edge. // Find the suggestive contour layer of the face (zero or one edge). @@ -613,7 +614,7 @@ void FEdgeXDetector::postProcessSuggestiveContourFace(WXFace *iFace) real kr(0), kr1(0), kr2(0), t; for (unsigned int i = 0; i < vertices_nb; ++i) { - v = (WXVertex*)(iFace->GetVertex(i)); + v = (WXVertex *)(iFace->GetVertex(i)); // v is a singular vertex, skip it. if (v->isBoundary()) { @@ -695,7 +696,7 @@ void FEdgeXDetector::processMaterialBoundaryShape(WXShape *iWShape) vector<WEdge*>::iterator we, weend; vector<WEdge*> &wedges = iWShape->getEdgeList(); for (we = wedges.begin(), weend = wedges.end(); we != weend; ++we) { - ProcessMaterialBoundaryEdge((WXEdge*)(*we)); + ProcessMaterialBoundaryEdge((WXEdge *)(*we)); } } @@ -717,7 +718,7 @@ void FEdgeXDetector::processEdgeMarksShape(WXShape *iShape) vector<WEdge*>::iterator we, weend; vector<WEdge*> &wedges = iShape->getEdgeList(); for (we = wedges.begin(), weend = wedges.end(); we != weend; ++we) { - ProcessEdgeMarks((WXEdge*)(*we)); + ProcessEdgeMarks((WXEdge *)(*we)); } } @@ -737,9 +738,9 @@ void FEdgeXDetector::buildSmoothEdges(WXShape *iShape) // Make a last pass to build smooth edges from the previous stored values: //-------------------------------------------------------------------------- vector<WFace*>& wfaces = iShape->GetFaceList(); - for (vector<WFace*>::iterator f = wfaces.begin(), fend = wfaces.end(); f != fend; ++f) { - vector<WXFaceLayer*>& faceLayers = ((WXFace*)(*f))->getSmoothLayers(); - for (vector<WXFaceLayer*>::iterator wxfl = faceLayers.begin(), wxflend = faceLayers.end(); + for (vector<WFace *>::iterator f = wfaces.begin(), fend = wfaces.end(); f != fend; ++f) { + vector<WXFaceLayer *>& faceLayers = ((WXFace *)(*f))->getSmoothLayers(); + for (vector<WXFaceLayer *>::iterator wxfl = faceLayers.begin(), wxflend = faceLayers.end(); wxfl != wxflend; ++wxfl) { @@ -749,10 +750,10 @@ void FEdgeXDetector::buildSmoothEdges(WXShape *iShape) } if (hasSmoothEdges && !_computeRidgesAndValleys && !_computeSuggestiveContours) { - vector<WVertex*>& wvertices = iShape->getVertexList(); + vector<WVertex *>& wvertices = iShape->getVertexList(); for (vector<WVertex*>::iterator wv = wvertices.begin(), wvend = wvertices.end(); wv != wvend; ++wv) { // Compute curvatures - WXVertex *wxv = dynamic_cast<WXVertex*>(*wv); + WXVertex *wxv = dynamic_cast<WXVertex *>(*wv); computeCurvatures(wxv); } _meanK1 /= (real)(_nPoints); diff --git a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h index 1b211264402..5df9423b4cf 100644 --- a/source/blender/freestyle/intern/view_map/FEdgeXDetector.h +++ b/source/blender/freestyle/intern/view_map/FEdgeXDetector.h @@ -174,7 +174,7 @@ public: { if (b != _faceSmoothness) { _faceSmoothness = b; - _changes=true; + _changes = true; } } @@ -182,7 +182,7 @@ public: { if (b != _faceMarks) { _faceMarks = b; - _changes=true; + _changes = true; } } @@ -194,7 +194,7 @@ public: { if (r != _sphereRadius) { _sphereRadius = r; - _changes=true; + _changes = true; } } diff --git a/source/blender/freestyle/intern/view_map/Functions0D.cpp b/source/blender/freestyle/intern/view_map/Functions0D.cpp index 9e8557b0fd3..527d67cee2a 100644 --- a/source/blender/freestyle/intern/view_map/Functions0D.cpp +++ b/source/blender/freestyle/intern/view_map/Functions0D.cpp @@ -302,9 +302,9 @@ int MaterialF0D::operator()(Interface0DIterator& iter) if (fe1 == NULL) return -1; if (fe1->isSmooth()) - result = ((FEdgeSmooth*)fe1)->frs_material(); + result = ((FEdgeSmooth *)fe1)->frs_material(); else - result = ((FEdgeSharp*)fe1)->bFrsMaterial(); + result = ((FEdgeSharp *)fe1)->bFrsMaterial(); #if 0 const SShape *sshape = getShapeF0D(iter); return sshape->material(); diff --git a/source/blender/freestyle/intern/view_map/Functions1D.cpp b/source/blender/freestyle/intern/view_map/Functions1D.cpp index f17a568ffee..e8f18fe8077 100644 --- a/source/blender/freestyle/intern/view_map/Functions1D.cpp +++ b/source/blender/freestyle/intern/view_map/Functions1D.cpp @@ -155,7 +155,7 @@ int IncrementChainingTimeStampF1D::operator()(Interface1D& inter) { ViewEdge *ve = dynamic_cast<ViewEdge*>(&inter); if (ve) - ve->setChainingTimeStamp(ve->getChainingTimeStamp()+1); + ve->setChainingTimeStamp(ve->getChainingTimeStamp() + 1); return 0; } diff --git a/source/blender/freestyle/intern/view_map/GridDensityProvider.h b/source/blender/freestyle/intern/view_map/GridDensityProvider.h index 5fe7d095358..930bb0af200 100644 --- a/source/blender/freestyle/intern/view_map/GridDensityProvider.h +++ b/source/blender/freestyle/intern/view_map/GridDensityProvider.h @@ -93,8 +93,8 @@ public: } } if (G.debug & G_DEBUG_FREESTYLE) { - cout << "Proscenium: (" << proscenium[0] << ", " << proscenium[1] << ", " << proscenium[2] - << ", " << proscenium[3] << ")" << endl; + cout << "Proscenium: (" << proscenium[0] << ", " << proscenium[1] << ", " << proscenium[2] << + ", " << proscenium[3] << ")" << endl; } } @@ -118,8 +118,8 @@ public: proscenium[3] = std::max(minPoint[1], maxPoint[1]); if (G.debug & G_DEBUG_FREESTYLE) { cout << "Bounding box: " << minPoint << " to " << maxPoint << endl; - cout << "Proscenium : " << proscenium[0] << ", " << proscenium[1] << ", " << proscenium[2] << ", " - << proscenium[3] << endl; + cout << "Proscenium : " << proscenium[0] << ", " << proscenium[1] << ", " << proscenium[2] << ", " << + proscenium[3] << endl; } } @@ -133,8 +133,8 @@ protected: class GridDensityProviderFactory { // Disallow copying and assignment - GridDensityProviderFactory (const GridDensityProviderFactory& other); - GridDensityProviderFactory& operator= (const GridDensityProviderFactory& other); + GridDensityProviderFactory(const GridDensityProviderFactory& other); + GridDensityProviderFactory& operator=(const GridDensityProviderFactory& other); public: GridDensityProviderFactory() {} diff --git a/source/blender/freestyle/intern/view_map/Interface0D.h b/source/blender/freestyle/intern/view_map/Interface0D.h index bbf93deadb7..f7c814a63d8 100644 --- a/source/blender/freestyle/intern/view_map/Interface0D.h +++ b/source/blender/freestyle/intern/view_map/Interface0D.h @@ -133,7 +133,7 @@ public: } /*! Returns the FEdge that lies between this Interface0D and the Interface0D given as argument. */ - virtual FEdge* getFEdge(Interface0D&) + virtual FEdge *getFEdge(Interface0D&) { PyErr_SetString(PyExc_TypeError, "method getFEdge() not properly overridden"); return 0; @@ -162,7 +162,7 @@ public: } /*! Cast the Interface0D in ViewVertex if it can be. */ - virtual ViewVertex * castToViewVertex() + virtual ViewVertex *castToViewVertex() { PyErr_SetString(PyExc_TypeError, "method castToViewVertex() not properly overridden"); return 0; @@ -201,7 +201,7 @@ public: virtual Interface0D& operator*() = 0; - virtual Interface0D* operator->() + virtual Interface0D *operator->() { return &(operator*()); } @@ -227,7 +227,7 @@ public: /*! Returns the point parameter 0<u<1 */ virtual float u() const = 0; - virtual Interface0DIteratorNested* copy() const = 0; + virtual Interface0DIteratorNested *copy() const = 0; }; @@ -245,7 +245,7 @@ public: class Interface0DIterator : public Iterator { public: - Interface0DIterator(Interface0DIteratorNested* it = NULL) + Interface0DIterator(Interface0DIteratorNested *it = NULL) { _iterator = it; } @@ -270,7 +270,7 @@ public: */ Interface0DIterator& operator=(const Interface0DIterator& it) { - if(_iterator) + if (_iterator) delete _iterator; _iterator = it._iterator->copy(); return *this; diff --git a/source/blender/freestyle/intern/view_map/OccluderSource.cpp b/source/blender/freestyle/intern/view_map/OccluderSource.cpp index 0cbad57b44a..b9fd5a3ebff 100644 --- a/source/blender/freestyle/intern/view_map/OccluderSource.cpp +++ b/source/blender/freestyle/intern/view_map/OccluderSource.cpp @@ -76,7 +76,8 @@ void OccluderSource::begin() } } -bool OccluderSource::next() { +bool OccluderSource::next() +{ if (valid) { ++currentFace; while (currentFace == facesEnd) { @@ -130,8 +131,8 @@ void OccluderSource::getOccluderProscenium(real proscenium[4]) next(); } if (G.debug & G_DEBUG_FREESTYLE) { - cout << "Proscenium: (" << proscenium[0] << ", " << proscenium[1] << ", " << proscenium[2] << ", " - << proscenium[3] << ")" << endl; + cout << "Proscenium: (" << proscenium[0] << ", " << proscenium[1] << ", " << proscenium[2] << ", " << + proscenium[3] << ")" << endl; } } diff --git a/source/blender/freestyle/intern/view_map/Silhouette.cpp b/source/blender/freestyle/intern/view_map/Silhouette.cpp index 104040fd2a5..f71c58c320c 100644 --- a/source/blender/freestyle/intern/view_map/Silhouette.cpp +++ b/source/blender/freestyle/intern/view_map/Silhouette.cpp @@ -173,7 +173,9 @@ FEdge *SVertex::getFEdge(Interface0D& inter) for (; fe != feend; ++fe) { if ((((*fe)->vertexA() == this) && ((*fe)->vertexB() == iVertexB)) || (((*fe)->vertexB() == this) && ((*fe)->vertexA() == iVertexB))) + { result = (*fe); + } } if ((result == 0) && (getNature() & Nature::T_VERTEX)) { SVertex *brother; @@ -187,7 +189,9 @@ FEdge *SVertex::getFEdge(Interface0D& inter) for (fe = fedges.begin(), feend = fedges.end(); fe != feend; ++fe) { if ((((*fe)->vertexA() == brother) && ((*fe)->vertexB() == iVertexB)) || (((*fe)->vertexB() == brother) && ((*fe)->vertexA() == iVertexB))) + { result = (*fe); + } } } } @@ -202,7 +206,9 @@ FEdge *SVertex::getFEdge(Interface0D& inter) for (fe = _FEdges.begin(), feend = _FEdges.end(); fe != feend; ++fe) { if ((((*fe)->vertexA() == this) && ((*fe)->vertexB() == brother)) || (((*fe)->vertexB() == this) && ((*fe)->vertexA() == brother))) + { result = (*fe); + } } } } diff --git a/source/blender/freestyle/intern/view_map/Silhouette.h b/source/blender/freestyle/intern/view_map/Silhouette.h index 2efe111add5..8f37532191e 100644 --- a/source/blender/freestyle/intern/view_map/Silhouette.h +++ b/source/blender/freestyle/intern/view_map/Silhouette.h @@ -377,8 +377,8 @@ public: /* replaces edge 1 by edge 2 in the list of edges */ inline void Replace(FEdge *e1, FEdge *e2) { - vector<FEdge*>::iterator insertedfe; - for (vector<FEdge*>::iterator fe = _FEdges.begin(),fend = _FEdges.end(); fe != fend; fe++) { + vector<FEdge *>::iterator insertedfe; + for (vector<FEdge *>::iterator fe = _FEdges.begin(), fend = _FEdges.end(); fe != fend; fe++) { if ((*fe) == e1) { insertedfe = _FEdges.insert(fe, e2);// inserts e2 before fe. // returns an iterator pointing toward e2. fe is invalidated. @@ -591,13 +591,13 @@ public: } /*! Returns the second SVertex. */ - inline SVertex* vertexB() + inline SVertex *vertexB() { return _VertexB; } /*! Returns the first SVertex if i=0, the seccond SVertex if i=1. */ - inline SVertex* operator[](const unsigned short int& i) const + inline SVertex *operator[](const unsigned short int& i) const { return (i % 2 == 0) ? _VertexA : _VertexB; } @@ -1429,7 +1429,7 @@ public: vector<FEdge*>::iterator fe, fend; vector<FEdge*>& fedges = iBrother.getChains(); for (fe = fedges.begin(), fend = fedges.end(); fe != fend; fe++) { - _chains.push_back((FEdge*)((*fe)->userdata)); + _chains.push_back((FEdge *)((*fe)->userdata)); } //------------------------- @@ -1443,7 +1443,7 @@ public: fed++) { FEdge *current = *fed; - newfedgelist.push_back((FEdge*)current->userdata); + newfedgelist.push_back((FEdge *)current->userdata); } (*sv)->setFEdges(newfedgelist); } @@ -1452,10 +1452,10 @@ public: // remap vertices and nextedge in edges: //------------------------------------- for (e = _edgesList.begin(), eend = _edgesList.end(); e != eend; e++) { - (*e)->setVertexA((SVertex*)((*e)->vertexA()->userdata)); - (*e)->setVertexB((SVertex*)((*e)->vertexB()->userdata)); - (*e)->setNextEdge((FEdge*)((*e)->nextEdge()->userdata)); - (*e)->setPreviousEdge((FEdge*)((*e)->previousEdge()->userdata)); + (*e)->setVertexA((SVertex *)((*e)->vertexA()->userdata)); + (*e)->setVertexB((SVertex *)((*e)->vertexB()->userdata)); + (*e)->setNextEdge((FEdge *)((*e)->nextEdge()->userdata)); + (*e)->setPreviousEdge((FEdge *)((*e)->previousEdge()->userdata)); } // reset all brothers userdata to NULL: @@ -1476,7 +1476,7 @@ public: } /*! Cloning method. */ - virtual SShape * duplicate() + virtual SShape *duplicate() { SShape *clone = new SShape(*this); return clone; @@ -1564,7 +1564,7 @@ public: Vec3r a = ioA->point2D(); Vec3r b = ioB->point2D(); - Vec3r newpoint3d,newpoint2d; + Vec3r newpoint3d, newpoint2d; vector<SVertex*> intersections; real t, T; for (vector<Vec2r>::const_iterator p = iParameters.begin(), pend = iParameters.end(); p != pend; p++) { @@ -1709,7 +1709,7 @@ public: ioEdge->setVertexB(ioNewVertex); if (ioEdge->isSmooth()) { - ((FEdgeSmooth*)newEdge)->setFace(((FEdgeSmooth*)ioEdge)->face()); + ((FEdgeSmooth *)newEdge)->setFace(((FEdgeSmooth *)ioEdge)->face()); } return newEdge; diff --git a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h index d6ee159fe88..f1c6b25c49e 100644 --- a/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h +++ b/source/blender/freestyle/intern/view_map/SilhouetteGeomEngine.h @@ -80,7 +80,7 @@ public: /*! retrieves an instance on the singleton */ static SilhouetteGeomEngine *getInstance() { - if(0 == _pInstance) { + if (_pInstance == NULL) { _pInstance = new SilhouetteGeomEngine; } return _pInstance; diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp index 4582fb40b61..2cd8e5ebe66 100644 --- a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp +++ b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp @@ -84,9 +84,9 @@ SphericalGrid::Iterator::Iterator(SphericalGrid& grid, Vec3r& center, real epsil _cell = grid.findCell(_target); #if SPHERICAL_GRID_LOGGING if (G.debug & G_DEBUG_FREESTYLE) { - cout << "Searching for occluders of edge centered at " << _target << " in cell [" - << _cell->boundary[0] << ", " << _cell->boundary[1] << ", " << _cell->boundary[2] - << ", " << _cell->boundary[3] << "] (" << _cell->faces.size() << " occluders)" << endl; + cout << "Searching for occluders of edge centered at " << _target << " in cell [" << + _cell->boundary[0] << ", " << _cell->boundary[1] << ", " << _cell->boundary[2] << + ", " << _cell->boundary[3] << "] (" << _cell->faces.size() << " occluders)" << endl; } #endif @@ -157,7 +157,7 @@ void SphericalGrid::assignCells(OccluderSource& source, GridDensityProvider& den height = _cellSize; // Initialize cell - Cell* b = _cells[i * _cellsY + j] = new Cell(); + Cell *b = _cells[i * _cellsY + j] = new Cell(); b->setDimensions(x, y, width, height); } } diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.h b/source/blender/freestyle/intern/view_map/SphericalGrid.h index 57ed117a935..774ec9ab517 100644 --- a/source/blender/freestyle/intern/view_map/SphericalGrid.h +++ b/source/blender/freestyle/intern/view_map/SphericalGrid.h @@ -193,21 +193,21 @@ inline void SphericalGrid::Iterator::initBeforeTarget() inline void SphericalGrid::Iterator::initAfterTarget() { if (_foundOccludee) { - #if SPHERICAL_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\tStarting occludee search from occludeeCandidate at depth " - << _occludeeDepth << std::endl; - } - #endif +#if SPHERICAL_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\tStarting occludee search from occludeeCandidate at depth " << + _occludeeDepth << std::endl; + } +#endif _current = _occludeeCandidate; return; } - #if SPHERICAL_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\tStarting occludee search from current position" << std::endl; - } - #endif +#if SPHERICAL_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\tStarting occludee search from current position" << std::endl; + } +#endif while (_current != _cell->faces.end() && !testOccluder(true)) { ++_current; @@ -222,23 +222,23 @@ inline bool SphericalGrid::Iterator::testOccluder(bool wantOccludee) // _current=_cell->face.end() will make the calling routine give up. return true; } - #if SPHERICAL_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\tTesting occluder " << (*_current)->poly.getVertices()[0]; - for (unsigned int i = 1; i < (*_current)->poly.getVertices().size(); ++i) { - std::cout << ", " << (*_current)->poly.getVertices()[i]; - } - std::cout << " from shape " << (*_current)->face->GetVertex(0)->shape()->GetId() << std::endl; +#if SPHERICAL_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\tTesting occluder " << (*_current)->poly.getVertices()[0]; + for (unsigned int i = 1; i < (*_current)->poly.getVertices().size(); ++i) { + std::cout << ", " << (*_current)->poly.getVertices()[i]; } - #endif + std::cout << " from shape " << (*_current)->face->GetVertex(0)->shape()->GetId() << std::endl; + } +#endif // If we have an occluder candidate and we are unambiguously after it, abort if (_foundOccludee && (*_current)->shallowest > _occludeeDepth) { - #if SPHERICAL_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\t\tAborting: shallowest > occludeeCandidate->deepest" << std::endl; - } - #endif +#if SPHERICAL_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tAborting: shallowest > occludeeCandidate->deepest" << std::endl; + } +#endif _current = _cell->faces.end(); // See note above @@ -248,21 +248,21 @@ inline bool SphericalGrid::Iterator::testOccluder(bool wantOccludee) // Specific continue or stop conditions when searching for each type if (wantOccludee) { if ((*_current)->deepest < _target[2]) { - #if SPHERICAL_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\t\tSkipping: shallower than target while looking for occludee" << std::endl; - } - #endif +#if SPHERICAL_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tSkipping: shallower than target while looking for occludee" << std::endl; + } +#endif return false; } } else { if ((*_current)->shallowest > _target[2]) { - #if SPHERICAL_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\t\tStopping: deeper than target while looking for occluder" << std::endl; - } - #endif +#if SPHERICAL_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tStopping: deeper than target while looking for occluder" << std::endl; + } +#endif return true; } } @@ -273,11 +273,11 @@ inline bool SphericalGrid::Iterator::testOccluder(bool wantOccludee) Vec3r bbMin, bbMax; (*_current)->poly.getBBox(bbMin, bbMax); if (_target[0] < bbMin[0] || _target[0] > bbMax[0] || _target[1] < bbMin[1] || _target[1] > bbMax[1]) { - #if SPHERICAL_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\t\tSkipping: bounding box violation" << std::endl; - } - #endif +#if SPHERICAL_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tSkipping: bounding box violation" << std::endl; + } +#endif return false; } @@ -291,28 +291,28 @@ inline void SphericalGrid::Iterator::reportDepth(Vec3r origin, Vec3r u, real t) // If origin is the viewpoint, depth == t. A future optimization could allow the caller to tell us if origin is // viewponit or target, at the cost of changing the OptimizedGrid API. real depth = (origin + u * t).norm(); - #if SPHERICAL_GRID_LOGGING +#if SPHERICAL_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tReporting depth of occluder/ee: " << depth; + } +#endif + if (depth > _target[2]) { +#if SPHERICAL_GRID_LOGGING if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\t\tReporting depth of occluder/ee: " << depth; + std::cout << " is deeper than target" << std::endl; } - #endif - if (depth > _target[2]) { - #if SPHERICAL_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << " is deeper than target" << std::endl; - } - #endif +#endif // If the current occluder is the best occludee so far, save it. if (! _foundOccludee || _occludeeDepth > depth) { markCurrentOccludeeCandidate(depth); } } else { - #if SPHERICAL_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << std::endl; - } - #endif +#if SPHERICAL_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << std::endl; + } +#endif } } @@ -346,11 +346,11 @@ inline bool SphericalGrid::Iterator::validAfterTarget() inline void SphericalGrid::Iterator::markCurrentOccludeeCandidate(real depth) { - #if SPHERICAL_GRID_LOGGING - if (G.debug & G_DEBUG_FREESTYLE) { - std::cout << "\t\tFound occludeeCandidate at depth " << depth << std::endl; - } - #endif +#if SPHERICAL_GRID_LOGGING + if (G.debug & G_DEBUG_FREESTYLE) { + std::cout << "\t\tFound occludeeCandidate at depth " << depth << std::endl; + } +#endif _occludeeCandidate = _current; _occludeeDepth = depth; _foundOccludee = true; diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp index 120ef46667b..98345b396f4 100644 --- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp @@ -25,7 +25,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/freestyle/intern/view_map/SteerbaleViewMap.cpp +/** \file blender/freestyle/intern/view_map/SteerableViewMap.cpp * \ingroup freestyle * \brief Convenient access to the steerable ViewMap to which any element of the ViewMap belongs to. * \author Stephane Grabli @@ -57,7 +57,7 @@ using namespace Geometry; SteerableViewMap::SteerableViewMap(unsigned int nbOrientations) { _nbOrientations = nbOrientations; - _bound = cos(M_PI/(float)_nbOrientations); + _bound = cos(M_PI / (float)_nbOrientations); for (unsigned int i = 0; i < _nbOrientations; ++i) { _directions.push_back(Vec2d(cos((float)i * M_PI / (float)_nbOrientations), sin((float)i * M_PI / (float)_nbOrientations))); @@ -67,7 +67,7 @@ SteerableViewMap::SteerableViewMap(unsigned int nbOrientations) void SteerableViewMap::Build() { - _imagesPyramids = new ImagePyramid * [_nbOrientations + 1]; // one more map to store the complete visible VM + _imagesPyramids = new ImagePyramid *[_nbOrientations + 1]; // one more map to store the complete visible VM memset((_imagesPyramids), 0, (_nbOrientations + 1) * sizeof(ImagePyramid *)); } @@ -78,7 +78,7 @@ SteerableViewMap::SteerableViewMap(const SteerableViewMap& iBrother) _bound = iBrother._bound; _directions = iBrother._directions; _mapping = iBrother._mapping; - _imagesPyramids = new ImagePyramid * [_nbOrientations + 1]; // one more map to store the complete visible VM + _imagesPyramids = new ImagePyramid *[_nbOrientations + 1]; // one more map to store the complete visible VM for (i = 0; i < _nbOrientations + 1; ++i) _imagesPyramids[i] = new GaussianPyramid(*(dynamic_cast<GaussianPyramid*>(iBrother._imagesPyramids[i]))); } @@ -128,7 +128,7 @@ double *SteerableViewMap::AddFEdge(FEdge *iFEdge) { unsigned i; unsigned id = iFEdge->getId().getFirst(); - map<unsigned int, double* >::iterator o = _mapping.find(id); + map<unsigned int, double *>::iterator o = _mapping.find(id); if (o != _mapping.end()) { return (*o).second; } @@ -174,7 +174,7 @@ unsigned SteerableViewMap::getSVMNumber(const Vec2f& orient) unsigned SteerableViewMap::getSVMNumber(unsigned id) { - map<unsigned int, double* >::iterator o = _mapping.find(id); + map<unsigned int, double *>::iterator o = _mapping.find(id); if (o != _mapping.end()) { double *wvalues = (*o).second; double maxw = 0.0; @@ -241,8 +241,8 @@ void SteerableViewMap::saveSteerableViewMap() const { for (unsigned int i = 0; i <= _nbOrientations; ++i) { if (_imagesPyramids[i] == 0) { - cerr << "SteerableViewMap warning: orientation " << i - << " of steerable View Map whas not been computed yet" << endl; + cerr << "SteerableViewMap warning: orientation " << i << + " of steerable View Map whas not been computed yet" << endl; continue; } int ow = _imagesPyramids[i]->width(0); @@ -267,8 +267,8 @@ void SteerableViewMap::saveSteerableViewMap() const //int c = (int)(_imagesPyramids[i]->pixel(x, y, j)); //soc qtmp.setPixel(x, y, qRgb(c, c, c)); - pix = (char*)ibuf->rect + y * rowbytes + x * 4; - pix[0] = pix [1] = pix[2] = c; + pix = (char *)ibuf->rect + y * rowbytes + x * 4; + pix[0] = pix[1] = pix[2] = c; } } diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.h b/source/blender/freestyle/intern/view_map/SteerableViewMap.h index a4a67c3fa7e..28504350ac5 100644 --- a/source/blender/freestyle/intern/view_map/SteerableViewMap.h +++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.h @@ -28,7 +28,7 @@ #ifndef __FREESTYLE_STEERABLE_VIEW_MAP_H__ #define __FREESTYLE_STEERABLE_VIEW_MAP_H__ -/** \file blender/freestyle/intern/view_map/SteerbaleViewMap.h +/** \file blender/freestyle/intern/view_map/SteerableViewMap.h * \ingroup freestyle * \brief Convenient access to the steerable ViewMap to which any element of the ViewMap belongs to. * \author Stephane Grabli diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp index 56c32d8e134..537688e4c44 100644 --- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.cpp @@ -203,8 +203,8 @@ ViewEdge *ViewEdgeXBuilder::BuildSmoothViewEdge(const OWXFaceLayer& iFaceLayer) ViewVertex *vva = MakeViewVertex(fefirst->vertexA()); ViewVertex *vvb = MakeViewVertex(fe->vertexB()); - ((NonTVertex*)vva)->AddOutgoingViewEdge(newVEdge); - ((NonTVertex*)vvb)->AddIncomingViewEdge(newVEdge); + ((NonTVertex *)vva)->AddOutgoingViewEdge(newVEdge); + ((NonTVertex *)vvb)->AddIncomingViewEdge(newVEdge); newVEdge->setA(vva); newVEdge->setB(vvb); @@ -284,8 +284,8 @@ ViewEdge *ViewEdgeXBuilder::BuildSharpViewEdge(const OWXEdge& iWEdge) ViewVertex *vva = MakeViewVertex(fefirst->vertexA()); ViewVertex *vvb = MakeViewVertex(fe->vertexB()); - ((NonTVertex*)vva)->AddOutgoingViewEdge(newVEdge); - ((NonTVertex*)vvb)->AddIncomingViewEdge(newVEdge); + ((NonTVertex *)vva)->AddOutgoingViewEdge(newVEdge); + ((NonTVertex *)vvb)->AddIncomingViewEdge(newVEdge); newVEdge->setA(vva); newVEdge->setB(vvb); @@ -345,7 +345,7 @@ OWXFaceLayer ViewEdgeXBuilder::FindNextFaceLayer(const OWXFaceLayer& iFaceLayer) return OWXFaceLayer(NULL, true); // if the next face layer has either no smooth edge or no smooth edge of same nature, no next face if (!nextFace->hasSmoothEdges()) - return OWXFaceLayer(NULL,true); + return OWXFaceLayer(NULL, true); vector<WXFaceLayer*> sameNatureLayers; nextFace->retrieveSmoothEdgesLayers(iFaceLayer.fl->nature(), sameNatureLayers); // don't know how to deal with several edges of same nature on a single face @@ -394,7 +394,7 @@ OWXFaceLayer ViewEdgeXBuilder::FindPreviousFaceLayer(const OWXFaceLayer& iFaceLa WVertex::face_iterator fend = previousVertex->faces_end(); for (; (!found) && (f != fend); ++f) { previousFace = dynamic_cast<WXFace*>(*f); - if ((0 != previousFace) && (previousFace!=iFaceLayer.fl->getFace())) { + if ((0 != previousFace) && (previousFace != iFaceLayer.fl->getFace())) { vector<WXFaceLayer*> sameNatureLayers; previousFace->retrieveSmoothEdgesLayers(iFaceLayer.fl->nature(), sameNatureLayers); // don't know... Maybe should test whether this face has also a vertex_edge configuration @@ -562,7 +562,7 @@ OWXEdge ViewEdgeXBuilder::FindNextWEdge(const OWXEdge& iEdge) else v = iEdge.e->GetaVertex(); - if (((WXVertex*)v)->isFeature()) + if (((WXVertex *)v)->isFeature()) return 0; /* XXX eeek? NULL? OWXEdge(NULL, true/false)?*/ int faceMarks = retrieveFaceMarks(iEdge.e); @@ -605,13 +605,13 @@ OWXEdge ViewEdgeXBuilder::FindPreviousWEdge(const OWXEdge& iEdge) else v = iEdge.e->GetbVertex(); - if (((WXVertex*)v)->isFeature()) + if (((WXVertex *)v)->isFeature()) return 0; int faceMarks = retrieveFaceMarks(iEdge.e); - vector<WEdge*>& vEdges = (v)->GetEdges(); - for (vector<WEdge*>::iterator ve = vEdges.begin(), veend = vEdges.end(); ve != veend; ve++) { - WXEdge *wxe = dynamic_cast<WXEdge*>(*ve); + vector<WEdge *>& vEdges = (v)->GetEdges(); + for (vector<WEdge *>::iterator ve = vEdges.begin(), veend = vEdges.end(); ve != veend; ve++) { + WXEdge *wxe = dynamic_cast<WXEdge *>(*ve); if (wxe == iEdge.e) continue; // same edge as the one processed diff --git a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h index 2883919a852..024ab7eac5f 100644 --- a/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h +++ b/source/blender/freestyle/intern/view_map/ViewEdgeXBuilder.h @@ -86,7 +86,7 @@ struct epsilonEquals // typedef hash_map<Vec3r, SVertex*, SVertexHasher, epsilonEquals> SVertexMap; -typedef map<Vec3r , SVertex*> SVertexMap; +typedef map<Vec3r, SVertex *> SVertexMap; class WXFaceLayer; diff --git a/source/blender/freestyle/intern/view_map/ViewMap.cpp b/source/blender/freestyle/intern/view_map/ViewMap.cpp index 9f8b5e08200..7f8c797b5b9 100644 --- a/source/blender/freestyle/intern/view_map/ViewMap.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMap.cpp @@ -162,24 +162,24 @@ ViewVertex *ViewMap::InsertViewVertex(SVertex *iVertex, vector<ViewEdge*>& newVi return vva; // because it is not already a ViewVertex, this SVertex must have only 2 FEdges. The incoming one still belongs // to ioEdge, the outgoing one now belongs to newVEdge - const vector<FEdge*>& fedges = iVertex->fedges(); + const vector<FEdge *>& fedges = iVertex->fedges(); if (fedges.size() != 2) { cerr << "ViewMap warning: Can't split the ViewEdge" << endl; return NULL; } - FEdge *fend(0), *fbegin(0); - for (vector<FEdge*>::const_iterator fe = fedges.begin(), feend = fedges.end(); fe != feend; ++fe) { + FEdge *fend(NULL), *fbegin(NULL); + for (vector<FEdge *>::const_iterator fe = fedges.begin(), feend = fedges.end(); fe != feend; ++fe) { if ((*fe)->vertexB() == iVertex) { fend = (*fe); } if ((*fe)->vertexA() == iVertex) { fbegin = (*fe); } - if ((fbegin!=0) && (fend!=0)) + if ((fbegin != NULL) && (fend != NULL)) break; } ViewEdge *ioEdge = fbegin->viewedge(); - ViewShape * vshape = ioEdge->viewShape(); + ViewShape *vshape = ioEdge->viewShape(); vva = new NonTVertex(iVertex); // if the ViewEdge is a closed loop, we don't create a new VEdge if (ioEdge->A() == 0) { @@ -482,7 +482,8 @@ ViewVertexInternal::orientedViewEdgeIterator TVertex::edgesIterator(ViewEdge *iE /* */ /**********************************/ -void NonTVertex::AddOutgoingViewEdge(ViewEdge *iVEdge){ +void NonTVertex::AddOutgoingViewEdge(ViewEdge *iVEdge) +{ // let's keep the viewedges ordered in CCW order in the 2D image plan directedViewEdge idve(iVEdge, false); if (!_ViewEdges.empty()) { @@ -597,7 +598,7 @@ ViewEdge::edge_iterator ViewEdge::ViewEdge_iterator() ViewEdge::const_edge_iterator ViewEdge::ViewEdge_iterator() const { - return const_edge_iterator((ViewEdge*)this); + return const_edge_iterator((ViewEdge *)this); } //! feature edge iterator diff --git a/source/blender/freestyle/intern/view_map/ViewMap.h b/source/blender/freestyle/intern/view_map/ViewMap.h index e29b2ae7cd6..1dce71051ee 100644 --- a/source/blender/freestyle/intern/view_map/ViewMap.h +++ b/source/blender/freestyle/intern/view_map/ViewMap.h @@ -276,7 +276,7 @@ public: // Implementation of Interface0D public: friend class ViewShape; - typedef pair<ViewEdge*, bool> directedViewEdge; // if bool = true, the ViewEdge is incoming + typedef pair<ViewEdge *, bool> directedViewEdge; // if bool = true, the ViewEdge is incoming typedef vector<directedViewEdge> edges_container; @@ -744,7 +744,7 @@ public: } /*! Builds a NonTVertex from a SVertex. */ - inline NonTVertex(SVertex* iSVertex) : ViewVertex(Nature::NON_T_VERTEX) + inline NonTVertex(SVertex *iSVertex) : ViewVertex(Nature::NON_T_VERTEX) { _SVertex = iSVertex; _SVertex->setViewVertex(this); @@ -1401,8 +1401,8 @@ public: inline ViewShape(ViewShape& iBrother) { userdata = NULL; - vector<ViewVertex*>::iterator vv,vvend; - vector<ViewEdge*>::iterator ve, veend; + vector<ViewVertex *>::iterator vv, vvend; + vector<ViewEdge *>::iterator ve, veend; _SShape = iBrother._SShape; @@ -1427,11 +1427,11 @@ public: switch ((*vv)->getNature()) { case Nature::T_VERTEX: { - TVertex *v = (TVertex*)(*vv); - ViewEdge *veFrontA = (ViewEdge*)(v)->frontEdgeA().first->userdata; - ViewEdge *veFrontB = (ViewEdge*)(v)->frontEdgeB().first->userdata; - ViewEdge *veBackA = (ViewEdge*)(v)->backEdgeA().first->userdata; - ViewEdge *veBackB = (ViewEdge*)(v)->backEdgeB().first->userdata; + TVertex *v = (TVertex *)(*vv); + ViewEdge *veFrontA = (ViewEdge *)(v)->frontEdgeA().first->userdata; + ViewEdge *veFrontB = (ViewEdge *)(v)->frontEdgeB().first->userdata; + ViewEdge *veBackA = (ViewEdge *)(v)->backEdgeA().first->userdata; + ViewEdge *veBackB = (ViewEdge *)(v)->backEdgeB().first->userdata; v->setFrontEdgeA(veFrontA, v->frontEdgeA().second); v->setFrontEdgeB(veFrontB, v->frontEdgeB().second); @@ -1441,14 +1441,14 @@ public: break; case Nature::NON_T_VERTEX: { - NonTVertex *v = (NonTVertex*)(*vv); + NonTVertex *v = (NonTVertex *)(*vv); vector<ViewVertex::directedViewEdge>& vedges = (v)->viewedges(); vector<ViewVertex::directedViewEdge> newEdges; for (vector<ViewVertex::directedViewEdge>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) { - ViewEdge *current = (ViewEdge*)((ve)->first)->userdata; + ViewEdge *current = (ViewEdge *)((ve)->first)->userdata; newEdges.push_back(ViewVertex::directedViewEdge(current, ve->second)); } (v)->setViewEdges(newEdges); @@ -1463,8 +1463,8 @@ public: // remap vertices in edges: //------------------------------------- for (ve = _Edges.begin(), veend = _Edges.end(); ve != veend; ve++) { - (*ve)->setA((ViewVertex*)((*ve)->A()->userdata)); - (*ve)->setB((ViewVertex*)((*ve)->B()->userdata)); + (*ve)->setA((ViewVertex *)((*ve)->A()->userdata)); + (*ve)->setB((ViewVertex *)((*ve)->B()->userdata)); //--------------------------------------- // Update all embedded FEdges //--------------------------------------- @@ -1757,7 +1757,7 @@ inline real ViewEdge::local_average_density(float sigma, int iCombination) const } #endif -inline const SShape * ViewEdge::occluded_shape() const +inline const SShape *ViewEdge::occluded_shape() const { if (0 == _aShape) return 0; diff --git a/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h b/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h index ff6557b7d86..d7ed73ed795 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h +++ b/source/blender/freestyle/intern/view_map/ViewMapAdvancedIterators.h @@ -77,7 +77,7 @@ public: }; template<class Traits> -class edge_iterator_base : public IteratorBase<Traits,InputIteratorTag_Traits> +class edge_iterator_base : public IteratorBase<Traits, InputIteratorTag_Traits> { public: typedef typename Traits::value_type value_type; @@ -117,7 +117,7 @@ protected: edges_container_iterator _end; edges_container_iterator _nontvertex_iter; - typedef IteratorBase<Traits,InputIteratorTag_Traits> parent_class; + typedef IteratorBase<Traits, InputIteratorTag_Traits> parent_class; public: inline edge_iterator_base() : parent_class() {} @@ -357,7 +357,7 @@ namespace ViewEdgeInternal { /*! Iterators definition */ /*!----------------------*/ template<class Traits> -class edge_iterator_base : public IteratorBase<Traits,BidirectionalIteratorTag_Traits> +class edge_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTag_Traits> { public: typedef typename Traits::value_type value_type; @@ -372,7 +372,7 @@ public: //friend class edge_iterator_base<Const_traits<ViewEdge*> >; value_type _first; bool _orientation; - typedef IteratorBase<Traits,BidirectionalIteratorTag_Traits> parent_class; + typedef IteratorBase<Traits, BidirectionalIteratorTag_Traits> parent_class; public: friend class ViewEdge; @@ -510,7 +510,7 @@ protected: }; template<class Traits> -class fedge_iterator_base : public IteratorBase<Traits,BidirectionalIteratorTag_Traits> +class fedge_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTag_Traits> { public: typedef typename Traits::value_type value_type; @@ -520,7 +520,7 @@ public: typedef fedge_iterator_base<Traits> Self; public: - typedef IteratorBase<Traits,BidirectionalIteratorTag_Traits> parent_class; + typedef IteratorBase<Traits, BidirectionalIteratorTag_Traits> parent_class; mutable value_type _FEdge; value_type _first; value_type _FEdgeB; // last fedge of the view edge @@ -640,7 +640,7 @@ protected: }; template<class Traits> -class vertex_iterator_base : public IteratorBase<Traits,BidirectionalIteratorTag_Traits> +class vertex_iterator_base : public IteratorBase<Traits, BidirectionalIteratorTag_Traits> { public: typedef typename Traits::value_type value_type; @@ -650,7 +650,7 @@ public: typedef vertex_iterator_base<Traits> Self; protected: - typedef IteratorBase<Traits,BidirectionalIteratorTag_Traits> parent_class; + typedef IteratorBase<Traits, BidirectionalIteratorTag_Traits> parent_class; public: mutable value_type _SVertex; diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp index ea959bfd81d..6727a44465a 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp @@ -66,7 +66,7 @@ static void findOccludee(FEdge *fe, G& grid, I& occluders, real epsilon, WFace * WFace *face = NULL; if (fe->isSmooth()) { FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth*>(fe); - face = (WFace*)fes->face(); + face = (WFace *)fes->face(); } WFace *oface; bool skipFace; @@ -81,12 +81,12 @@ static void findOccludee(FEdge *fe, G& grid, I& occluders, real epsilon, WFace * real mint = FLT_MAX; for (occluders.initAfterTarget(); occluders.validAfterTarget(); occluders.nextOccludee()) { - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\t\tEvaluating intersection for occludee " << occluders.getWFace() << " and ray " << A - << " * " << u << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\t\tEvaluating intersection for occludee " << occluders.getWFace() << " and ray " << A << + " * " << u << endl; + } +#endif oface = occluders.getWFace(); Polygon3r *p = occluders.getCameraSpacePolygon(); real d = -((p->getVertices())[0] * p->getNormal()); @@ -131,22 +131,22 @@ static void findOccludee(FEdge *fe, G& grid, I& occluders, real epsilon, WFace * //first let us compute the plane equation. if (GeomUtils::COINCIDENT == GeomUtils::intersectRayPlane(origin, edge, p->getNormal(), d, t, epsilon)) { - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\t\tRejecting occluder for target coincidence." << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\t\tRejecting occluder for target coincidence." << endl; + } +#endif continue; } } if (p->rayIntersect(A, v, t, t_u, t_v)) { - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\t\tRay " << A << " * " << v << " intersects at time " << t << endl; - cout << "\t\t(v * normal) == " << (v * p->getNormal()) << " for normal " << p->getNormal() << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\t\tRay " << A << " * " << v << " intersects at time " << t << endl; + cout << "\t\t(v * normal) == " << (v * p->getNormal()) << " for normal " << p->getNormal() << endl; + } +#endif if (fabs(v * p->getNormal()) > 0.0001) { if ((t > 0.0)) { // && (t<1.0)) if (t < mint) { @@ -154,11 +154,11 @@ static void findOccludee(FEdge *fe, G& grid, I& occluders, real epsilon, WFace * mint = t; noIntersection = false; fe->setOccludeeIntersection(Vec3r(A + t * v)); - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\t\tIs occludee" << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\t\tIs occludee" << endl; + } +#endif } } } @@ -195,7 +195,7 @@ static void findOccludee(FEdge *fe, G& grid, real epsilon, ViewEdge *ve, WFace * WFace *face = NULL; if (fe->isSmooth()) { FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth*>(fe); - face = (WFace*)fes->face(); + face = (WFace *)fes->face(); } if (face) { @@ -236,7 +236,7 @@ static int computeVisibility(ViewMap *viewMap, FEdge *fe, G& grid, real epsilon, WFace *face = NULL; if (fe->isSmooth()) { FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth*>(fe); - face = (WFace*)fes->face(); + face = (WFace *)fes->face(); } vector<WVertex*> faceVertices; WVertex::incoming_edge_iterator ie; @@ -256,54 +256,53 @@ static int computeVisibility(ViewMap *viewMap, FEdge *fe, G& grid, real epsilon, oface = occluders.getWFace(); Polygon3r *p = occluders.getCameraSpacePolygon(); real t, t_u, t_v; - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\t\tEvaluating intersection for occluder " << (p->getVertices())[0] << (p->getVertices())[1] - << (p->getVertices())[2] << endl << "\t\t\tand ray " << vp << " * " << u << " (center " << center << ")" - << endl; - } - #endif - - #if LOGGING - Vec3r v(vp - center); - real rl = v.norm(); - v.normalize(); - vector<Vec3r> points; - // Iterate over vertices, storing projections in points - for (vector<WOEdge*>::const_iterator woe = oface->getEdgeList().begin(), woend = oface->getEdgeList().end(); - woe != woend; - woe++) - { - points.push_back(Vec3r((*woe)->GetaVertex()->GetVertex())); - } - Polygon3r p1(points, oface->GetNormal()); - Vec3r v1((p1.getVertices())[0]); - real d = -(v1 * p->getNormal()); - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\t\tp: " << (p->getVertices())[0] << (p->getVertices())[1] << (p->getVertices())[2] << ", norm: " - << p->getNormal() << endl; - cout << "\t\tp1: " << (p1.getVertices())[0] << (p1.getVertices())[1] << (p1.getVertices())[2] << ", norm: " - << p1.getNormal() << endl; - } - #else - real d = -((p->getVertices())[0] * p->getNormal()); - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\t\tEvaluating intersection for occluder " << (p->getVertices())[0] << (p->getVertices())[1] << + (p->getVertices())[2] << endl << "\t\t\tand ray " << vp << " * " << u << " (center " << center << + ")" << endl; + } +#endif - if (face) +#if LOGGING + Vec3r v(vp - center); + real rl = v.norm(); + v.normalize(); + vector<Vec3r> points; + // Iterate over vertices, storing projections in points + for (vector<WOEdge*>::const_iterator woe = oface->getEdgeList().begin(), woend = oface->getEdgeList().end(); + woe != woend; + woe++) { - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\t\tDetermining face adjacency..."; - } - #endif + points.push_back(Vec3r((*woe)->GetaVertex()->GetVertex())); + } + Polygon3r p1(points, oface->GetNormal()); + Vec3r v1((p1.getVertices())[0]); + real d = -(v1 * p->getNormal()); + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\t\tp: " << (p->getVertices())[0] << (p->getVertices())[1] << (p->getVertices())[2] << ", norm: " << + p->getNormal() << endl; + cout << "\t\tp1: " << (p1.getVertices())[0] << (p1.getVertices())[1] << (p1.getVertices())[2] << ", norm: " << + p1.getNormal() << endl; + } +#else + real d = -((p->getVertices())[0] * p->getNormal()); +#endif + + if (face) { +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\t\tDetermining face adjacency..."; + } +#endif skipFace = false; if (face == oface) { - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << " Rejecting occluder for face concurrency." << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << " Rejecting occluder for face concurrency." << endl; + } +#endif continue; } @@ -330,11 +329,11 @@ static int computeVisibility(ViewMap *viewMap, FEdge *fe, G& grid, real epsilon, break; } if (skipFace) { - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << " Rejecting occluder for face adjacency." << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << " Rejecting occluder for face adjacency." << endl; + } +#endif continue; } } @@ -343,43 +342,43 @@ static int computeVisibility(ViewMap *viewMap, FEdge *fe, G& grid, real epsilon, //------------------------------------------------------------- //first let us compute the plane equation. if (GeomUtils::COINCIDENT == GeomUtils::intersectRayPlane(origin, edge, p->getNormal(), d, t, epsilon)) { - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\t\tRejecting occluder for target coincidence." << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\t\tRejecting occluder for target coincidence." << endl; + } +#endif continue; } } - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - real x; - if (p1.rayIntersect(center, v, x, t_u, t_v)) { - cout << "\t\tRay should intersect at time " << (rl - x) << ". Center: " << center << ", V: " << v - << ", RL: " << rl << ", T:" << x << endl; - } - else { - cout << "\t\tRay should not intersect. Center: " << center << ", V: " << v << ", RL: " << rl << endl; - } +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + real x; + if (p1.rayIntersect(center, v, x, t_u, t_v)) { + cout << "\t\tRay should intersect at time " << (rl - x) << ". Center: " << center << ", V: " << v << + ", RL: " << rl << ", T:" << x << endl; + } + else { + cout << "\t\tRay should not intersect. Center: " << center << ", V: " << v << ", RL: " << rl << endl; } - #endif + } +#endif if (p->rayIntersect(center, u, t, t_u, t_v)) { - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\t\tRay " << center << " * " << u << " intersects at time " << t << " (raylength is " - << raylength << ")" << endl; - cout << "\t\t(u * normal) == " << (u * p->getNormal()) << " for normal " << p->getNormal() << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\t\tRay " << center << " * " << u << " intersects at time " << t << " (raylength is " << + raylength << ")" << endl; + cout << "\t\t(u * normal) == " << (u * p->getNormal()) << " for normal " << p->getNormal() << endl; + } +#endif if (fabs(u * p->getNormal()) > 0.0001) { if ((t > 0.0) && (t < raylength)) { - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\t\tIs occluder" << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\t\tIs occluder" << endl; + } +#endif if ( foundOccluders != NULL ) { ViewShape *vshape = viewMap->viewShape(oface->GetVertex(0)->shape()->GetId()); foundOccluders->insert(vshape); @@ -425,21 +424,21 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo for (vector<ViewEdge*>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) { if (iRenderMonitor && iRenderMonitor->testBreak()) break; - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "Processing ViewEdge " << (*ve)->getId() << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "Processing ViewEdge " << (*ve)->getId() << endl; + } +#endif // Find an edge to test if (!(*ve)->isInImage()) { // This view edge has been proscenium culled (*ve)->setQI(255); (*ve)->setaShape(0); - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\tCulled." << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\tCulled." << endl; + } +#endif continue; } @@ -470,11 +469,11 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo ++qiMajority; qiMajority >>= 1; } - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\tqiMajority: " << qiMajority << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\tqiMajority: " << qiMajority << endl; + } +#endif tmpQI = 0; maxIndex = 0; @@ -492,11 +491,11 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo if ((maxCard < qiMajority)) { //ARB: change &wFace to wFace and use reference in called function tmpQI = computeVisibility<G, I>(ioViewMap, fe, grid, epsilon, *ve, &wFace, &foundOccluders); - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\tFEdge: visibility " << tmpQI << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\tFEdge: visibility " << tmpQI << endl; + } +#endif //ARB: This is an error condition, not an alert condition. // Some sort of recovery or abort is necessary. @@ -515,11 +514,11 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo //ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called //ARB: change &wFace to wFace and use reference in called function findOccludee<G, I>(fe, grid, epsilon, *ve, &wFace); - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\tFEdge: occludee only (" << (wFace != NULL ? "found" : "not found") << ")" << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\tFEdge: occludee only (" << (wFace != NULL ? "found" : "not found") << ")" << endl; + } +#endif } // Store test results @@ -533,11 +532,11 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo fe->setaFace(poly); wFaces.push_back(wFace); fe->setOccludeeEmpty(false); - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\tFound occludee" << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\tFound occludee" << endl; + } +#endif } else { fe->setOccludeeEmpty(true); @@ -547,11 +546,11 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo fe = fe->nextEdge(); } while ((maxCard < qiMajority) && (fe) && (fe != festart)); - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\tFinished with " << nSamples << " samples, maxCard = " << maxCard << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\tFinished with " << nSamples << " samples, maxCard = " << maxCard << endl; + } +#endif // ViewEdge // qi -- @@ -569,13 +568,13 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap, G& grid, real epsilo for (set<ViewShape*>::iterator o = foundOccluders.begin(), oend = foundOccluders.end(); o != oend; ++o) { (*ve)->AddOccluder((*o)); } - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\tConclusion: QI = " << maxIndex << ", " << (*ve)->occluders_size() << " occluders." << endl; - } - #else - (void)maxIndex; - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\tConclusion: QI = " << maxIndex << ", " << (*ve)->occluders_size() << " occluders." << endl; + } +#else + (void)maxIndex; +#endif // occludee -- if (!wFaces.empty()) { if (wFaces.size() <= (float)nSamples / 2.0f) { @@ -607,21 +606,21 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon, for (vector<ViewEdge*>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) { if (iRenderMonitor && iRenderMonitor->testBreak()) break; - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "Processing ViewEdge " << (*ve)->getId() << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "Processing ViewEdge " << (*ve)->getId() << endl; + } +#endif // Find an edge to test if (!(*ve)->isInImage()) { // This view edge has been proscenium culled (*ve)->setQI(255); (*ve)->setaShape(0); - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\tCulled." << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\tCulled." << endl; + } +#endif continue; } @@ -652,11 +651,11 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon, ++qiMajority; qiMajority >>= 1; } - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\tqiMajority: " << qiMajority << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\tqiMajority: " << qiMajority << endl; + } +#endif tmpQI = 0; maxIndex = 0; @@ -674,11 +673,11 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon, if ((maxCard < qiMajority)) { //ARB: change &wFace to wFace and use reference in called function tmpQI = computeVisibility<G, I>(ioViewMap, fe, grid, epsilon, *ve, &wFace, &foundOccluders); - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\tFEdge: visibility " << tmpQI << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\tFEdge: visibility " << tmpQI << endl; + } +#endif //ARB: This is an error condition, not an alert condition. // Some sort of recovery or abort is necessary. @@ -697,11 +696,11 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon, //ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called //ARB: change &wFace to wFace and use reference in called function findOccludee<G, I>(fe, grid, epsilon, *ve, &wFace); - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\tFEdge: occludee only (" << (wFace != NULL ? "found" : "not found") << ")" << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\tFEdge: occludee only (" << (wFace != NULL ? "found" : "not found") << ")" << endl; + } +#endif } // Store test results @@ -715,11 +714,11 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon, fe->setaFace(poly); wFaces.push_back(wFace); fe->setOccludeeEmpty(false); - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\tFound occludee" << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\tFound occludee" << endl; + } +#endif } else { fe->setOccludeeEmpty(true); @@ -729,11 +728,11 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon, fe = fe->nextEdge(); } while ((maxCard < qiMajority) && (fe) && (fe != festart)); - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\tFinished with " << nSamples << " samples, maxCard = " << maxCard << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\tFinished with " << nSamples << " samples, maxCard = " << maxCard << endl; + } +#endif // ViewEdge // qi -- @@ -744,11 +743,11 @@ static void computeDetailedVisibility(ViewMap *ioViewMap, G& grid, real epsilon, for (set<ViewShape*>::iterator o = foundOccluders.begin(), oend = foundOccluders.end(); o != oend; ++o) { (*ve)->AddOccluder((*o)); } - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\tConclusion: QI = " << maxIndex << ", " << (*ve)->occluders_size() << " occluders." << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\tConclusion: QI = " << maxIndex << ", " << (*ve)->occluders_size() << " occluders." << endl; + } +#endif // occludee -- if (!wFaces.empty()) { if (wFaces.size() <= (float)nSamples / 2.0f) { @@ -960,7 +959,8 @@ void ViewMapBuilder::BuildGrid(WingedEdge& we, const BBox<Vec3r>& bbox, unsigned Vec3r size; for (unsigned int i = 0; i < 3; i++) { size[i] = fabs(bbox.getMax()[i] - bbox.getMin()[i]); - size[i] += size[i]/10.0; // let make the grid 1/10 bigger to avoid numerical errors while computing triangles/cells intersections + // let make the grid 1/10 bigger to avoid numerical errors while computing triangles/cells intersections. + size[i] += size[i] / 10.0; if (size[i] == 0) { if (_global.debug & G_DEBUG_FREESTYLE) { cout << "Warning: the bbox size is 0 in dimension " << i << endl; @@ -1039,8 +1039,8 @@ void ViewMapBuilder::CullViewEdges(ViewMap *ioViewMap, real viewProscenium[4], r prosceniumOrigin[1] = (viewProscenium[3] - viewProscenium[2]) / 2.0; if (_global.debug & G_DEBUG_FREESTYLE) { cout << "Proscenium culling:" << endl; - cout << "Proscenium: [" << viewProscenium[0] << ", " << viewProscenium[1] << ", " << viewProscenium[2] - << ", " << viewProscenium[3] << "]"<< endl; + cout << "Proscenium: [" << viewProscenium[0] << ", " << viewProscenium[1] << ", " << viewProscenium[2] << + ", " << viewProscenium[3] << "]"<< endl; cout << "Origin: [" << prosceniumOrigin[0] << ", " << prosceniumOrigin[1] << "]"<< endl; } @@ -1263,7 +1263,7 @@ void ViewMapBuilder::computeCusps(ViewMap *ioViewMap) // creates and insert cusp cusp = dynamic_cast<NonTVertex*>(ioViewMap->InsertViewVertex(fes->vertexA(), newVEdges)); if (cusp) - cusp->setNature(cusp->getNature()|Nature::CUSP); + cusp->setNature(cusp->getNature() | Nature::CUSP); } } else { @@ -1272,7 +1272,7 @@ void ViewMapBuilder::computeCusps(ViewMap *ioViewMap) positive = true; cusp = dynamic_cast<NonTVertex*>(ioViewMap->InsertViewVertex(fes->vertexA(), newVEdges)); if (cusp) - cusp->setNature(cusp->getNature()|Nature::CUSP); + cusp->setNature(cusp->getNature() | Nature::CUSP); } } fe = fe->nextEdge(); @@ -1351,7 +1351,7 @@ void ViewMapBuilder::ComputeDetailedVisibility(ViewMap *ioViewMap, WingedEdge& w void ViewMapBuilder::ComputeEdgesVisibility(ViewMap *ioViewMap, WingedEdge& we, const BBox<Vec3r>& bbox, unsigned int sceneNumFaces, visibility_algo iAlgo, real epsilon) { - switch(iAlgo) { + switch (iAlgo) { case ray_casting: if (_global.debug & G_DEBUG_FREESTYLE) { cout << "Using ordinary ray casting" << endl; @@ -1469,11 +1469,11 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo for (vector<ViewEdge*>::iterator ve = vedges.begin(), veend = vedges.end(); ve != veend; ve++) { if (_pRenderMonitor && _pRenderMonitor->testBreak()) break; - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "Processing ViewEdge " << (*ve)->getId() << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "Processing ViewEdge " << (*ve)->getId() << endl; + } +#endif festart = (*ve)->fedgeA(); fe = (*ve)->fedgeA(); qiMajority = 1; @@ -1482,11 +1482,11 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo fe = fe->nextEdge(); } while (fe && fe != festart); qiMajority >>= 1; - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\tqiMajority: " << qiMajority << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\tqiMajority: " << qiMajority << endl; + } +#endif tmpQI = 0; maxIndex = 0; @@ -1499,11 +1499,11 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo if ((maxCard < qiMajority)) { tmpQI = ComputeRayCastingVisibility(fe, _Grid, epsilon, occluders, &aFace, timestamp++); - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\tFEdge: visibility " << tmpQI << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\tFEdge: visibility " << tmpQI << endl; + } +#endif //ARB: This is an error condition, not an alert condition. // Some sort of recovery or abort is necessary. if (tmpQI >= 256) { @@ -1520,22 +1520,22 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo else { //ARB: FindOccludee is redundant if ComputeRayCastingVisibility has been called FindOccludee(fe, _Grid, epsilon, &aFace, timestamp++); - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\tFEdge: occludee only (" << (aFace != NULL ? "found" : "not found") << ")" << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\tFEdge: occludee only (" << (aFace != NULL ? "found" : "not found") << ")" << endl; + } +#endif } if (aFace) { fe->setaFace(*aFace); aFaces.push_back(aFace); fe->setOccludeeEmpty(false); - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\tFound occludee" << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\tFound occludee" << endl; + } +#endif } else { //ARB: We are arbitrarily using the last observed value for occludee (almost always the value observed @@ -1547,11 +1547,11 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo ++nSamples; fe = fe->nextEdge(); } while ((maxCard < qiMajority) && (fe) && (fe != festart)); - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\tFinished with " << nSamples << " samples, maxCard = " << maxCard << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\tFinished with " << nSamples << " samples, maxCard = " << maxCard << endl; + } +#endif // ViewEdge // qi -- @@ -1559,11 +1559,11 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo // occluders -- for (set<ViewShape*>::iterator o = occluders.begin(), oend = occluders.end(); o != oend; ++o) (*ve)->AddOccluder((*o)); - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\tConclusion: QI = " << maxIndex << ", " << (*ve)->occluders_size() << " occluders." << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\tConclusion: QI = " << maxIndex << ", " << (*ve)->occluders_size() << " occluders." << endl; + } +#endif // occludee -- if (!aFaces.empty()) { if (aFaces.size() <= (float)nSamples / 2.0f) { @@ -1571,7 +1571,7 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo } else { vector<Polygon3r*>::iterator p = aFaces.begin(); - WFace *wface = (WFace*)((*p)->userdata); + WFace *wface = (WFace *)((*p)->userdata); ViewShape *vshape = ioViewMap->viewShape(wface->GetVertex(0)->shape()->GetId()); ++p; (*ve)->setaShape(vshape); @@ -1686,7 +1686,7 @@ void ViewMapBuilder::ComputeFastRayCastingVisibility(ViewMap *ioViewMap, real ep } else { vector<Polygon3r*>::iterator p = aFaces.begin(); - WFace *wface = (WFace*)((*p)->userdata); + WFace *wface = (WFace *)((*p)->userdata); ViewShape *vshape = ioViewMap->viewShape(wface->GetVertex(0)->shape()->GetId()); ++p; #if 0 @@ -1750,7 +1750,7 @@ void ViewMapBuilder::ComputeVeryFastRayCastingVisibility(ViewMap *ioViewMap, rea qi = ComputeRayCastingVisibility(fe, _Grid, epsilon, occluders, &aFace, timestamp++); if (aFace) { fe->setaFace(*aFace); - WFace *wface = (WFace*)(aFace->userdata); + WFace *wface = (WFace *)(aFace->userdata); ViewShape *vshape = ioViewMap->viewShape(wface->GetVertex(0)->shape()->GetId()); (*ve)->setaShape(vshape); } @@ -1776,7 +1776,7 @@ void ViewMapBuilder::FindOccludee(FEdge *fe, Grid *iGrid, real epsilon, Polygon3 WFace *face = NULL; if (fe->isSmooth()) { FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth*>(fe); - face = (WFace*)fes->face(); + face = (WFace *)fes->face(); } OccludersSet occluders; WFace *oface; @@ -1799,7 +1799,7 @@ void ViewMapBuilder::FindOccludee(FEdge *fe, Grid *iGrid, real epsilon, Polygon3 // check whether the edge and the polygon plane are coincident: //------------------------------------------------------------- //first let us compute the plane equation. - oface = (WFace*)(*p)->userdata; + oface = (WFace *)(*p)->userdata; Vec3r v1(((*p)->getVertices())[0]); Vec3r normal((*p)->getNormal()); real d = -(v1 * normal); @@ -1880,15 +1880,15 @@ void ViewMapBuilder::FindOccludee(FEdge *fe, Grid *iGrid, real epsilon, Polygon3 } u.normalize(); if (A < iGrid->getOrigin()) - cerr << "Warning: point is out of the grid for fedge " << fe->getId().getFirst() << "-" - << fe->getId().getSecond() << endl; + cerr << "Warning: point is out of the grid for fedge " << fe->getId().getFirst() << "-" << + fe->getId().getSecond() << endl; vector<WVertex*> faceVertices; WFace *face = NULL; if (fe->isSmooth()) { FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth*>(fe); - face = (WFace*)fes->face(); + face = (WFace *)fes->face(); } if (face) face->RetrieveVertexList(faceVertices); @@ -1914,7 +1914,8 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, Grid *iGrid, real eps Vec3r gridExtremity(iGrid->getOrigin() + iGrid->gridSize()); if ((center.x() < gridOrigin.x()) || (center.y() < gridOrigin.y()) || (center.z() < gridOrigin.z()) || - (center.x() > gridExtremity.x()) || (center.y() > gridExtremity.y()) || (center.z() > gridExtremity.z())) { + (center.x() > gridExtremity.x()) || (center.y() > gridExtremity.y()) || (center.z() > gridExtremity.z())) + { cerr << "Warning: point is out of the grid for fedge " << fe->getId() << endl; //return 0; } @@ -1953,10 +1954,10 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, Grid *iGrid, real eps WFace *face = NULL; if (fe->isSmooth()) { - FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth*>(fe); - face = (WFace*)fes->face(); + FEdgeSmooth *fes = dynamic_cast<FEdgeSmooth *>(fe); + face = (WFace *)fes->face(); } - vector<WVertex*> faceVertices; + vector<WVertex *> faceVertices; WVertex::incoming_edge_iterator ie; WFace *oface; @@ -1969,40 +1970,40 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, Grid *iGrid, real eps // If we're dealing with an exact silhouette, check whether we must take care of this occluder of not. // (Indeed, we don't consider the occluders that share at least one vertex with the face containing this edge). //----------- - oface = (WFace*)(*p)->userdata; - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\t\tEvaluating intersection for occluder " << ((*p)->getVertices())[0] << ((*p)->getVertices())[1] - << ((*p)->getVertices())[2] << endl << "\t\t\tand ray " << vp << " * " << u << " (center " << center - << ")" << endl; - } - #endif + oface = (WFace *)(*p)->userdata; +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\t\tEvaluating intersection for occluder " << ((*p)->getVertices())[0] << + ((*p)->getVertices())[1] << ((*p)->getVertices())[2] << endl << "\t\t\tand ray " << vp << + " * " << u << " (center " << center << ")" << endl; + } +#endif Vec3r v1(((*p)->getVertices())[0]); Vec3r normal((*p)->getNormal()); real d = -(v1 * normal); real t, t_u, t_v; - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\t\tp: " << ((*p)->getVertices())[0] << ((*p)->getVertices())[1] << ((*p)->getVertices())[2] - << ", norm: " << (*p)->getNormal() << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\t\tp: " << ((*p)->getVertices())[0] << ((*p)->getVertices())[1] << ((*p)->getVertices())[2] << + ", norm: " << (*p)->getNormal() << endl; + } +#endif if (face) { - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\t\tDetermining face adjacency..."; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\t\tDetermining face adjacency..."; + } +#endif skipFace = false; if (face == oface) { - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << " Rejecting occluder for face concurrency." << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << " Rejecting occluder for face concurrency." << endl; + } +#endif continue; } @@ -2031,11 +2032,11 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, Grid *iGrid, real eps break; } if (skipFace) { - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << " Rejecting occluder for face adjacency." << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << " Rejecting occluder for face adjacency." << endl; + } +#endif continue; } } @@ -2045,31 +2046,31 @@ int ViewMapBuilder::ComputeRayCastingVisibility(FEdge *fe, Grid *iGrid, real eps //first let us compute the plane equation. if (GeomUtils::COINCIDENT == GeomUtils::intersectRayPlane(origin, edge, normal, d, t, epsilon)) { - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\t\tRejecting occluder for target coincidence." << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\t\tRejecting occluder for target coincidence." << endl; + } +#endif continue; } } if ((*p)->rayIntersect(center, u, t, t_u, t_v)) { - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\t\tRay " << vp << " * " << u << " intersects at time " << t << " (raylength is " - << raylength << ")" << endl; - cout << "\t\t(u * normal) == " << (u * normal) << " for normal " << normal << endl; - } - #endif +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\t\tRay " << vp << " * " << u << " intersects at time " << t << " (raylength is " << + raylength << ")" << endl; + cout << "\t\t(u * normal) == " << (u * normal) << " for normal " << normal << endl; + } +#endif if (fabs(u * normal) > 0.0001) { if ((t>0.0) && (t<raylength)) { - #if LOGGING - if (_global.debug & G_DEBUG_FREESTYLE) { - cout << "\t\tIs occluder" << endl; - } - #endif - WFace *f = (WFace*)((*p)->userdata); +#if LOGGING + if (_global.debug & G_DEBUG_FREESTYLE) { + cout << "\t\tIs occluder" << endl; + } +#endif + WFace *f = (WFace *)((*p)->userdata); ViewShape *vshape = _ViewMap->viewShape(f->GetVertex(0)->shape()->GetId()); oOccluders.insert(vshape); ++qi; @@ -2101,7 +2102,7 @@ void ViewMapBuilder::ComputeIntersections(ViewMap *ioViewMap, intersection_algo ++vv) { if ((*vv)->getNature() == Nature::T_VERTEX) { - TVertex *tvertex = (TVertex*)(*vv); + TVertex *tvertex = (TVertex *)(*vv); if (_global.debug & G_DEBUG_FREESTYLE) { cout << "TVertex " << tvertex->getId() << " has :" << endl; cout << "FrontEdgeA: " << tvertex->frontEdgeA().first << endl; @@ -2113,11 +2114,11 @@ void ViewMapBuilder::ComputeIntersections(ViewMap *ioViewMap, intersection_algo } } -struct less_SVertex2D : public binary_function<SVertex*, SVertex*, bool> +struct less_SVertex2D : public binary_function<SVertex *, SVertex *, bool> { real epsilon; - less_SVertex2D(real eps) : binary_function<SVertex*, SVertex*, bool>() + less_SVertex2D(real eps) : binary_function<SVertex *, SVertex *, bool>() { epsilon = eps; } @@ -2138,14 +2139,14 @@ struct less_SVertex2D : public binary_function<SVertex*, SVertex*, bool> } }; -typedef Segment<FEdge*, Vec3r> segment; +typedef Segment<FEdge *, Vec3r> segment; typedef Intersection<segment> intersection; -struct less_Intersection : public binary_function<intersection*, intersection*, bool> +struct less_Intersection : public binary_function<intersection *, intersection *, bool> { segment *edge; - less_Intersection(segment *iEdge) : binary_function<intersection*, intersection*, bool>() + less_Intersection(segment *iEdge) : binary_function<intersection *, intersection *, bool>() { edge = iEdge; } @@ -2162,7 +2163,7 @@ struct less_Intersection : public binary_function<intersection*, intersection*, struct silhouette_binary_rule : public binary_rule<segment, segment> { - silhouette_binary_rule() : binary_rule<segment,segment>() {} + silhouette_binary_rule() : binary_rule<segment, segment>() {} virtual bool operator()(segment& s1, segment& s2) { @@ -2181,7 +2182,7 @@ struct silhouette_binary_rule : public binary_rule<segment, segment> void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsilon) { - vector<SVertex*>& svertices = ioViewMap->SVertices(); + vector<SVertex *>& svertices = ioViewMap->SVertices(); bool progressBarDisplay = false; unsigned sVerticesSize = svertices.size(); unsigned fEdgesSize = ioViewMap->FEdges().size(); @@ -2209,9 +2210,9 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi sort(svertices.begin(), svertices.end(), less_SVertex2D(epsilon)); - SweepLine<FEdge*, Vec3r> SL; + SweepLine<FEdge *, Vec3r> SL; - vector<FEdge*>& ioEdges = ioViewMap->FEdges(); + vector<FEdge *>& ioEdges = ioViewMap->FEdges(); vector<segment*> segments; @@ -2230,8 +2231,8 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi const vector<FEdge*>& vedges = (*sv)->fedges(); - for (vector<FEdge*>::const_iterator sve = vedges.begin(), sveend = vedges.end(); sve != sveend; sve++) { - vsegments.push_back((segment*)((*sve)->userdata)); + for (vector<FEdge *>::const_iterator sve = vedges.begin(), sveend = vedges.end(); sve != sveend; sve++) { + vsegments.push_back((segment *)((*sve)->userdata)); } Vec3r evt((*sv)->point2D()); @@ -2291,24 +2292,24 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi real ta = (*i)->tA; real tb = (*i)->tB; - if ((ta < -epsilon) || (ta > 1+epsilon)) - cerr << "Warning: 2D intersection out of range for edge " << fA->vertexA()->getId() << " - " - << fA->vertexB()->getId() << endl; + if ((ta < -epsilon) || (ta > 1 + epsilon)) + cerr << "Warning: 2D intersection out of range for edge " << fA->vertexA()->getId() << " - " << + fA->vertexB()->getId() << endl; - if ((tb < -epsilon) || (tb > 1+epsilon)) - cerr << "Warning: 2D intersection out of range for edge " << fB->vertexA()->getId() << " - " - << fB->vertexB()->getId() << endl; + if ((tb < -epsilon) || (tb > 1 + epsilon)) + cerr << "Warning: 2D intersection out of range for edge " << fB->vertexA()->getId() << " - " << + fB->vertexB()->getId() << endl; real Ta = SilhouetteGeomEngine::ImageToWorldParameter(fA, ta); real Tb = SilhouetteGeomEngine::ImageToWorldParameter(fB, tb); if ((Ta < -epsilon) || (Ta > 1 + epsilon)) - cerr << "Warning: 3D intersection out of range for edge " << fA->vertexA()->getId() << " - " - << fA->vertexB()->getId() << endl; + cerr << "Warning: 3D intersection out of range for edge " << fA->vertexA()->getId() << " - " << + fA->vertexB()->getId() << endl; if ((Tb < -epsilon) || (Tb > 1 + epsilon)) - cerr << "Warning: 3D intersection out of range for edge " << fB->vertexA()->getId() << " - " - << fB->vertexB()->getId() << endl; + cerr << "Warning: 3D intersection out of range for edge " << fB->vertexA()->getId() << " - " << + fB->vertexB()->getId() << endl; #if 0 if (G.debug & G_DEBUG_FREESTYLE) { @@ -2364,7 +2365,7 @@ void ViewMapBuilder::ComputeSweepLineIntersections(ViewMap *ioViewMap, real epsi // we first need to sort these intersections from farther to closer to A sort(eIntersections.begin(), eIntersections.end(), less_Intersection(*s)); for (i = eIntersections.begin(), iend = eIntersections.end(); i != iend; i++) - edgeVVertices.push_back((TVertex*)(*i)->userdata); + edgeVVertices.push_back((TVertex *)(*i)->userdata); shape->SplitEdge(fedge, edgeVVertices, ioViewMap->FEdges(), ioViewMap->ViewEdges()); diff --git a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp index 0e0e02dcaee..33daf5a7886 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapIO.cpp +++ b/source/blender/freestyle/intern/view_map/ViewMapIO.cpp @@ -63,7 +63,7 @@ namespace ViewMapIO { namespace Internal { -ViewMap* g_vm; +ViewMap *g_vm; //////////////////// 'load' Functions //////////////////// @@ -1073,7 +1073,7 @@ int load(istream& in, ViewMap *vm, ProgressBar *pb) // Read the shape id to index mapping unsigned map_s; READ(map_s); - unsigned id,index; + unsigned id, index; for (unsigned int i4 = 0; i4 < map_s; ++i4) { READ(id); READ(index); diff --git a/source/blender/freestyle/intern/view_map/ViewMapIO.h b/source/blender/freestyle/intern/view_map/ViewMapIO.h index 44521f03317..6a7268a71a9 100644 --- a/source/blender/freestyle/intern/view_map/ViewMapIO.h +++ b/source/blender/freestyle/intern/view_map/ViewMapIO.h @@ -96,7 +96,7 @@ ostream& write<1>(ostream& out, const char *str) } template<> -ostream& write<0>(ostream& out, const char*) +ostream& write<0>(ostream& out, const char *) { return out; } @@ -115,7 +115,7 @@ istream& read<1>(istream& in, char *str) } template<> -istream& read<0>(istream& in, char*) +istream& read<0>(istream& in, char *) { return in; } diff --git a/source/blender/freestyle/intern/winged_edge/Curvature.cpp b/source/blender/freestyle/intern/winged_edge/Curvature.cpp index 64b897c5596..5cf45a2a934 100644 --- a/source/blender/freestyle/intern/winged_edge/Curvature.cpp +++ b/source/blender/freestyle/intern/winged_edge/Curvature.cpp @@ -64,8 +64,8 @@ static bool angle_obtuse(WVertex *v, WFace *f) WOEdge *e; f->getOppositeEdge(v, e); - Vec3r vec1(e->GetaVertex()->GetVertex()-v->GetVertex()); - Vec3r vec2(e->GetbVertex()->GetVertex()-v->GetVertex()); + Vec3r vec1(e->GetaVertex()->GetVertex() - v->GetVertex()); + Vec3r vec2(e->GetbVertex()->GetVertex() - v->GetVertex()); return ((vec1 * vec2) < 0); } @@ -147,12 +147,12 @@ bool gts_vertex_mean_curvature_normal(WVertex *v, Vec3r &Kh) WVertex::incoming_edge_iterator itE; - for (itE=v->incoming_edges_begin(); itE != v->incoming_edges_end(); itE++) + for (itE = v->incoming_edges_begin(); itE != v->incoming_edges_end(); itE++) area += (*itE)->GetaFace()->getArea(); Kh = Vec3r(0.0, 0.0, 0.0); - for (itE=v->incoming_edges_begin(); itE != v->incoming_edges_end(); itE++) { + for (itE = v->incoming_edges_begin(); itE != v->incoming_edges_end(); itE++) { WOEdge *e = (*itE)->getPrevOnFace(); #if 0 if ((e->GetaVertex() == v) || (e->GetbVertex() == v)) @@ -348,12 +348,12 @@ void gts_vertex_principal_directions(WVertex *v, Vec3r Kh, real Kg, Vec3r &e1, V aterm_da = bterm_da = cterm_da = const_da = 0.0; aterm_db = bterm_db = cterm_db = const_db = 0.0; - int nb_edges=v->GetEdges().size(); + int nb_edges = v->GetEdges().size(); - weights = (real *)malloc(sizeof (real) * nb_edges); - kappas = (real *)malloc(sizeof (real) * nb_edges); - d1s = (real *)malloc(sizeof (real) * nb_edges); - d2s = (real *)malloc(sizeof (real) * nb_edges); + weights = (real *)malloc(sizeof(real) * nb_edges); + kappas = (real *)malloc(sizeof(real) * nb_edges); + d1s = (real *)malloc(sizeof(real) * nb_edges); + d2s = (real *)malloc(sizeof(real) * nb_edges); edge_count = 0; for (itE = v->incoming_edges_begin(); itE != v->incoming_edges_end(); itE++) { diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.cpp b/source/blender/freestyle/intern/winged_edge/WEdge.cpp index 6201d23f9bf..b3ac888361b 100644 --- a/source/blender/freestyle/intern/winged_edge/WEdge.cpp +++ b/source/blender/freestyle/intern/winged_edge/WEdge.cpp @@ -314,7 +314,7 @@ WOEdge *WFace::MakeEdge(WVertex *v1, WVertex *v2) // Adds the edge to the face //AddEdge((*it1)->GetaOEdge()); AddEdge(woea); - (*it1)->setNumberOfOEdges((*it1)->GetNumberOfOEdges()+1); + (*it1)->setNumberOfOEdges((*it1)->GetNumberOfOEdges() + 1); //sets these vertices as border: v1->setBorder(true); v2->setBorder(true); @@ -330,7 +330,7 @@ WOEdge *WFace::MakeEdge(WVertex *v1, WVertex *v2) // Adds the edge to the face //AddEdge((*it1)->GetaOEdge()); AddEdge(woeb); - (*it1)->setNumberOfOEdges((*it1)->GetNumberOfOEdges()+1); + (*it1)->setNumberOfOEdges((*it1)->GetNumberOfOEdges() + 1); //sets these vertices as border: v1->setBorder(true); v2->setBorder(true); @@ -402,7 +402,7 @@ WOEdge *WFace::MakeEdge(WVertex *v1, WVertex *v2) } -bool WFace::getOppositeEdge (const WVertex *v, WOEdge *&e) +bool WFace::getOppositeEdge(const WVertex *v, WOEdge *&e) { if (_OEdgeList.size() != 3) return false; @@ -441,7 +441,7 @@ real WFace::getArea () } -WOEdge *WFace::GetPrevOEdge(WOEdge* iOEdge) +WOEdge *WFace::GetPrevOEdge(WOEdge *iOEdge) { vector<WOEdge *>::iterator woe, woend, woefirst; woefirst = _OEdgeList.begin(); @@ -645,7 +645,8 @@ WFace *WShape::MakeFace(vector<WVertex *>& iVertexList, vector<bool>& iFaceEdgeM if (3 == iVertexList.size()) { if ((iVertexList[0] == iVertexList[1]) || (iVertexList[0] == iVertexList[2]) || - (iVertexList[2] == iVertexList[1])) { + (iVertexList[2] == iVertexList[1])) + { cerr << "Warning: degenerated triangle detected, correcting" << endl; return NULL; } diff --git a/source/blender/freestyle/intern/winged_edge/WEdge.h b/source/blender/freestyle/intern/winged_edge/WEdge.h index be9181329d6..1646d995a22 100644 --- a/source/blender/freestyle/intern/winged_edge/WEdge.h +++ b/source/blender/freestyle/intern/winged_edge/WEdge.h @@ -235,7 +235,7 @@ public: virtual bool operator==(const incoming_edge_iterator& b) const { - return ((_current)== (b._current)); + return ((_current) == (b._current)); } // dereferencing @@ -311,7 +311,7 @@ public: virtual bool operator==(const face_iterator& b) const { - return ((_edge_it)== (b._edge_it)); + return ((_edge_it) == (b._edge_it)); } // dereferencing @@ -973,7 +973,7 @@ public: /*! For triangles, returns the edge opposite to the vertex in e. * returns flase if the face is not a triangle or if the vertex is not found */ - bool getOppositeEdge (const WVertex *v, WOEdge* &e); + bool getOppositeEdge (const WVertex *v, WOEdge *&e); /*! compute the area of the face */ real getArea (); diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp index 719ed10925d..6190318e415 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp +++ b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp @@ -59,7 +59,7 @@ unsigned int WXFaceLayer::GetSmoothEdgeIndex() const int i = 0; int nEdges = _pWXFace->numberOfEdges(); for (i = 0; i < nEdges; ++i) { - if ((_DotP[i] == 0) && (_DotP[(i+1)%nEdges] == 0)) { + if ((_DotP[i] == 0) && (_DotP[(i + 1) % nEdges] == 0)) { return i; } } diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.h b/source/blender/freestyle/intern/winged_edge/WXEdge.h index 9f3522e4e70..cb111dd516c 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdge.h +++ b/source/blender/freestyle/intern/winged_edge/WXEdge.h @@ -765,13 +765,13 @@ public: // Reset Edges vector<WEdge *>& wedges = getEdgeList(); for (vector<WEdge *>::iterator we = wedges.begin(), weend = wedges.end(); we != weend; ++we) { - ((WXEdge*)(*we))->Reset(); + ((WXEdge *)(*we))->Reset(); } //Reset faces: vector<WFace *>& wfaces = GetFaceList(); for (vector<WFace *>::iterator wf = wfaces.begin(), wfend = wfaces.end(); wf != wfend; ++wf) { - ((WXFace*)(*wf))->Reset(); + ((WXFace *)(*wf))->Reset(); } } /*! accessors */ diff --git a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp index 51e93f34fa3..772a88a05af 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp +++ b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp @@ -25,7 +25,7 @@ * ***** END GPL LICENSE BLOCK ***** */ -/** \file blender/freestyle/intern/winged_edge/WSBuilder.cpp +/** \file blender/freestyle/intern/winged_edge/WXEdgeBuilder.cpp * \ingroup freestyle * \brief Class inherited from WingedEdgeBuilder and designed to build a WX (WingedEdge + extended info * (silhouette etc...)) structure from a polygonal model diff --git a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.h b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.h index 91e9b389f7c..690126c533e 100644 --- a/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.h +++ b/source/blender/freestyle/intern/winged_edge/WXEdgeBuilder.h @@ -28,7 +28,7 @@ #ifndef __FREESTYLE_WX_EDGE_BUILDER_H__ #define __FREESTYLE_WX_EDGE_BUILDER_H__ -/** \file blender/freestyle/intern/winged_edge/WSBuilder.h +/** \file blender/freestyle/intern/winged_edge/WXEdgeBuilder.h * \ingroup freestyle * \brief Class inherited from WingedEdgeBuilder and designed to build a WX (WingedEdge + extended info * (silhouette etc...)) structure from a polygonal model diff --git a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp index 4ef34bbe3ee..c1a93f70a7e 100644 --- a/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp +++ b/source/blender/freestyle/intern/winged_edge/WingedEdgeBuilder.cpp @@ -199,7 +199,7 @@ void WingedEdgeBuilder::buildWShape(WShape& shape, IndexedFaceSet& ifs) break; } } - if (normalsSet.size() !=1 ) { + if (normalsSet.size() != 1) { (*wv)->setSmooth(false); } } |