Cleanup: Remove explicit float casts in sculpt code

Differential Revision: https://developer.blender.org/D8553
This commit is contained in:
Pablo Dobarro 2020-08-12 17:23:20 +02:00
parent 010911d722
commit ff4b5d00e4
4 changed files with 11 additions and 12 deletions

View File

@ -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)) {

View File

@ -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;
}
}
}

View File

@ -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) {

View File

@ -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);