diff options
author | Campbell Barton <campbell@blender.org> | 2022-09-25 13:27:46 +0300 |
---|---|---|
committer | Campbell Barton <campbell@blender.org> | 2022-09-25 15:31:31 +0300 |
commit | 21d77a417e17ac92bfc10dbd742c867d4019ce69 (patch) | |
tree | ec664b5c6ca7882bcc5a1e1ce09cad67b842af9d /source/blender/simulation | |
parent | d35a10134cfdbd3e24a56218ef3f05aac2a2fc7e (diff) |
Cleanup: replace C-style casts with functional casts for numeric types
Some changes missed from f68cfd6bb078482c4a779a6e26a56e2734edb5b8.
Diffstat (limited to 'source/blender/simulation')
-rw-r--r-- | source/blender/simulation/intern/SIM_mass_spring.cpp | 8 | ||||
-rw-r--r-- | source/blender/simulation/intern/hair_volume.cpp | 22 |
2 files changed, 15 insertions, 15 deletions
diff --git a/source/blender/simulation/intern/SIM_mass_spring.cpp b/source/blender/simulation/intern/SIM_mass_spring.cpp index 0d403eeeb3d..b1782d67a04 100644 --- a/source/blender/simulation/intern/SIM_mass_spring.cpp +++ b/source/blender/simulation/intern/SIM_mass_spring.cpp @@ -1029,8 +1029,8 @@ static void cloth_continuum_step(ClothModifierData *clmd, float dt) for (i = 0; i < size; i++) { float x[3], v[3], gvel[3], gvel_smooth[3], gdensity; - madd_v3_v3v3fl(x, offset, a, (float)i / (float)(size - 1)); - madd_v3_v3fl(x, b, (float)j / (float)(size - 1)); + madd_v3_v3v3fl(x, offset, a, float(i) / float(size - 1)); + madd_v3_v3fl(x, b, float(j) / float(size - 1)); zero_v3(v); SIM_hair_volume_grid_interpolate(grid, x, &gdensity, gvel, gvel_smooth, NULL, NULL); @@ -1237,7 +1237,7 @@ static void cloth_record_result(ClothModifierData *clmd, ImplicitSolverResult *r sres->min_iterations = min_ii(sres->min_iterations, result->iterations); sres->max_iterations = max_ii(sres->max_iterations, result->iterations); - sres->avg_iterations += (float)result->iterations * dt; + sres->avg_iterations += float(result->iterations) * dt; } else { /* error only makes sense for successful iterations */ @@ -1247,7 +1247,7 @@ static void cloth_record_result(ClothModifierData *clmd, ImplicitSolverResult *r } sres->min_iterations = sres->max_iterations = result->iterations; - sres->avg_iterations += (float)result->iterations * dt; + sres->avg_iterations += float(result->iterations) * dt; } sres->status |= result->status; diff --git a/source/blender/simulation/intern/hair_volume.cpp b/source/blender/simulation/intern/hair_volume.cpp index cd2f1ae33ec..054426b8874 100644 --- a/source/blender/simulation/intern/hair_volume.cpp +++ b/source/blender/simulation/intern/hair_volume.cpp @@ -448,12 +448,12 @@ BLI_INLINE void hair_volume_add_segment_2D(HairGrid *grid, HairGridVert *vert_j = vert + jmin * stride_j; float loc_j[3] = {loc[0], loc[1], loc[2]}; - loc_j[axis_j] += (float)jmin; + loc_j[axis_j] += float(jmin); for (j = jmin; j <= jmax; j++, vert_j += stride_j, loc_j[axis_j] += 1.0f) { HairGridVert *vert_k = vert_j + kmin * stride_k; float loc_k[3] = {loc_j[0], loc_j[1], loc_j[2]}; - loc_k[axis_k] += (float)kmin; + loc_k[axis_k] += float(kmin); for (k = kmin; k <= kmax; k++, vert_k += stride_k, loc_k[axis_k] += 1.0f) { hair_volume_eval_grid_vertex(vert_k, loc_k, radius, dist_scale, x2, v2, x3, v3); @@ -542,7 +542,7 @@ void SIM_hair_volume_add_segment(HairGrid *grid, float shift1, shift2; /* fraction of a full cell shift [0.0, 1.0) */ int jmin, jmax, kmin, kmax; - h = CLAMPIS((float)i, start0, end0); + h = CLAMPIS(float(i), start0, end0); shift1 = start1 + (h - start0) * inc1; shift2 = start2 + (h - start0) * inc2; @@ -565,7 +565,7 @@ void SIM_hair_volume_add_segment(HairGrid *grid, } vert0 = grid->verts + i * stride0; - loc0[axis0] = (float)i; + loc0[axis0] = float(i); loc0[axis1] = 0.0f; loc0[axis2] = 0.0f; @@ -802,9 +802,9 @@ bool SIM_hair_volume_solve_divergence(HairGrid *grid, float col[3]; float fac; - loc[0] = (float)(i - 1); - loc[1] = (float)(j - 1); - loc[2] = (float)(k - 1); + loc[0] = float(i - 1); + loc[1] = float(j - 1); + loc[2] = float(k - 1); grid_to_world(grid, wloc, loc); if (divergence > 0.0f) { @@ -968,9 +968,9 @@ bool SIM_hair_volume_solve_divergence(HairGrid *grid, float col[3]; float fac; - loc[0] = (float)(i - 1); - loc[1] = (float)(j - 1); - loc[2] = (float)(k - 1); + loc[0] = float(i - 1); + loc[1] = float(j - 1); + loc[2] = float(k - 1); grid_to_world(grid, wloc, loc); float pressure = p[u]; @@ -1078,7 +1078,7 @@ void SIM_hair_volume_vertex_grid_filter_box(HairVertexGrid *grid, int kernel_siz } tot = kernel_size * 2 + 1; - invD = 1.0f / (float)(tot * tot * tot); + invD = 1.0f / float(tot * tot * tot); /* clear values for convolution */ for (i = 0; i < size; i++) { |