Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/sculpt.c
- This file is larger than 256 KB, so syntax highlighting is disabled by default.
| Show First 20 Lines • Show All 3,799 Lines • ▼ Show 20 Lines | static void do_grab_brush_task_cb_ex(void *__restrict userdata, | ||||
| proxy = BKE_pbvh_node_add_proxy(ss->pbvh, data->nodes[n])->co; | proxy = BKE_pbvh_node_add_proxy(ss->pbvh, data->nodes[n])->co; | ||||
| SculptBrushTest test; | SculptBrushTest test; | ||||
| SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape( | SculptBrushTestFn sculpt_brush_test_sq_fn = SCULPT_brush_test_init_with_falloff_shape( | ||||
| ss, &test, data->brush->falloff_shape); | ss, &test, data->brush->falloff_shape); | ||||
| const int thread_id = BLI_task_parallel_thread_id(tls); | const int thread_id = BLI_task_parallel_thread_id(tls); | ||||
| const bool grab_silhouette = brush->flag2 & BRUSH_GRAB_SILHOUETTE; | |||||
| BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) | BKE_pbvh_vertex_iter_begin(ss->pbvh, data->nodes[n], vd, PBVH_ITER_UNIQUE) | ||||
| { | { | ||||
| SCULPT_orig_vert_data_update(&orig_data, &vd); | SCULPT_orig_vert_data_update(&orig_data, &vd); | ||||
| if (sculpt_brush_test_sq_fn(&test, orig_data.co)) { | if (sculpt_brush_test_sq_fn(&test, orig_data.co)) { | ||||
| const float fade = bstrength * SCULPT_brush_strength_factor(ss, | float fade = bstrength * SCULPT_brush_strength_factor(ss, | ||||
| brush, | brush, | ||||
| orig_data.co, | orig_data.co, | ||||
| sqrtf(test.dist), | sqrtf(test.dist), | ||||
| orig_data.no, | orig_data.no, | ||||
| NULL, | NULL, | ||||
| vd.mask ? *vd.mask : 0.0f, | vd.mask ? *vd.mask : 0.0f, | ||||
| vd.index, | vd.index, | ||||
| thread_id); | thread_id); | ||||
| if (grab_silhouette) { | |||||
| float silhouette_test_dir[3]; | |||||
| normalize_v3_v3(silhouette_test_dir, grab_delta); | |||||
| if (dot_v3v3(ss->cache->initial_normal, ss->cache->grab_delta) < 0.0f) { | |||||
| mul_v3_fl(silhouette_test_dir, -1.0f); | |||||
| } | |||||
| float vno[3]; | |||||
| normal_short_to_float_v3(vno, orig_data.no); | |||||
| fade *= max_ff(dot_v3v3(vno, silhouette_test_dir), 0.0f); | |||||
| } | |||||
| mul_v3_v3fl(proxy[vd.i], grab_delta, fade); | mul_v3_v3fl(proxy[vd.i], grab_delta, fade); | ||||
| if (vd.mvert) { | if (vd.mvert) { | ||||
| vd.mvert->flag |= ME_VERT_PBVH_UPDATE; | vd.mvert->flag |= ME_VERT_PBVH_UPDATE; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| BKE_pbvh_vertex_iter_end; | BKE_pbvh_vertex_iter_end; | ||||
| ▲ Show 20 Lines • Show All 5,430 Lines • Show Last 20 Lines | |||||