Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt_filter_mesh.c
| Show First 20 Lines • Show All 339 Lines • ▼ Show 20 Lines | switch (filter_type) { | ||||
| } | } | ||||
| case MESH_FILTER_SHARPEN: { | case MESH_FILTER_SHARPEN: { | ||||
| const float smooth_ratio = ss->filter_cache->sharpen_smooth_ratio; | const float smooth_ratio = ss->filter_cache->sharpen_smooth_ratio; | ||||
| /* This filter can't work at full strength as it needs multiple iterations to reach a | /* This filter can't work at full strength as it needs multiple iterations to reach a | ||||
| * stable state. */ | * stable state. */ | ||||
| fade = clamp_f(fade, 0.0f, 0.5f); | fade = clamp_f(fade, 0.0f, 0.5f); | ||||
| float disp_sharpen[3]; | float disp_sharpen[3]; | ||||
| copy_v3_v3(disp_sharpen, ss->filter_cache->accum_disp[vd.index]); | copy_v3_v3(disp_sharpen, ss->filter_cache->accum_disp[vd.index]); | ||||
sergey: float disp_sharpen[3] = {0.0f, 0.0f, 0.0f}; | |||||
| mul_v3_fl(disp_sharpen, 1.0f - ss->filter_cache->sharpen_factor[vd.index]); | mul_v3_fl(disp_sharpen, 1.0f - ss->filter_cache->sharpen_factor[vd.index]); | ||||
| float disp_avg[3]; | float disp_avg[3]; | ||||
| float avg_co[3]; | float avg_co[3]; | ||||
| SCULPT_neighbor_coords_average(ss, avg_co, vd.index); | SCULPT_neighbor_coords_average(ss, avg_co, vd.index); | ||||
| sub_v3_v3v3(disp_avg, avg_co, vd.co); | sub_v3_v3v3(disp_avg, avg_co, vd.co); | ||||
| mul_v3_v3fl( | mul_v3_v3fl( | ||||
| disp_avg, disp_avg, smooth_ratio * pow2f(ss->filter_cache->sharpen_factor[vd.index])); | disp_avg, disp_avg, smooth_ratio * pow2f(ss->filter_cache->sharpen_factor[vd.index])); | ||||
| ▲ Show 20 Lines • Show All 51 Lines • ▼ Show 20 Lines | static void mesh_filter_sharpen_accumulate_displacement(SculptSession *ss) | ||||
| const int totvert = SCULPT_vertex_count_get(ss); | const int totvert = SCULPT_vertex_count_get(ss); | ||||
| for (int i = 0; i < totvert; i++) { | for (int i = 0; i < totvert; i++) { | ||||
| zero_v3(ss->filter_cache->accum_disp[i]); | zero_v3(ss->filter_cache->accum_disp[i]); | ||||
| } | } | ||||
| for (int i = 0; i < totvert; i++) { | for (int i = 0; i < totvert; i++) { | ||||
| SculptVertexNeighborIter ni; | SculptVertexNeighborIter ni; | ||||
| SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, i, ni) { | SCULPT_VERTEX_NEIGHBORS_ITER_BEGIN (ss, i, ni) { | ||||
| float disp_n[3]; | float disp_n[3]; | ||||
| sub_v3_v3v3(disp_n, SCULPT_vertex_co_get(ss, i), SCULPT_vertex_co_get(ss, ni.index)); | sub_v3_v3v3(disp_n, SCULPT_vertex_co_get(ss, ni.index), SCULPT_vertex_co_get(ss, i)); | ||||
| mul_v3_fl(disp_n, ss->filter_cache->sharpen_factor[i]); | mul_v3_fl(disp_n, ss->filter_cache->sharpen_factor[ni.index]); | ||||
| add_v3_v3(ss->filter_cache->accum_disp[ni.index], disp_n); | add_v3_v3(ss->filter_cache->accum_disp[i], disp_n); | ||||
| } | } | ||||
| SCULPT_VERTEX_NEIGHBORS_ITER_END(ni); | SCULPT_VERTEX_NEIGHBORS_ITER_END(ni); | ||||
| } | } | ||||
| } | } | ||||
| static void mesh_filter_surface_smooth_displace_task_cb( | static void mesh_filter_surface_smooth_displace_task_cb( | ||||
| void *__restrict userdata, const int i, const TaskParallelTLS *__restrict UNUSED(tls)) | void *__restrict userdata, const int i, const TaskParallelTLS *__restrict UNUSED(tls)) | ||||
| { | { | ||||
| ▲ Show 20 Lines • Show All 246 Lines • Show Last 20 Lines | |||||
float disp_sharpen[3] = {0.0f, 0.0f, 0.0f};