diff options
Diffstat (limited to 'source/blender/editors/sculpt_paint')
13 files changed, 62 insertions, 111 deletions
diff --git a/source/blender/editors/sculpt_paint/paint_image_proj.c b/source/blender/editors/sculpt_paint/paint_image_proj.c index 27d19532785..ca012f20f01 100644 --- a/source/blender/editors/sculpt_paint/paint_image_proj.c +++ b/source/blender/editors/sculpt_paint/paint_image_proj.c @@ -414,6 +414,7 @@ typedef struct ProjPaintState { int totvert_eval; const MVert *mvert_eval; + const float (*vert_normals)[3]; const MEdge *medge_eval; const MPoly *mpoly_eval; const MLoop *mloop_eval; @@ -1718,10 +1719,10 @@ static float project_paint_uvpixel_mask(const ProjPaintState *ps, float no[3], angle_cos; if (mp->flag & ME_SMOOTH) { - const short *no1, *no2, *no3; - no1 = ps->mvert_eval[lt_vtri[0]].no; - no2 = ps->mvert_eval[lt_vtri[1]].no; - no3 = ps->mvert_eval[lt_vtri[2]].no; + const float *no1, *no2, *no3; + no1 = ps->vert_normals[lt_vtri[0]]; + no2 = ps->vert_normals[lt_vtri[1]]; + no3 = ps->vert_normals[lt_vtri[2]]; no[0] = w[0] * no1[0] + w[1] * no2[0] + w[2] * no3[0]; no[1] = w[0] * no1[1] + w[1] * no2[1] + w[2] * no3[1]; @@ -3871,7 +3872,6 @@ static void proj_paint_state_screen_coords_init(ProjPaintState *ps, const int di static void proj_paint_state_cavity_init(ProjPaintState *ps) { - const MVert *mv; const MEdge *me; float *cavities; int a; @@ -3891,13 +3891,11 @@ static void proj_paint_state_cavity_init(ProjPaintState *ps) sub_v3_v3(edges[me->v1], e); counter[me->v1]++; } - for (a = 0, mv = ps->mvert_eval; a < ps->totvert_eval; a++, mv++) { + for (a = 0; a < ps->totvert_eval; a++) { if (counter[a] > 0) { - float no[3]; mul_v3_fl(edges[a], 1.0f / counter[a]); - normal_short_to_float_v3(no, mv->no); /* Augment the difference. */ - cavities[a] = saacos(10.0f * dot_v3v3(no, edges[a])) * (float)M_1_PI; + cavities[a] = saacos(10.0f * dot_v3v3(ps->vert_normals[a], edges[a])) * (float)M_1_PI; } else { cavities[a] = 0.0; @@ -3964,7 +3962,7 @@ static void proj_paint_state_vert_flags_init(ProjPaintState *ps) ps->vertFlags = MEM_callocN(sizeof(char) * ps->totvert_eval, "paint-vertFlags"); for (a = 0, mv = ps->mvert_eval; a < ps->totvert_eval; a++, mv++) { - normal_short_to_float_v3(no, mv->no); + copy_v3_v3(no, ps->vert_normals[a]); if (UNLIKELY(ps->is_flip_object)) { negate_v3(no); } @@ -4064,6 +4062,7 @@ static bool proj_paint_state_mesh_eval_init(const bContext *C, ProjPaintState *p ps->mat_array[totmat - 1] = NULL; ps->mvert_eval = ps->me_eval->mvert; + ps->vert_normals = BKE_mesh_vertex_normals_ensure(ps->me_eval); if (ps->do_mask_cavity) { ps->medge_eval = ps->me_eval->medge; } diff --git a/source/blender/editors/sculpt_paint/paint_vertex.c b/source/blender/editors/sculpt_paint/paint_vertex.c index 23e03f3e576..df323baa2a9 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex.c +++ b/source/blender/editors/sculpt_paint/paint_vertex.c @@ -1735,13 +1735,6 @@ static bool wpaint_stroke_test_start(bContext *C, wmOperator *op, const float mo return true; } -static float dot_vf3vs3(const float brushNormal[3], const short vertexNormal[3]) -{ - float normal[3]; - normal_short_to_float_v3(normal, vertexNormal); - return dot_v3v3(brushNormal, normal); -} - static void get_brush_alpha_data(const Scene *scene, const SculptSession *ss, const Brush *brush, @@ -1868,7 +1861,7 @@ static void do_wpaint_brush_blur_task_cb_ex(void *__restrict userdata, if (total_hit_loops != 0) { float brush_strength = cache->bstrength; const float angle_cos = (use_normal && vd.no) ? - dot_vf3vs3(sculpt_normal_frontface, vd.no) : + dot_v3v3(sculpt_normal_frontface, vd.no) : 1.0f; if (((brush->flag & BRUSH_FRONTFACE) == 0 || (angle_cos > 0.0f)) && ((brush->flag & BRUSH_FRONTFACE_FALLOFF) == 0 || @@ -1948,7 +1941,7 @@ static void do_wpaint_brush_smear_task_cb_ex(void *__restrict userdata, if (!(use_face_sel || use_vert_sel) || mv_curr->flag & SELECT) { float brush_strength = cache->bstrength; const float angle_cos = (use_normal && vd.no) ? - dot_vf3vs3(sculpt_normal_frontface, vd.no) : + dot_v3v3(sculpt_normal_frontface, vd.no) : 1.0f; if (((brush->flag & BRUSH_FRONTFACE) == 0 || (angle_cos > 0.0f)) && ((brush->flag & BRUSH_FRONTFACE_FALLOFF) == 0 || @@ -2054,9 +2047,8 @@ static void do_wpaint_brush_draw_task_cb_ex(void *__restrict userdata, /* If the vertex is selected */ if (!(use_face_sel || use_vert_sel) || v_flag & SELECT) { float brush_strength = cache->bstrength; - const float angle_cos = (use_normal && vd.no) ? - dot_vf3vs3(sculpt_normal_frontface, vd.no) : - 1.0f; + const float angle_cos = (use_normal && vd.no) ? dot_v3v3(sculpt_normal_frontface, vd.no) : + 1.0f; if (((brush->flag & BRUSH_FRONTFACE) == 0 || (angle_cos > 0.0f)) && ((brush->flag & BRUSH_FRONTFACE_FALLOFF) == 0 || view_angle_limits_apply_falloff( @@ -2111,7 +2103,7 @@ static void do_wpaint_brush_calc_average_weight_cb_ex( BKE_pbvh_vertex_iter_begin (ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) { /* Test to see if the vertex coordinates are within the spherical brush region. */ if (sculpt_brush_test_sq_fn(&test, vd.co)) { - const float angle_cos = (use_normal && vd.no) ? dot_vf3vs3(sculpt_normal_frontface, vd.no) : + const float angle_cos = (use_normal && vd.no) ? dot_v3v3(sculpt_normal_frontface, vd.no) : 1.0f; if (angle_cos > 0.0 && BKE_brush_curve_strength(data->brush, sqrtf(test.dist), cache->radius) > 0.0) { @@ -2895,9 +2887,8 @@ static void do_vpaint_brush_draw_task_cb_ex(void *__restrict userdata, /* Calc the dot prod. between ray norm on surf and current vert * (ie splash prevention factor), and only paint front facing verts. */ float brush_strength = cache->bstrength; - const float angle_cos = (use_normal && vd.no) ? - dot_vf3vs3(sculpt_normal_frontface, vd.no) : - 1.0f; + const float angle_cos = (use_normal && vd.no) ? dot_v3v3(sculpt_normal_frontface, vd.no) : + 1.0f; if (((brush->flag & BRUSH_FRONTFACE) == 0 || (angle_cos > 0.0f)) && ((brush->flag & BRUSH_FRONTFACE_FALLOFF) == 0 || view_angle_limits_apply_falloff( @@ -2990,9 +2981,8 @@ static void do_vpaint_brush_blur_task_cb_ex(void *__restrict userdata, /* If the vertex is selected for painting. */ if (!use_vert_sel || mv->flag & SELECT) { float brush_strength = cache->bstrength; - const float angle_cos = (use_normal && vd.no) ? - dot_vf3vs3(sculpt_normal_frontface, vd.no) : - 1.0f; + const float angle_cos = (use_normal && vd.no) ? dot_v3v3(sculpt_normal_frontface, vd.no) : + 1.0f; if (((brush->flag & BRUSH_FRONTFACE) == 0 || (angle_cos > 0.0f)) && ((brush->flag & BRUSH_FRONTFACE_FALLOFF) == 0 || view_angle_limits_apply_falloff( @@ -3116,7 +3106,7 @@ static void do_vpaint_brush_smear_task_cb_ex(void *__restrict userdata, * (ie splash prevention factor), and only paint front facing verts. */ float brush_strength = cache->bstrength; const float angle_cos = (use_normal && vd.no) ? - dot_vf3vs3(sculpt_normal_frontface, vd.no) : + dot_v3v3(sculpt_normal_frontface, vd.no) : 1.0f; if (((brush->flag & BRUSH_FRONTFACE) == 0 || (angle_cos > 0.0f)) && ((brush->flag & BRUSH_FRONTFACE_FALLOFF) == 0 || diff --git a/source/blender/editors/sculpt_paint/paint_vertex_proj.c b/source/blender/editors/sculpt_paint/paint_vertex_proj.c index 85cd211367a..9d5fffdcfcc 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_proj.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_proj.c @@ -72,8 +72,10 @@ struct VertProjUpdate { /* -------------------------------------------------------------------- */ /* Internal Init */ -static void vpaint_proj_dm_map_cosnos_init__map_cb( - void *userData, int index, const float co[3], const float no_f[3], const short no_s[3]) +static void vpaint_proj_dm_map_cosnos_init__map_cb(void *userData, + int index, + const float co[3], + const float no[3]) { struct VertProjHandle *vp_handle = userData; CoNo *co_no = &vp_handle->vcosnos[index]; @@ -86,12 +88,7 @@ static void vpaint_proj_dm_map_cosnos_init__map_cb( } copy_v3_v3(co_no->co, co); - if (no_f) { - copy_v3_v3(co_no->no, no_f); - } - else { - normal_short_to_float_v3(co_no->no, no_s); - } + copy_v3_v3(co_no->no, no); } static void vpaint_proj_dm_map_cosnos_init(struct Depsgraph *depsgraph, @@ -116,8 +113,10 @@ static void vpaint_proj_dm_map_cosnos_init(struct Depsgraph *depsgraph, /* Same as init but take mouse location into account */ -static void vpaint_proj_dm_map_cosnos_update__map_cb( - void *userData, int index, const float co[3], const float no_f[3], const short no_s[3]) +static void vpaint_proj_dm_map_cosnos_update__map_cb(void *userData, + int index, + const float co[3], + const float no[3]) { struct VertProjUpdate *vp_update = userData; struct VertProjHandle *vp_handle = vp_update->vp_handle; @@ -148,12 +147,7 @@ static void vpaint_proj_dm_map_cosnos_update__map_cb( /* continue with regular functionality */ copy_v3_v3(co_no->co, co); - if (no_f) { - copy_v3_v3(co_no->no, no_f); - } - else { - normal_short_to_float_v3(co_no->no, no_s); - } + copy_v3_v3(co_no->no, no); } static void vpaint_proj_dm_map_cosnos_update(struct Depsgraph *depsgraph, diff --git a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c index d10a56be866..1dfc4db6ac3 100644 --- a/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c +++ b/source/blender/editors/sculpt_paint/paint_vertex_weight_ops.c @@ -665,8 +665,7 @@ static void gradientVert_update(WPGradient_userData *grad_data, int index) static void gradientVertUpdate__mapFunc(void *userData, int index, const float UNUSED(co[3]), - const float UNUSED(no_f[3]), - const short UNUSED(no_s[3])) + const float UNUSED(no[3])) { WPGradient_userData *grad_data = userData; WPGradient_vertStore *vs = &grad_data->vert_cache->elem[index]; @@ -681,8 +680,7 @@ static void gradientVertUpdate__mapFunc(void *userData, static void gradientVertInit__mapFunc(void *userData, int index, const float co[3], - const float UNUSED(no_f[3]), - const short UNUSED(no_s[3])) + const float UNUSED(no[3])) { WPGradient_userData *grad_data = userData; Mesh *me = grad_data->me; diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index 02886643cb4..5ac13ebdd93 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -177,11 +177,11 @@ void SCULPT_vertex_normal_get(SculptSession *ss, int index, float no[3]) switch (BKE_pbvh_type(ss->pbvh)) { case PBVH_FACES: { if (ss->shapekey_active || ss->deform_modifiers_active) { - const MVert *mverts = BKE_pbvh_get_verts(ss->pbvh); - normal_short_to_float_v3(no, mverts[index].no); + const float(*vert_normals)[3] = BKE_pbvh_get_vert_normals(ss->pbvh); + copy_v3_v3(no, vert_normals[index]); } else { - normal_short_to_float_v3(no, ss->mvert[index].no); + copy_v3_v3(no, ss->vert_normals[index]); } break; } @@ -1387,10 +1387,10 @@ static void paint_mesh_restore_co_task_cb(void *__restrict userdata, if (orig_data.unode->type == SCULPT_UNDO_COORDS) { copy_v3_v3(vd.co, orig_data.co); if (vd.no) { - copy_v3_v3_short(vd.no, orig_data.no); + copy_v3_v3(vd.no, orig_data.no); } else { - normal_short_to_float_v3(vd.fno, orig_data.no); + copy_v3_v3(vd.fno, orig_data.no); } } else if (orig_data.unode->type == SCULPT_UNDO_MASK) { @@ -1689,7 +1689,7 @@ const float *SCULPT_brush_frontface_normal_from_falloff_shape(SculptSession *ss, static float frontface(const Brush *br, const float sculpt_normal[3], - const short no[3], + const float no[3], const float fno[3]) { if (!(br->flag & BRUSH_FRONTFACE)) { @@ -1698,10 +1698,7 @@ static float frontface(const Brush *br, float dot; if (no) { - float tmp[3]; - - normal_short_to_float_v3(tmp, no); - dot = dot_v3v3(tmp, sculpt_normal); + dot = dot_v3v3(no, sculpt_normal); } else { dot = dot_v3v3(fno, sculpt_normal); @@ -1938,19 +1935,19 @@ static void calc_area_normal_and_center_task_cb(void *__restrict userdata, float co[3]; /* For bm_vert only. */ - short no_s[3]; + float no_s[3]; if (use_original) { if (unode->bm_entry) { const float *temp_co; - const short *temp_no_s; + const float *temp_no_s; BM_log_original_vert_data(ss->bm_log, vd.bm_vert, &temp_co, &temp_no_s); copy_v3_v3(co, temp_co); - copy_v3_v3_short(no_s, temp_no_s); + copy_v3_v3(no_s, temp_no_s); } else { copy_v3_v3(co, unode->co[vd.i]); - copy_v3_v3_short(no_s, unode->no[vd.i]); + copy_v3_v3(no_s, unode->no[vd.i]); } } else { @@ -1970,11 +1967,11 @@ static void calc_area_normal_and_center_task_cb(void *__restrict userdata, data->any_vertex_sampled = true; if (use_original) { - normal_short_to_float_v3(no, no_s); + copy_v3_v3(no, no_s); } else { if (vd.no) { - normal_short_to_float_v3(no, vd.no); + copy_v3_v3(no, vd.no); } else { copy_v3_v3(no, vd.fno); @@ -2350,7 +2347,7 @@ float SCULPT_brush_strength_factor(SculptSession *ss, const Brush *br, const float brush_point[3], const float len, - const short vno[3], + const float vno[3], const float fno[3], const float mask, const int vertex_index, @@ -3652,11 +3649,6 @@ void SCULPT_flush_stroke_deform(Sculpt *sd, Object *ob, bool is_proxy_used) } MEM_SAFE_FREE(nodes); - - /* Modifiers could depend on mesh normals, so we should update them. - * NOTE: then if sculpting happens on locked key, normals should be re-calculate after applying - * coords from key-block on base mesh. */ - BKE_mesh_calc_normals(me); } else if (ss->shapekey_active) { sculpt_update_keyblock(ob); diff --git a/source/blender/editors/sculpt_paint/sculpt_boundary.c b/source/blender/editors/sculpt_paint/sculpt_boundary.c index e238fafb063..1e41c5cdbdf 100644 --- a/source/blender/editors/sculpt_paint/sculpt_boundary.c +++ b/source/blender/editors/sculpt_paint/sculpt_boundary.c @@ -772,12 +772,10 @@ static void do_boundary_brush_inflate_task_cb_ex(void *__restrict userdata, const float mask = vd.mask ? 1.0f - *vd.mask : 1.0f; const float automask = SCULPT_automasking_factor_get(ss->cache->automasking, ss, vd.index); - float normal[3]; - normal_short_to_float_v3(normal, orig_data.no); float *target_co = SCULPT_brush_deform_target_vertex_co_get(ss, brush->deform_target, &vd); madd_v3_v3v3fl(target_co, orig_data.co, - normal, + orig_data.no, boundary->edit_info[vd.index].strength_factor * disp * mask * automask * strength); diff --git a/source/blender/editors/sculpt_paint/sculpt_brush_types.c b/source/blender/editors/sculpt_paint/sculpt_brush_types.c index 8842d93410c..c2acc361a79 100644 --- a/source/blender/editors/sculpt_paint/sculpt_brush_types.c +++ b/source/blender/editors/sculpt_paint/sculpt_brush_types.c @@ -1544,7 +1544,7 @@ static void do_layer_brush_task_cb_ex(void *__restrict userdata, madd_v3_v3v3fl(final_co, SCULPT_vertex_persistent_co_get(ss, vi), normal, *disp_factor); } else { - normal_short_to_float_v3(normal, orig_data.no); + copy_v3_v3(normal, orig_data.no); mul_v3_fl(normal, brush->height); madd_v3_v3v3fl(final_co, orig_data.co, normal, *disp_factor); } @@ -1623,7 +1623,7 @@ static void do_inflate_brush_task_cb_ex(void *__restrict userdata, copy_v3_v3(val, vd.fno); } else { - normal_short_to_float_v3(val, vd.no); + copy_v3_v3(val, vd.no); } mul_v3_fl(val, fade * ss->cache->radius); @@ -2002,7 +2002,7 @@ static void do_grab_brush_task_cb_ex(void *__restrict userdata, mul_v3_fl(silhouette_test_dir, -1.0f); } float vno[3]; - normal_short_to_float_v3(vno, orig_data.no); + copy_v3_v3(vno, orig_data.no); fade *= max_ff(dot_v3v3(vno, silhouette_test_dir), 0.0f); } diff --git a/source/blender/editors/sculpt_paint/sculpt_cloth.c b/source/blender/editors/sculpt_paint/sculpt_cloth.c index dcfd7f7bcdc..3ac57d73d37 100644 --- a/source/blender/editors/sculpt_paint/sculpt_cloth.c +++ b/source/blender/editors/sculpt_paint/sculpt_cloth.c @@ -560,13 +560,6 @@ static void do_cloth_brush_apply_forces_task_cb_ex(void *__restrict userdata, thread_id); float brush_disp[3]; - float normal[3]; - if (vd.no) { - normal_short_to_float_v3(normal, vd.no); - } - else { - copy_v3_v3(normal, vd.fno); - } switch (brush->cloth_deform_type) { case BRUSH_CLOTH_DEFORM_DRAG: @@ -621,7 +614,7 @@ static void do_cloth_brush_apply_forces_task_cb_ex(void *__restrict userdata, mul_v3_v3fl(force, disp_center, fade); } break; case BRUSH_CLOTH_DEFORM_INFLATE: - mul_v3_v3fl(force, normal, fade); + mul_v3_v3fl(force, vd.no ? vd.no : vd.fno, fade); break; case BRUSH_CLOTH_DEFORM_EXPAND: cloth_sim->length_constraint_tweak[vd.index] += fade * 0.1f; diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mask.c b/source/blender/editors/sculpt_paint/sculpt_filter_mask.c index 10f141e2311..cf45e25142b 100644 --- a/source/blender/editors/sculpt_paint/sculpt_filter_mask.c +++ b/source/blender/editors/sculpt_paint/sculpt_filter_mask.c @@ -334,14 +334,7 @@ static float neighbor_dirty_mask(SculptSession *ss, PBVHVertexIter *vd) if (total > 0) { mul_v3_fl(avg, 1.0f / total); - float normal[3]; - if (vd->no) { - normal_short_to_float_v3(normal, vd->no); - } - else { - copy_v3_v3(normal, vd->fno); - } - float dot = dot_v3v3(avg, normal); + float dot = dot_v3v3(avg, vd->no ? vd->no : vd->fno); float angle = max_ff(saacosf(dot), 0.0f); return angle; } diff --git a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c index ff1a8935ba0..2d8bdc4e4ac 100644 --- a/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c +++ b/source/blender/editors/sculpt_paint/sculpt_filter_mesh.c @@ -303,7 +303,7 @@ static void mesh_filter_task_cb(void *__restrict userdata, PBVHVertexIter vd; BKE_pbvh_vertex_iter_begin (ss->pbvh, node, vd, PBVH_ITER_UNIQUE) { SCULPT_orig_vert_data_update(&orig_data, &vd); - float orig_co[3], val[3], avg[3], normal[3], disp[3], disp2[3], transform[3][3], final_pos[3]; + float orig_co[3], val[3], avg[3], disp[3], disp2[3], transform[3][3], final_pos[3]; float fade = vd.mask ? *vd.mask : 0.0f; fade = 1.0f - fade; fade *= data->filter_strength; @@ -339,8 +339,7 @@ static void mesh_filter_task_cb(void *__restrict userdata, sub_v3_v3v3(disp, val, orig_co); break; case MESH_FILTER_INFLATE: - normal_short_to_float_v3(normal, orig_data.no); - mul_v3_v3fl(disp, normal, fade); + mul_v3_v3fl(disp, orig_data.no, fade); break; case MESH_FILTER_SCALE: unit_m3(transform); @@ -372,7 +371,8 @@ static void mesh_filter_task_cb(void *__restrict userdata, mid_v3_v3v3(disp, disp, disp2); break; case MESH_FILTER_RANDOM: { - normal_short_to_float_v3(normal, orig_data.no); + float normal[3]; + copy_v3_v3(normal, orig_data.no); /* Index is not unique for multires, so hash by vertex coordinates. */ const uint *hash_co = (const uint *)orig_co; const uint hash = BLI_hash_int_2d(hash_co[0], hash_co[1]) ^ @@ -432,7 +432,6 @@ static void mesh_filter_task_cb(void *__restrict userdata, /* Intensify details. */ if (ss->filter_cache->sharpen_intensify_detail_strength > 0.0f) { float detail_strength[3]; - normal_short_to_float_v3(detail_strength, orig_data.no); copy_v3_v3(detail_strength, ss->filter_cache->detail_directions[vd.index]); madd_v3_v3fl(disp, detail_strength, diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index c5abc0b1640..5034251e973 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -262,13 +262,13 @@ typedef struct { struct SculptUndoNode *unode; float (*coords)[3]; - short (*normals)[3]; + float (*normals)[3]; const float *vmasks; float (*colors)[4]; /* Original coordinate, normal, and mask. */ const float *co; - const short *no; + const float *no; float mask; const float *col; } SculptOrigVertData; @@ -723,7 +723,7 @@ typedef struct SculptUndoNode { float (*co)[3]; float (*orig_co)[3]; - short (*no)[3]; + float (*no)[3]; float (*col)[4]; float *mask; int totvert; @@ -967,7 +967,7 @@ float SCULPT_brush_strength_factor(struct SculptSession *ss, const struct Brush *br, const float point[3], float len, - const short vno[3], + const float vno[3], const float fno[3], float mask, int vertex_index, diff --git a/source/blender/editors/sculpt_paint/sculpt_multiplane_scrape.c b/source/blender/editors/sculpt_paint/sculpt_multiplane_scrape.c index 05db799cb00..0fec7a9c4bd 100644 --- a/source/blender/editors/sculpt_paint/sculpt_multiplane_scrape.c +++ b/source/blender/editors/sculpt_paint/sculpt_multiplane_scrape.c @@ -92,12 +92,7 @@ static void calc_multiplane_scrape_surface_task_cb(void *__restrict userdata, } float local_co[3]; float normal[3]; - if (vd.no) { - normal_short_to_float_v3(normal, vd.no); - } - else { - copy_v3_v3(normal, vd.fno); - } + copy_v3_v3(normal, vd.no ? vd.no : vd.fno); mul_v3_m4v3(local_co, mat, vd.co); /* Use the brush falloff to weight the sampled normals. */ const float fade = SCULPT_brush_strength_factor(ss, diff --git a/source/blender/editors/sculpt_paint/sculpt_undo.c b/source/blender/editors/sculpt_paint/sculpt_undo.c index 4a88b75cf25..8819496c168 100644 --- a/source/blender/editors/sculpt_paint/sculpt_undo.c +++ b/source/blender/editors/sculpt_paint/sculpt_undo.c @@ -1107,10 +1107,10 @@ static void sculpt_undo_store_coords(Object *ob, SculptUndoNode *unode) BKE_pbvh_vertex_iter_begin (ss->pbvh, unode->node, vd, PBVH_ITER_ALL) { copy_v3_v3(unode->co[vd.i], vd.co); if (vd.no) { - copy_v3_v3_short(unode->no[vd.i], vd.no); + copy_v3_v3(unode->no[vd.i], vd.no); } else { - normal_float_to_short_v3(unode->no[vd.i], vd.fno); + copy_v3_v3(unode->no[vd.i], vd.fno); } if (ss->deform_modifiers_active) { |