diff options
Diffstat (limited to 'source/blender/simulation/intern/hair_volume.cpp')
-rw-r--r-- | source/blender/simulation/intern/hair_volume.cpp | 78 |
1 files changed, 39 insertions, 39 deletions
diff --git a/source/blender/simulation/intern/hair_volume.cpp b/source/blender/simulation/intern/hair_volume.cpp index 36ac0c3906e..97042f433c2 100644 --- a/source/blender/simulation/intern/hair_volume.cpp +++ b/source/blender/simulation/intern/hair_volume.cpp @@ -39,7 +39,7 @@ static float I[3][3] = {{1, 0, 0}, {0, 1, 0}, {0, 0, 1}}; BLI_INLINE int floor_int(float value) { - return value > 0.0f ? (int)value : ((int)value) - 1; + return value > 0.0f ? int(value) : int(value) - 1; } BLI_INLINE float floor_mod(float value) @@ -68,7 +68,7 @@ struct HairGrid { }; #define HAIR_GRID_INDEX_AXIS(vec, res, gmin, scale, axis) \ - (min_ii(max_ii((int)((vec[axis] - gmin[axis]) * scale), 0), res[axis] - 2)) + min_ii(max_ii(int((vec[axis] - gmin[axis]) * scale), 0), res[axis] - 2) BLI_INLINE int hair_grid_offset(const float vec[3], const int res[3], @@ -92,9 +92,9 @@ BLI_INLINE int hair_grid_interp_weights( k = HAIR_GRID_INDEX_AXIS(vec, res, gmin, scale, 2); offset = i + (j + k * res[1]) * res[0]; - uvw[0] = (vec[0] - gmin[0]) * scale - (float)i; - uvw[1] = (vec[1] - gmin[1]) * scale - (float)j; - uvw[2] = (vec[2] - gmin[2]) * scale - (float)k; + uvw[0] = (vec[0] - gmin[0]) * scale - float(i); + uvw[1] = (vec[1] - gmin[1]) * scale - float(j); + uvw[2] = (vec[2] - gmin[2]) * scale - float(k); #if 0 BLI_assert(0.0f <= uvw[0] && uvw[0] <= 1.0001f); @@ -327,14 +327,14 @@ BLI_INLINE int hair_grid_weights( uvw[1] = (vec[1] - gmin[1]) * scale; uvw[2] = (vec[2] - gmin[2]) * scale; - weights[0] = dist_tent_v3f3(uvw, (float)i, (float)j, (float)k); - weights[1] = dist_tent_v3f3(uvw, (float)(i + 1), (float)j, (float)k); - weights[2] = dist_tent_v3f3(uvw, (float)i, (float)(j + 1), (float)k); - weights[3] = dist_tent_v3f3(uvw, (float)(i + 1), (float)(j + 1), (float)k); - weights[4] = dist_tent_v3f3(uvw, (float)i, (float)j, (float)(k + 1)); - weights[5] = dist_tent_v3f3(uvw, (float)(i + 1), (float)j, (float)(k + 1)); - weights[6] = dist_tent_v3f3(uvw, (float)i, (float)(j + 1), (float)(k + 1)); - weights[7] = dist_tent_v3f3(uvw, (float)(i + 1), (float)(j + 1), (float)(k + 1)); + weights[0] = dist_tent_v3f3(uvw, float(i), float(j), float(k)); + weights[1] = dist_tent_v3f3(uvw, float(i + 1), float(j), float(k)); + weights[2] = dist_tent_v3f3(uvw, float(i), float(j + 1), float(k)); + weights[3] = dist_tent_v3f3(uvw, float(i + 1), float(j + 1), float(k)); + weights[4] = dist_tent_v3f3(uvw, float(i), float(j), float(k + 1)); + weights[5] = dist_tent_v3f3(uvw, float(i + 1), float(j), float(k + 1)); + weights[6] = dist_tent_v3f3(uvw, float(i), float(j + 1), float(k + 1)); + weights[7] = dist_tent_v3f3(uvw, float(i + 1), float(j + 1), float(k + 1)); // BLI_assert(fabsf(weights_sum(weights) - 1.0f) < 0.0001f); @@ -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; @@ -618,17 +618,17 @@ BLI_INLINE void hair_volume_eval_grid_vertex_sample(HairGridVert *vert, } void SIM_hair_volume_add_segment(HairGrid *grid, - const float UNUSED(x1[3]), - const float UNUSED(v1[3]), + const float /*x1*/[3], + const float /*v1*/[3], const float x2[3], const float v2[3], const float x3[3], const float v3[3], - const float UNUSED(x4[3]), - const float UNUSED(v4[3]), - const float UNUSED(dir1[3]), - const float UNUSED(dir2[3]), - const float UNUSED(dir3[3])) + const float /*x4*/[3], + const float /*v4*/[3], + const float /*dir1*/[3], + const float /*dir2*/[3], + const float /*dir3*/[3]) { /* XXX simplified test implementation using a series of discrete sample along the segment, * instead of finding the closest point for all affected grid vertices. */ @@ -646,7 +646,7 @@ void SIM_hair_volume_add_segment(HairGrid *grid, float x[3], v[3]; int i, j, k; - float f = (float)s / (float)(num_samples - 1); + float f = float(s) / float(num_samples - 1); interp_v3_v3v3(x, x2, x3, f); interp_v3_v3v3(v, v2, v3, f); @@ -660,7 +660,7 @@ void SIM_hair_volume_add_segment(HairGrid *grid, for (k = kmin; k <= kmax; k++) { for (j = jmin; j <= jmax; j++) { for (i = imin; i <= imax; i++) { - float loc[3] = {(float)i, (float)j, (float)k}; + float loc[3] = {float(i), float(j), float(k)}; HairGridVert *vert = grid->verts + i * stride[0] + j * stride[1] + k * stride[2]; hair_volume_eval_grid_vertex_sample(vert, loc, radius, dist_scale, x, v); @@ -787,7 +787,7 @@ bool SIM_hair_volume_solve_divergence(HairGrid *grid, vert->density, target_density, target_strength); /* B vector contains the finite difference approximation of the velocity divergence. - * NOTE: according to the discretized Navier-Stokes equation the rhs vector + * NOTE: according to the discretized Navier-Stokes equation the RHS vector * and resulting pressure gradient should be multiplied by the (inverse) density; * however, this is already included in the weighting of hair velocities on the grid! */ @@ -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) { @@ -884,7 +884,7 @@ bool SIM_hair_volume_solve_divergence(HairGrid *grid, for (n = 0; n < neighbors_lo; n++) { A.insert(neighbor_lo_index[n], u) = -1.0f; } - A.insert(u, u) = (float)non_solid_neighbors; + A.insert(u, u) = float(non_solid_neighbors); for (n = 0; n < neighbors_hi; n++) { A.insert(neighbor_hi_index[n], u) = -1.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++) { @@ -1139,8 +1139,8 @@ HairGrid *SIM_hair_volume_create_vertex_grid(float cellsize, resmax[i] = resmin[i] + MAX_HAIR_GRID_RES; } - gmin_margin[i] = (float)resmin[i] * cellsize; - gmax_margin[i] = (float)resmax[i] * cellsize; + gmin_margin[i] = float(resmin[i]) * cellsize; + gmax_margin[i] = float(resmax[i]) * cellsize; } size = hair_grid_size(res); @@ -1187,7 +1187,7 @@ void SIM_hair_volume_grid_geometry( #if 0 static HairGridVert *hair_volume_create_collision_grid(ClothModifierData *clmd, lfVector *lX, - unsigned int numverts) + uint numverts) { int res = hair_grid_res; int size = hair_grid_size(res); @@ -1197,7 +1197,7 @@ static HairGridVert *hair_volume_create_collision_grid(ClothModifierData *clmd, float gmin[3], gmax[3], scale[3]; /* 2.0f is an experimental value that seems to give good results */ float collfac = 2.0f * clmd->sim_parms->collider_friction; - unsigned int v = 0; + uint v = 0; int i = 0; hair_volume_get_boundbox(lX, numverts, gmin, gmax); |