Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCampbell Barton <campbell@blender.org>2022-09-25 11:33:28 +0300
committerCampbell Barton <campbell@blender.org>2022-09-25 13:17:08 +0300
commitf68cfd6bb078482c4a779a6e26a56e2734edb5b8 (patch)
tree2878e5b80dba5bdeba186d99661d604eb38879cd /source/blender/freestyle
parentc7b247a118e302a3afc6473797e53b6af28b69e2 (diff)
Cleanup: replace C-style casts with functional casts for numeric types
Diffstat (limited to 'source/blender/freestyle')
-rw-r--r--source/blender/freestyle/intern/application/AppCanvas.cpp16
-rw-r--r--source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp2
-rw-r--r--source/blender/freestyle/intern/geometry/Bezier.cpp2
-rw-r--r--source/blender/freestyle/intern/geometry/GeomCleaner.cpp6
-rw-r--r--source/blender/freestyle/intern/geometry/Grid.cpp2
-rw-r--r--source/blender/freestyle/intern/geometry/Noise.cpp8
-rw-r--r--source/blender/freestyle/intern/image/GaussianFilter.cpp2
-rw-r--r--source/blender/freestyle/intern/image/ImagePyramid.cpp2
-rw-r--r--source/blender/freestyle/intern/python/BPy_Interface1D.cpp2
-rw-r--r--source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp8
-rw-r--r--source/blender/freestyle/intern/stroke/AdvancedFunctions0D.cpp24
-rw-r--r--source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp2
-rw-r--r--source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp28
-rw-r--r--source/blender/freestyle/intern/stroke/Stroke.cpp12
-rw-r--r--source/blender/freestyle/intern/stroke/StrokeRep.cpp2
-rw-r--r--source/blender/freestyle/intern/system/PseudoNoise.cpp2
-rw-r--r--source/blender/freestyle/intern/system/RandGen.cpp4
-rw-r--r--source/blender/freestyle/intern/view_map/BoxGrid.cpp4
-rw-r--r--source/blender/freestyle/intern/view_map/SphericalGrid.cpp4
-rw-r--r--source/blender/freestyle/intern/view_map/SteerableViewMap.cpp10
-rw-r--r--source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp10
-rw-r--r--source/blender/freestyle/intern/winged_edge/WXEdge.cpp4
22 files changed, 78 insertions, 78 deletions
diff --git a/source/blender/freestyle/intern/application/AppCanvas.cpp b/source/blender/freestyle/intern/application/AppCanvas.cpp
index 0367f5c1d6d..109afd48b1b 100644
--- a/source/blender/freestyle/intern/application/AppCanvas.cpp
+++ b/source/blender/freestyle/intern/application/AppCanvas.cpp
@@ -118,8 +118,8 @@ void AppCanvas::readColorPixels(int x, int y, int w, int h, RGBImage &oImage) co
int ymax = border().getMax().y();
int rectx = _pass_diffuse.width;
int recty = _pass_diffuse.height;
- float xfac = ((float)rectx) / ((float)(xmax - xmin));
- float yfac = ((float)recty) / ((float)(ymax - ymin));
+ float xfac = float(rectx) / float(xmax - xmin);
+ float yfac = float(recty) / float(ymax - ymin);
#if 0
if (G.debug & G_DEBUG_FREESTYLE) {
printf("readColorPixels %d x %d @ (%d, %d) in %d x %d [%d x %d] -- %d x %d @ %d%%\n",
@@ -138,12 +138,12 @@ void AppCanvas::readColorPixels(int x, int y, int w, int h, RGBImage &oImage) co
#endif
int ii, jj;
for (int j = 0; j < h; j++) {
- jj = (int)((y - ymin + j) * yfac);
+ jj = int((y - ymin + j) * yfac);
if (jj < 0 || jj >= recty) {
continue;
}
for (int i = 0; i < w; i++) {
- ii = (int)((x - xmin + i) * xfac);
+ ii = int((x - xmin + i) * xfac);
if (ii < 0 || ii >= rectx) {
continue;
}
@@ -167,8 +167,8 @@ void AppCanvas::readDepthPixels(int x, int y, int w, int h, GrayImage &oImage) c
int ymax = border().getMax().y();
int rectx = _pass_z.width;
int recty = _pass_z.height;
- float xfac = ((float)rectx) / ((float)(xmax - xmin));
- float yfac = ((float)recty) / ((float)(ymax - ymin));
+ float xfac = float(rectx) / float(xmax - xmin);
+ float yfac = float(recty) / float(ymax - ymin);
#if 0
if (G.debug & G_DEBUG_FREESTYLE) {
printf("readDepthPixels %d x %d @ (%d, %d) in %d x %d [%d x %d] -- %d x %d @ %d%%\n",
@@ -187,12 +187,12 @@ void AppCanvas::readDepthPixels(int x, int y, int w, int h, GrayImage &oImage) c
#endif
int ii, jj;
for (int j = 0; j < h; j++) {
- jj = (int)((y - ymin + j) * yfac);
+ jj = int((y - ymin + j) * yfac);
if (jj < 0 || jj >= recty) {
continue;
}
for (int i = 0; i < w; i++) {
- ii = (int)((x - xmin + i) * xfac);
+ ii = int((x - xmin + i) * xfac);
if (ii < 0 || ii >= rectx) {
continue;
}
diff --git a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
index 27c4bbe9bc4..dec443064de 100644
--- a/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
+++ b/source/blender/freestyle/intern/blender_interface/BlenderFileLoader.cpp
@@ -754,7 +754,7 @@ void BlenderFileLoader::insertShapeNode(Object *ob, Mesh *me, int id)
if (G.debug & G_DEBUG_FREESTYLE) {
printf("Warning: Object %s contains %lu degenerated triangle%s (strokes may be incorrect)\n",
name,
- (ulong)detriList.size(),
+ ulong(detriList.size()),
(detriList.size() > 1) ? "s" : "");
}
}
diff --git a/source/blender/freestyle/intern/geometry/Bezier.cpp b/source/blender/freestyle/intern/geometry/Bezier.cpp
index b12b189853c..30eece55d5f 100644
--- a/source/blender/freestyle/intern/geometry/Bezier.cpp
+++ b/source/blender/freestyle/intern/geometry/Bezier.cpp
@@ -50,7 +50,7 @@ void BezierCurveSegment::Build()
y[3] = p0->y();
int nvertices = 12;
- float increment = 1.0 / (float)nvertices;
+ float increment = 1.0 / float(nvertices);
float t = 0.0f;
for (int i = 0; i <= nvertices; ++i) {
_Vertices.emplace_back((x[3] + t * (x[2] + t * (x[1] + t * x[0]))),
diff --git a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
index 736191da87e..1bbea79d793 100644
--- a/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
+++ b/source/blender/freestyle/intern/geometry/GeomCleaner.cpp
@@ -172,9 +172,9 @@ struct GeomCleanerHasher {
#define _MOD 2147483647UL
inline size_t operator()(const Vec3r &p) const
{
- size_t res = ((ulong)(p[0] * _MUL)) % _MOD;
- res = (res + (ulong)(p[1]) * _MUL) % _MOD;
- return (res + (ulong)(p[2]) * _MUL) % _MOD;
+ size_t res = ulong(p[0] * _MUL) % _MOD;
+ res = (res + ulong(p[1]) * _MUL) % _MOD;
+ return (res + ulong(p[2]) * _MUL) % _MOD;
}
#undef _MUL
#undef _MOD
diff --git a/source/blender/freestyle/intern/geometry/Grid.cpp b/source/blender/freestyle/intern/geometry/Grid.cpp
index 33c7d04cb4c..ad45ab4eb42 100644
--- a/source/blender/freestyle/intern/geometry/Grid.cpp
+++ b/source/blender/freestyle/intern/geometry/Grid.cpp
@@ -355,7 +355,7 @@ bool Grid::initInfiniteRay(const Vec3r &orig, const Vec3r &dir, unsigned timesta
BBox<Vec3r> box(boxMin, boxMax);
if (box.inside(orig)) {
for (uint i = 0; i < 3; i++) {
- _current_cell[i] = (uint)floor((orig[i] - _orig[i]) / _cell_size[i]);
+ _current_cell[i] = uint(floor((orig[i] - _orig[i]) / _cell_size[i]));
// soc unused - unsigned u = _current_cell[i];
_pt[i] = orig[i] - _orig[i] - _current_cell[i] * _cell_size[i];
}
diff --git a/source/blender/freestyle/intern/geometry/Noise.cpp b/source/blender/freestyle/intern/geometry/Noise.cpp
index d8a09bd8ab7..95a742e9d0d 100644
--- a/source/blender/freestyle/intern/geometry/Noise.cpp
+++ b/source/blender/freestyle/intern/geometry/Noise.cpp
@@ -45,7 +45,7 @@ namespace Freestyle {
(t) = (i) + (N); \
(r0) = modff((t), &(u)); \
(r1) = (r0)-1.0; \
- (b0) = ((int)(u)) & BM; \
+ (b0) = int(u) & BM; \
(b1) = ((b0) + 1) & BM; \
} \
(void)0
@@ -229,15 +229,15 @@ Noise::Noise(long seed)
for (i = 0; i < _NOISE_B; i++) {
p[i] = i;
- g1[i] = (float)((BLI_rng_get_int(rng) % (_NOISE_B + _NOISE_B)) - _NOISE_B) / _NOISE_B;
+ g1[i] = float((BLI_rng_get_int(rng) % (_NOISE_B + _NOISE_B)) - _NOISE_B) / _NOISE_B;
for (j = 0; j < 2; j++) {
- g2[i][j] = (float)((BLI_rng_get_int(rng) % (_NOISE_B + _NOISE_B)) - _NOISE_B) / _NOISE_B;
+ g2[i][j] = float((BLI_rng_get_int(rng) % (_NOISE_B + _NOISE_B)) - _NOISE_B) / _NOISE_B;
}
normalize2(g2[i]);
for (j = 0; j < 3; j++) {
- g3[i][j] = (float)((BLI_rng_get_int(rng) % (_NOISE_B + _NOISE_B)) - _NOISE_B) / _NOISE_B;
+ g3[i][j] = float((BLI_rng_get_int(rng) % (_NOISE_B + _NOISE_B)) - _NOISE_B) / _NOISE_B;
}
normalize3(g3[i]);
}
diff --git a/source/blender/freestyle/intern/image/GaussianFilter.cpp b/source/blender/freestyle/intern/image/GaussianFilter.cpp
index 7e523311d4c..421b739197b 100644
--- a/source/blender/freestyle/intern/image/GaussianFilter.cpp
+++ b/source/blender/freestyle/intern/image/GaussianFilter.cpp
@@ -46,7 +46,7 @@ GaussianFilter::~GaussianFilter()
int GaussianFilter::computeMaskSize(float sigma)
{
- int maskSize = (int)floor(4 * sigma) + 1;
+ int maskSize = int(floor(4 * sigma)) + 1;
if (0 == (maskSize % 2)) {
++maskSize;
}
diff --git a/source/blender/freestyle/intern/image/ImagePyramid.cpp b/source/blender/freestyle/intern/image/ImagePyramid.cpp
index f595efabe0b..d1a41fc82db 100644
--- a/source/blender/freestyle/intern/image/ImagePyramid.cpp
+++ b/source/blender/freestyle/intern/image/ImagePyramid.cpp
@@ -96,7 +96,7 @@ float ImagePyramid::pixel(int x, int y, int level)
else {
P2 = P1;
}
- return (1.0f / (float)(1 << (2 * level))) * (C * P1 + D * P2);
+ return (1.0f / float(1 << (2 * level))) * (C * P1 + D * P2);
}
int ImagePyramid::width(int level)
diff --git a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp
index fbe81d26e79..1a353c2174f 100644
--- a/source/blender/freestyle/intern/python/BPy_Interface1D.cpp
+++ b/source/blender/freestyle/intern/python/BPy_Interface1D.cpp
@@ -278,7 +278,7 @@ static PyObject *Interface1D_length_2d_get(BPy_Interface1D *self, void *UNUSED(c
if (PyErr_Occurred()) {
return nullptr;
}
- return PyFloat_FromDouble((double)length);
+ return PyFloat_FromDouble(double(length));
}
PyDoc_STRVAR(Interface1D_time_stamp_doc,
diff --git a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
index 54996067e72..228be7f4f76 100644
--- a/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
+++ b/source/blender/freestyle/intern/python/Interface0D/CurvePoint/BPy_StrokeVertex.cpp
@@ -153,8 +153,8 @@ static int StrokeVertex_mathutils_check(BaseMathObject *bmo)
static int StrokeVertex_mathutils_get(BaseMathObject *bmo, int /*subtype*/)
{
BPy_StrokeVertex *self = (BPy_StrokeVertex *)bmo->cb_user;
- bmo->data[0] = (float)self->sv->x();
- bmo->data[1] = (float)self->sv->y();
+ bmo->data[0] = float(self->sv->x());
+ bmo->data[1] = float(self->sv->y());
return 0;
}
@@ -171,10 +171,10 @@ static int StrokeVertex_mathutils_get_index(BaseMathObject *bmo, int /*subtype*/
BPy_StrokeVertex *self = (BPy_StrokeVertex *)bmo->cb_user;
switch (index) {
case 0:
- bmo->data[0] = (float)self->sv->x();
+ bmo->data[0] = float(self->sv->x());
break;
case 1:
- bmo->data[1] = (float)self->sv->y();
+ bmo->data[1] = float(self->sv->y());
break;
default:
return -1;
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..d12aab45215 100644
--- a/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp
+++ b/source/blender/freestyle/intern/stroke/AdvancedFunctions1D.cpp
@@ -38,7 +38,7 @@ 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;
}
diff --git a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
index 75115b4abac..dd0239322ab 100644
--- a/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
+++ b/source/blender/freestyle/intern/stroke/BasicStrokeShaders.cpp
@@ -80,11 +80,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 +102,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) {
@@ -157,13 +157,13 @@ static const unsigned 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 +213,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 +243,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
@@ -467,7 +467,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);
@@ -666,7 +666,7 @@ int TipRemoverShader::shade(Stroke &stroke) const
// Resample so that our new stroke have the same number of vertices than before
stroke.Resample(originalSize);
- if ((int)stroke.strokeVerticesSize() != originalSize) { // soc
+ if (int(stroke.strokeVerticesSize()) != originalSize) { // soc
cerr << "Warning: resampling problem" << endl;
}
diff --git a/source/blender/freestyle/intern/stroke/Stroke.cpp b/source/blender/freestyle/intern/stroke/Stroke.cpp
index 101b89d720a..7aacf61c604 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) {
diff --git a/source/blender/freestyle/intern/stroke/StrokeRep.cpp b/source/blender/freestyle/intern/stroke/StrokeRep.cpp
index e8ff46df731..282c72617f0 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";
}
diff --git a/source/blender/freestyle/intern/system/PseudoNoise.cpp b/source/blender/freestyle/intern/system/PseudoNoise.cpp
index 354aef13115..9bb597a8a67 100644
--- a/source/blender/freestyle/intern/system/PseudoNoise.cpp
+++ b/source/blender/freestyle/intern/system/PseudoNoise.cpp
@@ -15,7 +15,7 @@ static int modf_to_index(Freestyle::real x, uint range)
{
if (isfinite(x)) {
Freestyle::real tmp;
- int i = abs((int)(modf(x, &tmp) * range));
+ int i = abs(int(modf(x, &tmp) * range));
BLI_assert(i >= 0 && i < range);
return i;
}
diff --git a/source/blender/freestyle/intern/system/RandGen.cpp b/source/blender/freestyle/intern/system/RandGen.cpp
index c5559f39147..bb6970bc27a 100644
--- a/source/blender/freestyle/intern/system/RandGen.cpp
+++ b/source/blender/freestyle/intern/system/RandGen.cpp
@@ -32,13 +32,13 @@ namespace Freestyle {
#define MUL(x, y, z) \
{ \
- long l = (long)(x) * (long)(y); \
+ long l = long(x) * long(y); \
(z)[0] = LOW(l); \
(z)[1] = HIGH(l); \
} \
((void)0)
-#define CARRY(x, y) ((ulong)((long)(x) + (long)(y)) > MASK)
+#define CARRY(x, y) (ulong(long(x) + long(y)) > MASK)
#define ADDEQU(x, y, z) (z = CARRY(x, (y)), x = LOW(x + (y)))
#define SET3(x, x0, x1, x2) ((x)[0] = (x0), (x)[1] = (x1), (x)[2] = (x2))
#if 0 // XXX, unused
diff --git a/source/blender/freestyle/intern/view_map/BoxGrid.cpp b/source/blender/freestyle/intern/view_map/BoxGrid.cpp
index eac6765da99..4c79d6c2fa1 100644
--- a/source/blender/freestyle/intern/view_map/BoxGrid.cpp
+++ b/source/blender/freestyle/intern/view_map/BoxGrid.cpp
@@ -188,8 +188,8 @@ void BoxGrid::reorganizeCells()
void BoxGrid::getCellCoordinates(const Vec3r &point, unsigned &x, unsigned &y)
{
- x = min(_cellsX - 1, (unsigned)floor(max((double)0.0f, point[0] - _cellOrigin[0]) / _cellSize));
- y = min(_cellsY - 1, (unsigned)floor(max((double)0.0f, point[1] - _cellOrigin[1]) / _cellSize));
+ x = min(_cellsX - 1, (unsigned)floor(max(double(0.0f), point[0] - _cellOrigin[0]) / _cellSize));
+ y = min(_cellsY - 1, (unsigned)floor(max(double(0.0f), point[1] - _cellOrigin[1]) / _cellSize));
}
BoxGrid::Cell *BoxGrid::findCell(const Vec3r &point)
diff --git a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp
index 70f10058411..5e27e344c28 100644
--- a/source/blender/freestyle/intern/view_map/SphericalGrid.cpp
+++ b/source/blender/freestyle/intern/view_map/SphericalGrid.cpp
@@ -184,8 +184,8 @@ void SphericalGrid::reorganizeCells()
void SphericalGrid::getCellCoordinates(const Vec3r &point, unsigned &x, unsigned &y)
{
- x = min(_cellsX - 1, (unsigned)floor(max((double)0.0f, point[0] - _cellOrigin[0]) / _cellSize));
- y = min(_cellsY - 1, (unsigned)floor(max((double)0.0f, point[1] - _cellOrigin[1]) / _cellSize));
+ x = min(_cellsX - 1, (unsigned)floor(max(double(0.0f), point[0] - _cellOrigin[0]) / _cellSize));
+ y = min(_cellsY - 1, (unsigned)floor(max(double(0.0f), point[1] - _cellOrigin[1]) / _cellSize));
}
SphericalGrid::Cell *SphericalGrid::findCell(const Vec3r &point)
diff --git a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
index 88f94e152a1..0a05d469585 100644
--- a/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
+++ b/source/blender/freestyle/intern/view_map/SteerableViewMap.cpp
@@ -29,10 +29,10 @@ using namespace Geometry;
SteerableViewMap::SteerableViewMap(uint nbOrientations)
{
_nbOrientations = nbOrientations;
- _bound = cos(M_PI / (float)_nbOrientations);
+ _bound = cos(M_PI / float(_nbOrientations));
for (uint i = 0; i < _nbOrientations; ++i) {
- _directions.emplace_back(cos((float)i * M_PI / (float)_nbOrientations),
- sin((float)i * M_PI / (float)_nbOrientations));
+ _directions.emplace_back(cos(float(i) * M_PI / float(_nbOrientations)),
+ sin(float(i) * M_PI / float(_nbOrientations)));
}
Build();
}
@@ -101,7 +101,7 @@ double SteerableViewMap::ComputeWeight(const Vec2d &dir, unsigned i)
dotp = 1.0;
}
- return cos((float)_nbOrientations / 2.0 * acos(dotp));
+ return cos(float(_nbOrientations) / 2.0 * acos(dotp));
}
double *SteerableViewMap::AddFEdge(FEdge *iFEdge)
@@ -246,7 +246,7 @@ void SteerableViewMap::saveSteerableViewMap() const
for (int y = 0; y < oh; ++y) { // soc
for (int x = 0; x < ow; ++x) { // soc
- int c = (int)(coeff * _imagesPyramids[i]->pixel(x, y, j));
+ int c = int(coeff * _imagesPyramids[i]->pixel(x, y, j));
if (c > 255) {
c = 255;
}
diff --git a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
index bbf9962b0e6..343f6a8f761 100644
--- a/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
+++ b/source/blender/freestyle/intern/view_map/ViewMapBuilder.cpp
@@ -445,7 +445,7 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap,
stringstream ss;
ss << "Freestyle: Visibility computations " << (100 * count / vedges.size()) << "%";
iRenderMonitor->setInfo(ss.str());
- iRenderMonitor->progress((float)count / vedges.size());
+ iRenderMonitor->progress(float(count) / vedges.size());
}
count++;
}
@@ -607,7 +607,7 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap,
#endif
// occludee --
if (!wFaces.empty()) {
- if (wFaces.size() <= (float)nSamples / 2.0f) {
+ if (wFaces.size() <= float(nSamples) / 2.0f) {
(*ve)->setaShape(nullptr);
}
else {
@@ -623,7 +623,7 @@ static void computeCumulativeVisibility(ViewMap *ioViewMap,
stringstream ss;
ss << "Freestyle: Visibility computations " << (100 * count / vedges.size()) << "%";
iRenderMonitor->setInfo(ss.str());
- iRenderMonitor->progress((float)count / vedges.size());
+ iRenderMonitor->progress(float(count) / vedges.size());
}
}
@@ -796,7 +796,7 @@ static void computeDetailedVisibility(ViewMap *ioViewMap,
#endif
// occludee --
if (!wFaces.empty()) {
- if (wFaces.size() <= (float)nSamples / 2.0f) {
+ if (wFaces.size() <= float(nSamples) / 2.0f) {
(*ve)->setaShape(nullptr);
}
else {
@@ -1668,7 +1668,7 @@ void ViewMapBuilder::ComputeRayCastingVisibility(ViewMap *ioViewMap, real epsilo
#endif
// occludee --
if (!aFaces.empty()) {
- if (aFaces.size() <= (float)nSamples / 2.0f) {
+ if (aFaces.size() <= float(nSamples) / 2.0f) {
(*ve)->setaShape(nullptr);
}
else {
diff --git a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp
index c60088a219f..f04c6e3f2be 100644
--- a/source/blender/freestyle/intern/winged_edge/WXEdge.cpp
+++ b/source/blender/freestyle/intern/winged_edge/WXEdge.cpp
@@ -243,7 +243,7 @@ void WXFace::ComputeCenter()
++wv) {
center += (*wv)->GetVertex();
}
- center /= (float)iVertexList.size();
+ center /= float(iVertexList.size());
setCenter(center);
}
@@ -270,7 +270,7 @@ WFace *WXShape::MakeFace(vector<WVertex *> &iVertexList,
++wv) {
center += (*wv)->GetVertex();
}
- center /= (float)iVertexList.size();
+ center /= float(iVertexList.size());
((WXFace *)face)->setCenter(center);
return face;