diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-25 11:33:28 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-25 13:17:08 +0300 |
commit | f68cfd6bb078482c4a779a6e26a56e2734edb5b8 (patch) | |
tree | 2878e5b80dba5bdeba186d99661d604eb38879cd /source/blender/freestyle/intern/geometry | |
parent | c7b247a118e302a3afc6473797e53b6af28b69e2 (diff) |
Cleanup: replace C-style casts with functional casts for numeric types
Diffstat (limited to 'source/blender/freestyle/intern/geometry')
4 files changed, 9 insertions, 9 deletions
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]); } |