Changeset View
Changeset View
Standalone View
Standalone View
source/blender/editors/sculpt_paint/curves_sculpt_brush.cc
| Show First 20 Lines • Show All 89 Lines • ▼ Show 20 Lines | BrushPositionCandidate best_candidate = threading::parallel_reduce( | ||||
| 128, | 128, | ||||
| BrushPositionCandidate(), | BrushPositionCandidate(), | ||||
| [&](IndexRange curves_range, const BrushPositionCandidate &init) { | [&](IndexRange curves_range, const BrushPositionCandidate &init) { | ||||
| BrushPositionCandidate best_candidate = init; | BrushPositionCandidate best_candidate = init; | ||||
| for (const int curve_i : curves_range) { | for (const int curve_i : curves_range) { | ||||
| const IndexRange points = curves.points_for_curve(curve_i); | const IndexRange points = curves.points_for_curve(curve_i); | ||||
| if (points.size() == 1) { | |||||
| const float3 &pos_cu = positions[points.first()]; | |||||
| const float depth_sq_cu = math::distance_squared(ray_start_cu, pos_cu); | |||||
| if (depth_sq_cu > max_depth_sq_cu) { | |||||
| continue; | |||||
| } | |||||
| float2 pos_re; | |||||
| ED_view3d_project_float_v2_m4(®ion, pos_cu, pos_re, projection.values); | |||||
| BrushPositionCandidate candidate; | |||||
| candidate.position_cu = pos_cu; | |||||
| candidate.depth_sq_cu = depth_sq_cu; | |||||
| candidate.distance_sq_re = math::distance_squared(brush_pos_re, pos_re); | |||||
| update_if_better(best_candidate, candidate); | |||||
| continue; | |||||
| } | |||||
| for (const int segment_i : points.drop_back(1)) { | for (const int segment_i : points.drop_back(1)) { | ||||
| const float3 &p1_cu = positions[segment_i]; | const float3 &p1_cu = positions[segment_i]; | ||||
| const float3 &p2_cu = positions[segment_i + 1]; | const float3 &p2_cu = positions[segment_i + 1]; | ||||
| float2 p1_re, p2_re; | float2 p1_re, p2_re; | ||||
| ED_view3d_project_float_v2_m4(®ion, p1_cu, p1_re, projection.values); | ED_view3d_project_float_v2_m4(®ion, p1_cu, p1_re, projection.values); | ||||
| ED_view3d_project_float_v2_m4(®ion, p2_cu, p2_re, projection.values); | ED_view3d_project_float_v2_m4(®ion, p2_cu, p2_re, projection.values); | ||||
| ▲ Show 20 Lines • Show All 155 Lines • Show Last 20 Lines | |||||