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 8,295 Lines • ▼ Show 20 Lines | static void do_fake_neighbor_search_task_cb(void *__restrict userdata, | ||||
| NearestVertexFakeNeighborTLSData *nvtd = tls->userdata_chunk; | NearestVertexFakeNeighborTLSData *nvtd = tls->userdata_chunk; | ||||
| PBVHVertexIter vd; | PBVHVertexIter vd; | ||||
| 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) | ||||
| { | { | ||||
| int vd_topology_id = SCULPT_vertex_get_connected_component(ss, vd.index); | int vd_topology_id = SCULPT_vertex_get_connected_component(ss, vd.index); | ||||
| if (vd_topology_id != nvtd->current_topology_id && | if (vd_topology_id != nvtd->current_topology_id && | ||||
| ss->fake_neighbors.fake_neighbor_index[vd.index] == FAKE_NEIGHBOR_NONE) { | ss->fake_neighbors.fake_neighbor_index[vd.index] == FAKE_NEIGHBOR_NONE) { | ||||
| float distance_squared = len_squared_v3v3(vd.co, data->nearest_vertex_search_co); | |||||
| const float *p1 = sculpt_vertex_persistent_co_get(ss, vd.index); | |||||
| const float *p2 = sculpt_vertex_persistent_co_get(ss, data->nearest_vertex_search_index); | |||||
| float distance_squared = len_squared_v3v3(p1, p2); | |||||
| if (distance_squared < nvtd->nearest_vertex_distance_squared && | if (distance_squared < nvtd->nearest_vertex_distance_squared && | ||||
| distance_squared < data->max_distance_squared) { | distance_squared < data->max_distance_squared) { | ||||
| nvtd->nearest_vertex_index = vd.index; | nvtd->nearest_vertex_index = vd.index; | ||||
| nvtd->nearest_vertex_distance_squared = distance_squared; | nvtd->nearest_vertex_distance_squared = distance_squared; | ||||
| } | } | ||||
| } | } | ||||
| } | } | ||||
| BKE_pbvh_vertex_iter_end; | BKE_pbvh_vertex_iter_end; | ||||
| Show All 36 Lines | static int SCULPT_fake_neighbor_search(Sculpt *sd, Object *ob, const int index, float max_distance) | ||||
| SculptThreadedTaskData task_data = { | SculptThreadedTaskData task_data = { | ||||
| .sd = sd, | .sd = sd, | ||||
| .ob = ob, | .ob = ob, | ||||
| .nodes = nodes, | .nodes = nodes, | ||||
| .max_distance_squared = max_distance * max_distance, | .max_distance_squared = max_distance * max_distance, | ||||
| }; | }; | ||||
| copy_v3_v3(task_data.nearest_vertex_search_co, SCULPT_vertex_co_get(ss, index)); | copy_v3_v3(task_data.nearest_vertex_search_co, SCULPT_vertex_co_get(ss, index)); | ||||
| task_data.nearest_vertex_search_index = index; | |||||
| NearestVertexFakeNeighborTLSData nvtd; | NearestVertexFakeNeighborTLSData nvtd; | ||||
| nvtd.nearest_vertex_index = -1; | nvtd.nearest_vertex_index = -1; | ||||
| nvtd.nearest_vertex_distance_squared = FLT_MAX; | nvtd.nearest_vertex_distance_squared = FLT_MAX; | ||||
| nvtd.current_topology_id = SCULPT_vertex_get_connected_component(ss, index); | nvtd.current_topology_id = SCULPT_vertex_get_connected_component(ss, index); | ||||
| TaskParallelSettings settings; | TaskParallelSettings settings; | ||||
| BKE_pbvh_parallel_range_settings(&settings, true, totnode); | BKE_pbvh_parallel_range_settings(&settings, true, totnode); | ||||
| ▲ Show 20 Lines • Show All 432 Lines • Show Last 20 Lines | |||||