diff options
author | Pablo Dobarro <pablodp606@gmail.com> | 2020-08-12 18:23:20 +0300 |
---|---|---|
committer | Pablo Dobarro <pablodp606@gmail.com> | 2020-08-12 19:04:06 +0300 |
commit | ff4b5d00e4da54b1bcca232211fe17c8a8bf2c49 (patch) | |
tree | 235e049fbb176698eb747a2f5a2e2da2a890a9d8 | |
parent | 010911d7226894455023f0f1051a0d5fd2b8bb56 (diff) |
Cleanup: Remove explicit float casts in sculpt code
Differential Revision: https://developer.blender.org/D8553
4 files changed, 11 insertions, 12 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 3cb4a4d858e..36f227d6cc7 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -3188,7 +3188,7 @@ void SCULPT_relax_vertex(SculptSession *ss, } if (avg_count > 0) { - mul_v3_fl(smooth_pos, 1.0f / (float)avg_count); + mul_v3_fl(smooth_pos, 1.0f / avg_count); } else { copy_v3_v3(r_final_pos, vd->co); @@ -5183,7 +5183,7 @@ static float sculpt_clay_thumb_get_stabilized_pressure(StrokeCache *cache) for (int i = 0; i < SCULPT_CLAY_STABILIZER_LEN; i++) { final_pressure += cache->clay_pressure_stabilizer[i]; } - return final_pressure / (float)SCULPT_CLAY_STABILIZER_LEN; + return final_pressure / SCULPT_CLAY_STABILIZER_LEN; } static void do_clay_thumb_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode) @@ -7461,7 +7461,7 @@ static void sculpt_stroke_update_step(bContext *C, else { BKE_pbvh_bmesh_detail_size_set(ss->pbvh, (ss->cache->radius / ss->cache->dyntopo_pixel_radius) * - (float)(sd->detail_size * U.pixelsize) / 0.4f); + (sd->detail_size * U.pixelsize) / 0.4f); } if (SCULPT_stroke_is_dynamic_topology(ss, brush)) { diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c index 9f6500f1421..f9ae91fce7f 100644 --- a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c +++ b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c @@ -306,7 +306,7 @@ static void mesh_filter_task_cb(void *__restrict userdata, const uint *hash_co = (const uint *)orig_co; const uint hash = BLI_hash_int_2d(hash_co[0], hash_co[1]) ^ BLI_hash_int_2d(hash_co[2], ss->filter_cache->random_seed); - mul_v3_fl(normal, hash * (1.0f / (float)0xFFFFFFFF) - 0.5f); + mul_v3_fl(normal, hash * (1.0f / 0xFFFFFFFF) - 0.5f); mul_v3_v3fl(disp, normal, fade); break; } @@ -435,9 +435,8 @@ static void mesh_filter_sharpen_init_factors(SculptSession *ss) SCULPT_VERTEX_NEIGHBORS_ITER_END(ni); if (total > 0) { - mul_v3_v3fl( - ss->filter_cache->sharpen_detail_directions[i], direction_avg, 1.0f / (float)total); - ss->filter_cache->sharpen_factor[i] = sharpen_avg / (float)total; + mul_v3_v3fl(ss->filter_cache->sharpen_detail_directions[i], direction_avg, 1.0f / total); + ss->filter_cache->sharpen_factor[i] = sharpen_avg / total; } } } diff --git a/source/blender/editors/sculpt_paint/sculpt_paint_color.c b/source/blender/editors/sculpt_paint/sculpt_paint_color.c index ed33542967b..000b7afdf55 100644 --- a/source/blender/editors/sculpt_paint/sculpt_paint_color.c +++ b/source/blender/editors/sculpt_paint/sculpt_paint_color.c @@ -327,7 +327,7 @@ void SCULPT_do_paint_brush(Sculpt *sd, Object *ob, PBVHNode **nodes, int totnode if (swptd.tot_samples > 0 && is_finite_v4(swptd.color)) { copy_v4_v4(wet_color, swptd.color); - mul_v4_fl(wet_color, 1.0f / (float)swptd.tot_samples); + mul_v4_fl(wet_color, 1.0f / swptd.tot_samples); CLAMP4(wet_color, 0.0f, 1.0f); if (ss->cache->first_time) { diff --git a/source/blender/editors/sculpt_paint/sculpt_smooth.c b/source/blender/editors/sculpt_paint/sculpt_smooth.c index fd4006ce2d3..2b93298ac4a 100644 --- a/source/blender/editors/sculpt_paint/sculpt_smooth.c +++ b/source/blender/editors/sculpt_paint/sculpt_smooth.c @@ -150,7 +150,7 @@ void SCULPT_neighbor_coords_average(SculptSession *ss, float result[3], int inde SCULPT_VERTEX_NEIGHBORS_ITER_END(ni); if (total > 0) { - mul_v3_v3fl(result, avg, 1.0f / (float)total); + mul_v3_v3fl(result, avg, 1.0f / total); } else { copy_v3_v3(result, SCULPT_vertex_co_get(ss, index)); @@ -170,7 +170,7 @@ float SCULPT_neighbor_mask_average(SculptSession *ss, int index) SCULPT_VERTEX_NEIGHBORS_ITER_END(ni); if (total > 0) { - return avg / (float)total; + return avg / total; } return SCULPT_vertex_mask_get(ss, index); } @@ -188,7 +188,7 @@ void SCULPT_neighbor_color_average(SculptSession *ss, float result[4], int index SCULPT_VERTEX_NEIGHBORS_ITER_END(ni); if (total > 0) { - mul_v4_v4fl(result, avg, 1.0f / (float)total); + mul_v4_v4fl(result, avg, 1.0f / total); } else { copy_v4_v4(result, SCULPT_vertex_color_get(ss, index)); @@ -343,7 +343,7 @@ void SCULPT_surface_smooth_displace_step(SculptSession *ss, } SCULPT_VERTEX_NEIGHBORS_ITER_END(ni); if (total > 0) { - mul_v3_v3fl(b_current_vertex, b_avg, (1.0f - beta) / (float)total); + mul_v3_v3fl(b_current_vertex, b_avg, (1.0f - beta) / total); madd_v3_v3fl(b_current_vertex, laplacian_disp[v_index], beta); mul_v3_fl(b_current_vertex, clamp_f(fade, 0.0f, 1.0f)); sub_v3_v3(co, b_current_vertex); |