diff options
author | Julian Eisel <julian@blender.org> | 2022-11-10 15:17:42 +0300 |
---|---|---|
committer | Julian Eisel <julian@blender.org> | 2022-11-10 15:17:42 +0300 |
commit | 7246c387435769a169ac24c91434c615df6434b4 (patch) | |
tree | 61842e3e0ce85e80720fdd7476d44d2e629f59fd /source/blender/freestyle/intern/stroke | |
parent | c5f55d17096d373791363e46004176e3f7f7ae52 (diff) | |
parent | 0b4bd3ddc016298e868169a541cf6c132b10c587 (diff) |
Merge branch 'master' into asset-browser-grid-viewasset-browser-grid-view
Diffstat (limited to 'source/blender/freestyle/intern/stroke')
14 files changed, 98 insertions, 87 deletions
diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp b/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp index 0bd2b960de3..37f5fb5cfbb 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp @@ -25,13 +25,13 @@ int DensityF0D::operator()(Interface0DIterator &iter) } RGBImage image; - canvas->readColorPixels((int)iter->getProjectedX() - bound, - (int)iter->getProjectedY() - bound, + canvas->readColorPixels(int(iter->getProjectedX()) - bound, + int(iter->getProjectedY()) - bound, _filter.maskSize(), _filter.maskSize(), image); result = _filter.getSmoothedPixel<RGBImage>( - &image, (int)iter->getProjectedX(), (int)iter->getProjectedY()); + &image, int(iter->getProjectedX()), int(iter->getProjectedY())); return 0; } @@ -48,13 +48,13 @@ int LocalAverageDepthF0D::operator()(Interface0DIterator &iter) } 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()); + &image, int(iter->getProjectedX()), int(iter->getProjectedY())); return 0; } @@ -63,7 +63,7 @@ int ReadMapPixelF0D::operator()(Interface0DIterator &iter) { Canvas *canvas = Canvas::getInstance(); result = canvas->readMapPixel( - _mapName, _level, (int)iter->getProjectedX(), (int)iter->getProjectedY()); + _mapName, _level, int(iter->getProjectedX()), int(iter->getProjectedY())); return 0; } @@ -71,7 +71,7 @@ int ReadSteerableViewMapPixelF0D::operator()(Interface0DIterator &iter) { SteerableViewMap *svm = Canvas::getInstance()->getSteerableViewMap(); result = svm->readSteerableViewMapPixel( - _orientation, _level, (int)iter->getProjectedX(), (int)iter->getProjectedY()); + _orientation, _level, int(iter->getProjectedX()), int(iter->getProjectedY())); return 0; } @@ -79,7 +79,7 @@ int ReadCompleteViewMapPixelF0D::operator()(Interface0DIterator &iter) { SteerableViewMap *svm = Canvas::getInstance()->getSteerableViewMap(); result = svm->readCompleteViewMapPixel( - _level, (int)iter->getProjectedX(), (int)iter->getProjectedY()); + _level, int(iter->getProjectedX()), int(iter->getProjectedY())); return 0; } @@ -87,12 +87,12 @@ int GetViewMapGradientNormF0D::operator()(Interface0DIterator &iter) { SteerableViewMap *svm = Canvas::getInstance()->getSteerableViewMap(); float pxy = svm->readCompleteViewMapPixel( - _level, (int)iter->getProjectedX(), (int)iter->getProjectedY()); + _level, int(iter->getProjectedX()), int(iter->getProjectedY())); float gx = svm->readCompleteViewMapPixel( - _level, (int)iter->getProjectedX() + _step, (int)iter->getProjectedY()) - + _level, int(iter->getProjectedX()) + _step, int(iter->getProjectedY())) - pxy; float gy = svm->readCompleteViewMapPixel( - _level, (int)iter->getProjectedX(), (int)iter->getProjectedY() + _step) - + _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 a759cc333f1..a221e0e8bbd 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp @@ -10,6 +10,8 @@ #include "../view_map/SteerableViewMap.h" +#include "BLI_sys_types.h" + namespace Freestyle::Functions1D { int GetSteerableViewMapDensityF1D::operator()(Interface1D &inter) @@ -19,7 +21,7 @@ int GetSteerableViewMapDensityF1D::operator()(Interface1D &inter) Interface0DIterator itnext = it; ++itnext; FEdge *fe; - unsigned nSVM; + uint nSVM; vector<float> values; while (!itnext.isEnd()) { @@ -38,14 +40,14 @@ int GetSteerableViewMapDensityF1D::operator()(Interface1D &inter) } Vec2r m((i0D.getProjectedX() + i0Dnext.getProjectedX()) / 2.0, (i0D.getProjectedY() + i0Dnext.getProjectedY()) / 2.0); - values.push_back(svm->readSteerableViewMapPixel(nSVM, _level, (int)m[0], (int)m[1])); + values.push_back(svm->readSteerableViewMapPixel(nSVM, _level, int(m[0]), int(m[1]))); ++it; ++itnext; } float res, res_tmp; vector<float>::iterator v = values.begin(), vend = values.end(); - unsigned size = 1; + uint size = 1; switch (_integration) { case MIN: res = *v; diff --git a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h index c19ac31ae4a..e5009f2b4f8 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h +++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.h @@ -33,7 +33,7 @@ class DensityF1D : public UnaryFunction1D<double> { public: /** Builds the functor. * \param sigma: - * Thesigma used in DensityF0D and determining the window size used in each density query. + * The sigma used in DensityF0D and determining the window size used in each density query. * \param iType: * The integration method used to compute a single value from a set of values. * \param sampling: diff --git a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp index 5530026b7ec..6508c95f2b4 100644 --- a/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp +++ b/source/blender/freestyle/intern/stroke/AdvancedStrokeShaders.cpp @@ -11,6 +11,8 @@ #include "../system/PseudoNoise.h" #include "../system/RandGen.h" +#include "BLI_sys_types.h" + namespace Freestyle { ///////////////////////////////////////// @@ -71,7 +73,7 @@ int CalligraphicShader::shade(Stroke &ioStroke) const // ///////////////////////////////////////// -static const unsigned NB_VALUE_NOISE = 512; +static const uint NB_VALUE_NOISE = 512; SpatialNoiseShader::SpatialNoiseShader( float iAmount, float ixScale, int nbOctave, bool smooth, bool pureRandom) diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp index c801dc70114..e77ba63f3d6 100644 --- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp +++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp @@ -23,6 +23,8 @@ #include "BKE_global.h" +#include "BLI_sys_types.h" + #include "IMB_imbuf.h" #include "IMB_imbuf_types.h" @@ -80,11 +82,11 @@ int IncreasingThicknessShader::shade(Stroke &stroke) const for (i = 0, v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v, ++i) { float t; - if (i < (float)n / 2.0f) { - t = (1.0 - (float)i / (float)n) * _ThicknessMin + (float)i / (float)n * _ThicknessMax; + if (i < float(n) / 2.0f) { + t = (1.0 - float(i) / float(n)) * _ThicknessMin + float(i) / float(n) * _ThicknessMax; } else { - t = (1.0 - (float)i / (float)n) * _ThicknessMax + (float)i / (float)n * _ThicknessMin; + t = (1.0 - float(i) / float(n)) * _ThicknessMax + float(i) / float(n) * _ThicknessMin; } v->attribute().setThickness(t / 2.0, t / 2.0); } @@ -102,11 +104,11 @@ int ConstrainedIncreasingThicknessShader::shade(Stroke &stroke) const // XXX Why not using an if/else here? Else, if last condition is true, everything else is // computed for nothing! float t; - if (i < (float)n / 2.0f) { - t = (1.0 - (float)i / (float)n) * _ThicknessMin + (float)i / (float)n * maxT; + if (i < float(n) / 2.0f) { + t = (1.0 - float(i) / float(n)) * _ThicknessMin + float(i) / float(n) * maxT; } else { - t = (1.0 - (float)i / (float)n) * maxT + (float)i / (float)n * _ThicknessMin; + t = (1.0 - float(i) / float(n)) * maxT + float(i) / float(n) * _ThicknessMin; } v->attribute().setThickness(t / 2.0, t / 2.0); if (i == n - 1) { @@ -152,18 +154,18 @@ int LengthDependingThicknessShader::shade(Stroke &stroke) const return 0; } -static const unsigned NB_VALUE_NOISE = 512; +static const uint NB_VALUE_NOISE = 512; ThicknessNoiseShader::ThicknessNoiseShader() { _amplitude = 1.0f; - _scale = 1.0f / 2.0f / (float)NB_VALUE_NOISE; + _scale = 1.0f / 2.0f / float(NB_VALUE_NOISE); } ThicknessNoiseShader::ThicknessNoiseShader(float iAmplitude, float iPeriod) { _amplitude = iAmplitude; - _scale = 1.0f / iPeriod / (float)NB_VALUE_NOISE; + _scale = 1.0f / iPeriod / float(NB_VALUE_NOISE); } int ThicknessNoiseShader::shade(Stroke &stroke) const @@ -213,8 +215,8 @@ int IncreasingColorShader::shade(Stroke &stroke) const for (yo = 0, v = stroke.strokeVerticesBegin(), vend = stroke.strokeVerticesEnd(); v != vend; ++v, ++yo) { for (int i = 0; i < 4; ++i) { - newcolor[i] = (1.0 - (float)yo / (float)n) * _colorMin[i] + - (float)yo / (float)n * _colorMax[i]; + newcolor[i] = (1.0 - float(yo) / float(n)) * _colorMin[i] + + float(yo) / float(n) * _colorMax[i]; } v->attribute().setColor(newcolor[0], newcolor[1], newcolor[2]); v->attribute().setAlpha(newcolor[3]); @@ -243,13 +245,13 @@ int MaterialColorShader::shade(Stroke &stroke) const ColorNoiseShader::ColorNoiseShader() { _amplitude = 1.0f; - _scale = 1.0f / 2.0f / (float)NB_VALUE_NOISE; + _scale = 1.0f / 2.0f / float(NB_VALUE_NOISE); } ColorNoiseShader::ColorNoiseShader(float iAmplitude, float iPeriod) { _amplitude = iAmplitude; - _scale = 1.0f / iPeriod / (float)NB_VALUE_NOISE; + _scale = 1.0f / iPeriod / float(NB_VALUE_NOISE); } int ColorNoiseShader::shade(Stroke &stroke) const @@ -373,7 +375,7 @@ int BezierCurveShader::shade(Stroke &stroke) const ++v; for (vend = stroke.strokeVerticesEnd(); v != vend; ++v) { if (!((fabs(v->x() - (previous)->x()) < M_EPSILON) && - ((fabs(v->y() - (previous)->y()) < M_EPSILON)))) { + (fabs(v->y() - (previous)->y()) < M_EPSILON))) { data.emplace_back(v->x(), v->y()); } previous = v; @@ -395,7 +397,7 @@ int BezierCurveShader::shade(Stroke &stroke) const p = segmentsVertices.begin(); ++p; for (pend = segmentsVertices.end(); p != pend; ++p) { - CurveVertices.push_back((*p)); + CurveVertices.push_back(*p); } } @@ -467,7 +469,7 @@ int BezierCurveShader::shade(Stroke &stroke) const vector<StrokeAttribute>::iterator a = attributes.begin(), aend = attributes.end(); int index = 0; - int index1 = (int)floor((float)originalSize / 2.0); + int index1 = int(floor(float(originalSize) / 2.0)); int index2 = index1 + nExtraVertex; for (it = stroke.strokeVerticesBegin(), itend = stroke.strokeVerticesEnd(); (it != itend) && (a != aend); @@ -614,7 +616,7 @@ int GuidingLinesShader::shade(Stroke &stroke) const n[0] = -n[0]; n[1] = -n[1]; } - float offset = (piece.error()) / 2.0f * _offset; + float offset = piece.error() / 2.0f * _offset; StrokeInternal::StrokeVertexIterator v, vend; for (v = a, vend = stroke.strokeVerticesEnd(); v != vend; ++v) { v->setPoint(piece.A.x() + v->u() * u.x() + n.x() * offset, @@ -660,13 +662,13 @@ int TipRemoverShader::shade(Stroke &stroke) const vector<StrokeVertex *>::iterator sv, svend; for (sv = verticesToRemove.begin(), svend = verticesToRemove.end(); sv != svend; ++sv) { - stroke.RemoveVertex((*sv)); + stroke.RemoveVertex(*sv); } // Resample so that our new stroke have the same number of vertices than before stroke.Resample(originalSize); - if ((int)stroke.strokeVerticesSize() != originalSize) { // soc + if (int(stroke.strokeVerticesSize()) != originalSize) { // soc cerr << "Warning: resampling problem" << endl; } diff --git a/source/blender/freestyle/intern/stroke/Canvas.cpp b/source/blender/freestyle/intern/stroke/Canvas.cpp index 68a18323621..741fad592cf 100644 --- a/source/blender/freestyle/intern/stroke/Canvas.cpp +++ b/source/blender/freestyle/intern/stroke/Canvas.cpp @@ -22,6 +22,8 @@ #include "../view_map/SteerableViewMap.h" +#include "BLI_sys_types.h" + #include "BKE_global.h" // soc #include <qimage.h> @@ -91,7 +93,7 @@ void Canvas::Draw() preDraw(); TimeStamp *timestamp = TimeStamp::instance(); - for (unsigned int i = 0; i < _StyleModules.size(); ++i) { + for (uint i = 0; i < _StyleModules.size(); ++i) { _current_sm = _StyleModules[i]; if (i < _Layers.size() && _Layers[i]) { @@ -169,11 +171,11 @@ void Canvas::PushBackStyleModule(StyleModule *iStyleModule) _Layers.push_back(layer); } -void Canvas::InsertStyleModule(unsigned index, StyleModule *iStyleModule) +void Canvas::InsertStyleModule(uint index, StyleModule *iStyleModule) { - unsigned size = _StyleModules.size(); + uint size = _StyleModules.size(); StrokeLayer *layer = new StrokeLayer(); - if ((_StyleModules.empty()) || (index == size)) { + if (_StyleModules.empty() || (index == size)) { _StyleModules.push_back(iStyleModule); _Layers.push_back(layer); return; @@ -182,9 +184,9 @@ void Canvas::InsertStyleModule(unsigned index, StyleModule *iStyleModule) _Layers.insert(_Layers.begin() + index, layer); } -void Canvas::RemoveStyleModule(unsigned index) +void Canvas::RemoveStyleModule(uint index) { - unsigned int i = 0; + uint i = 0; if (!_StyleModules.empty()) { for (deque<StyleModule *>::iterator s = _StyleModules.begin(), send = _StyleModules.end(); s != send; @@ -216,7 +218,7 @@ void Canvas::RemoveStyleModule(unsigned index) } } -void Canvas::SwapStyleModules(unsigned i1, unsigned i2) +void Canvas::SwapStyleModules(uint i1, uint i2) { StyleModule *tmp; tmp = _StyleModules[i1]; @@ -229,9 +231,9 @@ void Canvas::SwapStyleModules(unsigned i1, unsigned i2) _Layers[i2] = tmp2; } -void Canvas::ReplaceStyleModule(unsigned index, StyleModule *iStyleModule) +void Canvas::ReplaceStyleModule(uint index, StyleModule *iStyleModule) { - unsigned i = 0; + uint i = 0; for (deque<StyleModule *>::iterator s = _StyleModules.begin(), send = _StyleModules.end(); s != send; ++s, ++i) { @@ -245,29 +247,29 @@ void Canvas::ReplaceStyleModule(unsigned index, StyleModule *iStyleModule) } } -void Canvas::setVisible(unsigned index, bool iVisible) +void Canvas::setVisible(uint index, bool iVisible) { _StyleModules[index]->setDisplayed(iVisible); } -void Canvas::setModified(unsigned index, bool iMod) +void Canvas::setModified(uint index, bool iMod) { _StyleModules[index]->setModified(iMod); } void Canvas::resetModified(bool iMod /* = false */) { - unsigned int size = _StyleModules.size(); - for (unsigned int i = 0; i < size; ++i) { + uint size = _StyleModules.size(); + for (uint i = 0; i < size; ++i) { setModified(i, iMod); } } -void Canvas::causalStyleModules(vector<unsigned> &vec, unsigned index) +void Canvas::causalStyleModules(vector<uint> &vec, uint index) { - unsigned int size = _StyleModules.size(); + uint size = _StyleModules.size(); - for (unsigned int i = index; i < size; ++i) { + for (uint i = index; i < size; ++i) { if (_StyleModules[i]->getCausal()) { vec.push_back(i); } @@ -276,7 +278,7 @@ void Canvas::causalStyleModules(vector<unsigned> &vec, unsigned index) void Canvas::Render(const StrokeRenderer *iRenderer) { - for (unsigned int i = 0; i < _StyleModules.size(); ++i) { + for (uint i = 0; i < _StyleModules.size(); ++i) { if (!_StyleModules[i]->getDisplayed() || !_Layers[i]) { continue; } @@ -286,7 +288,7 @@ void Canvas::Render(const StrokeRenderer *iRenderer) void Canvas::RenderBasic(const StrokeRenderer *iRenderer) { - for (unsigned int i = 0; i < _StyleModules.size(); ++i) { + for (uint i = 0; i < _StyleModules.size(); ++i) { if (!_StyleModules[i]->getDisplayed() || !_Layers[i]) { continue; } @@ -294,10 +296,7 @@ void Canvas::RenderBasic(const StrokeRenderer *iRenderer) } } -void Canvas::loadMap(const char *iFileName, - const char *iMapName, - unsigned int iNbLevels, - float iSigma) +void Canvas::loadMap(const char *iFileName, const char *iMapName, uint iNbLevels, float iSigma) { // check whether this map was already loaded: if (!_maps.empty()) { diff --git a/source/blender/freestyle/intern/stroke/Chain.cpp b/source/blender/freestyle/intern/stroke/Chain.cpp index 3778727da37..b3f4d4547e9 100644 --- a/source/blender/freestyle/intern/stroke/Chain.cpp +++ b/source/blender/freestyle/intern/stroke/Chain.cpp @@ -120,7 +120,7 @@ void Chain::push_viewedge_front(ViewEdge *iViewEdge, bool orientation) } do { current = (*v)->point2d(); - Curve::push_vertex_front((*v)); + Curve::push_vertex_front(*v); //_Length += (current - previous).norm(); previous = current; if (orientation) { diff --git a/source/blender/freestyle/intern/stroke/ChainingIterators.cpp b/source/blender/freestyle/intern/stroke/ChainingIterators.cpp index 453eea58c93..87aabf71636 100644 --- a/source/blender/freestyle/intern/stroke/ChainingIterators.cpp +++ b/source/blender/freestyle/intern/stroke/ChainingIterators.cpp @@ -26,7 +26,7 @@ bool AdjacencyIterator::isIncoming() const int AdjacencyIterator::increment() { ++_internalIterator; - while ((!_internalIterator.isEnd()) && (!isValid((*_internalIterator).first))) { + while (!_internalIterator.isEnd() && !isValid((*_internalIterator).first)) { ++_internalIterator; } return 0; diff --git a/source/blender/freestyle/intern/stroke/ContextFunctions.cpp b/source/blender/freestyle/intern/stroke/ContextFunctions.cpp index e50b5f0b242..cd37a5f893d 100644 --- a/source/blender/freestyle/intern/stroke/ContextFunctions.cpp +++ b/source/blender/freestyle/intern/stroke/ContextFunctions.cpp @@ -12,19 +12,21 @@ #include "../system/TimeStamp.h" +#include "BLI_sys_types.h" + namespace Freestyle::ContextFunctions { -unsigned GetTimeStampCF() +uint GetTimeStampCF() { return TimeStamp::instance()->getTimeStamp(); } -unsigned GetCanvasWidthCF() +uint GetCanvasWidthCF() { return Canvas::getInstance()->width(); } -unsigned GetCanvasHeightCF() +uint GetCanvasHeightCF() { return Canvas::getInstance()->height(); } @@ -34,24 +36,24 @@ BBox<Vec2i> GetBorderCF() return Canvas::getInstance()->border(); } -void LoadMapCF(const char *iFileName, const char *iMapName, unsigned iNbLevels, float iSigma) +void LoadMapCF(const char *iFileName, const char *iMapName, uint iNbLevels, float iSigma) { return Canvas::getInstance()->loadMap(iFileName, iMapName, iNbLevels, iSigma); } -float ReadMapPixelCF(const char *iMapName, int level, unsigned x, unsigned y) +float ReadMapPixelCF(const char *iMapName, int level, uint x, uint y) { Canvas *canvas = Canvas::getInstance(); return canvas->readMapPixel(iMapName, level, x, y); } -float ReadCompleteViewMapPixelCF(int level, unsigned x, unsigned y) +float ReadCompleteViewMapPixelCF(int level, uint x, uint y) { SteerableViewMap *svm = Canvas::getInstance()->getSteerableViewMap(); return svm->readCompleteViewMapPixel(level, x, y); } -float ReadDirectionalViewMapPixelCF(int iOrientation, int level, unsigned x, unsigned y) +float ReadDirectionalViewMapPixelCF(int iOrientation, int level, uint x, uint y) { SteerableViewMap *svm = Canvas::getInstance()->getSteerableViewMap(); return svm->readSteerableViewMapPixel(iOrientation, level, x, y); diff --git a/source/blender/freestyle/intern/stroke/Operators.cpp b/source/blender/freestyle/intern/stroke/Operators.cpp index ee9fa33285f..93524e6ebe5 100644 --- a/source/blender/freestyle/intern/stroke/Operators.cpp +++ b/source/blender/freestyle/intern/stroke/Operators.cpp @@ -14,6 +14,8 @@ #include "Stroke.h" #include "StrokeIterators.h" +#include "BLI_sys_types.h" + #include "BKE_global.h" namespace Freestyle { @@ -73,7 +75,7 @@ int Operators::chain(ViewEdgeInternal::ViewEdgeIterator &it, return 0; } - unsigned id = 0; + uint id = 0; ViewEdge *edge; I1DContainer new_chains_set; @@ -137,7 +139,7 @@ int Operators::chain(ViewEdgeInternal::ViewEdgeIterator &it, UnaryPredicate1D &p return 0; } - unsigned id = 0; + uint id = 0; Functions1D::IncrementChainingTimeStampF1D ts; Predicates1D::EqualToChainingTimeStampUP1D pred_ts(TimeStamp::instance()->getTimeStamp() + 1); ViewEdge *edge; @@ -318,7 +320,7 @@ int Operators::bidirectionalChain(ChainingIterator &it, UnaryPredicate1D &pred) return 0; } - unsigned id = 0; + uint id = 0; Functions1D::IncrementChainingTimeStampF1D ts; Predicates1D::EqualToChainingTimeStampUP1D pred_ts(TimeStamp::instance()->getTimeStamp() + 1); ViewEdge *edge; @@ -421,7 +423,7 @@ int Operators::bidirectionalChain(ChainingIterator &it) return 0; } - unsigned id = 0; + uint id = 0; Functions1D::IncrementChainingTimeStampF1D ts; Predicates1D::EqualToChainingTimeStampUP1D pred_ts(TimeStamp::instance()->getTimeStamp() + 1); ViewEdge *edge; @@ -873,7 +875,7 @@ static int __recursiveSplit(Chain *_curve, ++it; // real mean = 0.0f; // soc unused - real variance = 0.0f; - unsigned count = 0; + uint count = 0; CurveInternal::CurvePointIterator next = it; ++next; diff --git a/source/blender/freestyle/intern/stroke/Stroke.cpp b/source/blender/freestyle/intern/stroke/Stroke.cpp index 101b89d720a..66a31d02a9b 100644 --- a/source/blender/freestyle/intern/stroke/Stroke.cpp +++ b/source/blender/freestyle/intern/stroke/Stroke.cpp @@ -486,11 +486,11 @@ void Stroke::setLength(float iLength) float Stroke::ComputeSampling(int iNVertices) { - if (iNVertices <= (int)_Vertices.size()) { // soc + if (iNVertices <= int(_Vertices.size())) { // soc return _sampling; } - float sampling = _Length / (float)(iNVertices - _Vertices.size() + 1); + float sampling = _Length / float(iNVertices - _Vertices.size() + 1); return sampling; } @@ -542,8 +542,8 @@ int Stroke::Resample(int iNPoints) Vec2r b((next)->getPoint()); Vec2r vec_tmp(b - a); real norm_var = vec_tmp.norm(); - int numberOfPointsToAdd = (int)floor(NPointsToAdd * norm_var / _Length); - float csampling = norm_var / (float)(numberOfPointsToAdd + 1); + int numberOfPointsToAdd = int(floor(NPointsToAdd * norm_var / _Length)); + float csampling = norm_var / float(numberOfPointsToAdd + 1); strokeSegments.emplace_back(it, next, norm_var, numberOfPointsToAdd, csampling); N += numberOfPointsToAdd; meanlength += norm_var; @@ -551,7 +551,7 @@ int Stroke::Resample(int iNPoints) ++it; ++next; } - meanlength /= (float)nsegments; + meanlength /= float(nsegments); // if we don't have enough points let's resample finer some segments bool checkEveryone = false; @@ -571,7 +571,7 @@ int Stroke::Resample(int iNPoints) } // resample s->_n = s->_n + 1; - s->_sampling = s->_length / (float)(s->_n + 1); + s->_sampling = s->_length / float(s->_n + 1); s->_resampled = resampled = true; N++; if (N == NPointsToAdd) { @@ -593,14 +593,14 @@ int Stroke::Resample(int iNPoints) for (vector<StrokeSegment>::iterator s = strokeSegments.begin(), send = strokeSegments.end(); s != send; ++s) { - newVertices.push_back(&(*(s->_begin))); + newVertices.push_back(&*(s->_begin)); if (s->_sampling < _sampling) { _sampling = s->_sampling; } t = s->_sampling / s->_length; for (int i = 0; i < s->_n; ++i) { - newVertex = new StrokeVertex(&(*(s->_begin)), &(*(s->_end)), t); + newVertex = new StrokeVertex(&*(s->_begin), &*(s->_end), t); newVertices.push_back(newVertex); t += s->_sampling / s->_length; } diff --git a/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp b/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp index 35ee41adbaf..095cb74d607 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeRenderer.cpp @@ -9,6 +9,8 @@ #include "../geometry/GeomUtils.h" +#include "BLI_sys_types.h" + using namespace std; namespace Freestyle { @@ -69,12 +71,12 @@ void TextureManager::load() _hasLoadedTextures = true; } -unsigned TextureManager::getBrushTextureIndex(string name, Stroke::MediumType iType) +uint TextureManager::getBrushTextureIndex(string name, Stroke::MediumType iType) { BrushTexture bt(name, iType); brushesMap::iterator b = _brushesMap.find(bt); if (b == _brushesMap.end()) { - unsigned texId = loadBrush(name, iType); + uint texId = loadBrush(name, iType); _brushesMap[bt] = texId; return texId; // XXX! diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.cpp b/source/blender/freestyle/intern/stroke/StrokeRep.cpp index e8ff46df731..89567d7e780 100644 --- a/source/blender/freestyle/intern/stroke/StrokeRep.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeRep.cpp @@ -360,7 +360,7 @@ void Strip::createStrip(const vector<StrokeVertex *> &iStrokeVertices) } } - if (i != 2 * (int)iStrokeVertices.size()) { + if (i != 2 * int(iStrokeVertices.size())) { if (G.debug & G_DEBUG_FREESTYLE) { cout << "Warning: problem with stripe size\n"; } @@ -837,11 +837,11 @@ void StrokeRep::create() bool first = true; bool end = false; while (v != vend) { - while ((v != vend) && (!(*v).attribute().isVisible())) { + while ((v != vend) && !(*v).attribute().isVisible()) { ++v; first = false; } - while ((v != vend) && ((*v).attribute().isVisible())) { + while ((v != vend) && (*v).attribute().isVisible()) { strip.push_back(&(*v)); ++v; } @@ -852,7 +852,7 @@ void StrokeRep::create() else { end = true; } - if ((!strip.empty()) && (strip.size() > 1)) { + if (!strip.empty() && (strip.size() > 1)) { _strips.push_back(new Strip(strip, _hasTex, first, end, _textureStep)); strip.clear(); } diff --git a/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp b/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp index 2dce6140c3f..07ba45b81ab 100644 --- a/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp +++ b/source/blender/freestyle/intern/stroke/StrokeTesselator.cpp @@ -64,7 +64,7 @@ NodeGroup *StrokeTesselator::Tesselate(StrokeVertexIterator begin, StrokeVertexI tshape->setFrsMaterial(_FrsMaterial); for (StrokeVertexIterator c = begin, cend = end; c != cend; c++) { - tshape->AddRep(Tesselate((*c))); + tshape->AddRep(Tesselate(*c)); } return group; |