Curves: initial surface collision for curves sculpt mode #104469
|
@ -71,7 +71,7 @@ struct ConstraintSolver {
|
|||
use_surface_collision_ = use_surface_collision;
|
||||
segment_lengths_.reinitialize(curves.points_num());
|
||||
geometry::curve_constraint_solver::compute_segment_lengths(
|
||||
curves, curve_selection, segment_lengths_);
|
||||
curves.points_by_curve(), curves.positions(), curve_selection, segment_lengths_);
|
||||
if (use_surface_collision_) {
|
||||
start_positions_ = curves.positions();
|
||||
}
|
||||
|
@ -84,7 +84,7 @@ struct ConstraintSolver {
|
|||
{
|
||||
if (use_surface_collision_) {
|
||||
geometry::curve_constraint_solver::solve_length_and_collision_constraints(
|
||||
curves,
|
||||
curves.points_by_curve(),
|
||||
curve_selection,
|
||||
segment_lengths_,
|
||||
start_positions_,
|
||||
|
@ -94,8 +94,10 @@ struct ConstraintSolver {
|
|||
start_positions_ = curves.positions();
|
||||
}
|
||||
else {
|
||||
geometry::curve_constraint_solver::solve_length_constraints(
|
||||
curves, curve_selection, segment_lengths_, curves.positions_for_write());
|
||||
geometry::curve_constraint_solver::solve_length_constraints(curves.points_by_curve(),
|
||||
curve_selection,
|
||||
segment_lengths_,
|
||||
curves.positions_for_write());
|
||||
}
|
||||
curves.tag_positions_changed();
|
||||
}
|
||||
|
|
|
@ -6,16 +6,17 @@
|
|||
|
||||
namespace blender::geometry::curve_constraint_solver {
|
||||
JacquesLucke marked this conversation as resolved
|
||||
|
||||
void compute_segment_lengths(const bke::CurvesGeometry &curves,
|
||||
void compute_segment_lengths(OffsetIndices<int> points_by_curve,
|
||||
Span<float3> positions,
|
||||
IndexMask curve_selection,
|
||||
MutableSpan<float> r_segment_lengths);
|
||||
|
||||
void solve_length_constraints(const bke::CurvesGeometry &curves,
|
||||
void solve_length_constraints(OffsetIndices<int> points_by_curve,
|
||||
IndexMask curve_selection,
|
||||
Span<float> segment_lenghts,
|
||||
MutableSpan<float3> positions);
|
||||
|
||||
void solve_length_and_collision_constraints(const bke::CurvesGeometry &curves,
|
||||
void solve_length_and_collision_constraints(OffsetIndices<int> points_by_curve,
|
||||
IndexMask curve_selection,
|
||||
Span<float> segment_lengths,
|
||||
Span<float3> start_positions,
|
||||
|
@ -23,6 +24,4 @@ void solve_length_and_collision_constraints(const bke::CurvesGeometry &curves,
|
|||
const bke::CurvesSurfaceTransforms &transforms,
|
||||
MutableSpan<float3> positions);
|
||||
|
||||
|
||||
|
||||
} // namespace blender::geometry::curve_constraint_solver
|
||||
|
|
|
@ -4,14 +4,13 @@
|
|||
|
||||
namespace blender::geometry::curve_constraint_solver {
|
||||
|
||||
void compute_segment_lengths(const bke::CurvesGeometry &curves,
|
||||
void compute_segment_lengths(const OffsetIndices<int> points_by_curve,
|
||||
const Span<float3> positions,
|
||||
const IndexMask curve_selection,
|
||||
JacquesLucke marked this conversation as resolved
Hans Goudey
commented
Should probably have the note about the coordinate spaces in this file too Should probably have the note about the coordinate spaces in this file too
|
||||
MutableSpan<float> r_segment_lengths)
|
||||
{
|
||||
BLI_assert(r_segment_lengths.size() == curves.points_num());
|
||||
BLI_assert(r_segment_lengths.size() == points_by_curve.total_size());
|
||||
|
||||
const Span<float3> positions = curves.positions();
|
||||
const OffsetIndices points_by_curve = curves.points_by_curve();
|
||||
threading::parallel_for(curve_selection.index_range(), 256, [&](const IndexRange range) {
|
||||
for (const int curve_i : curve_selection.slice(range)) {
|
||||
const IndexRange points = points_by_curve[curve_i].drop_back(1);
|
||||
|
@ -25,14 +24,13 @@ void compute_segment_lengths(const bke::CurvesGeometry &curves,
|
|||
});
|
||||
}
|
||||
|
||||
void solve_length_constraints(const bke::CurvesGeometry &curves,
|
||||
void solve_length_constraints(const OffsetIndices<int> points_by_curve,
|
||||
const IndexMask curve_selection,
|
||||
const Span<float> segment_lenghts,
|
||||
MutableSpan<float3> positions)
|
||||
{
|
||||
BLI_assert(segment_lenghts.size() == curves.points_num());
|
||||
BLI_assert(segment_lenghts.size() == points_by_curve.total_size());
|
||||
|
||||
const OffsetIndices points_by_curve = curves.points_by_curve();
|
||||
threading::parallel_for(curve_selection.index_range(), 256, [&](const IndexRange range) {
|
||||
for (const int curve_i : curve_selection.slice(range)) {
|
||||
const IndexRange points = points_by_curve[curve_i].drop_back(1);
|
||||
|
@ -47,7 +45,7 @@ void solve_length_constraints(const bke::CurvesGeometry &curves,
|
|||
});
|
||||
}
|
||||
|
||||
void solve_length_and_collision_constraints(const bke::CurvesGeometry &curves,
|
||||
void solve_length_and_collision_constraints(const OffsetIndices<int> points_by_curve,
|
||||
const IndexMask curve_selection,
|
||||
const Span<float> segment_lengths,
|
||||
const Span<float3> start_positions,
|
||||
|
@ -55,8 +53,13 @@ void solve_length_and_collision_constraints(const bke::CurvesGeometry &curves,
|
|||
const bke::CurvesSurfaceTransforms &transforms,
|
||||
MutableSpan<float3> positions)
|
||||
{
|
||||
UNUSED_VARS(
|
||||
curves, curve_selection, segment_lengths, start_positions, surface, transforms, positions);
|
||||
UNUSED_VARS(points_by_curve,
|
||||
curve_selection,
|
||||
segment_lengths,
|
||||
start_positions,
|
||||
surface,
|
||||
transforms,
|
||||
positions);
|
||||
}
|
||||
|
||||
} // namespace blender::geometry::curve_constraint_solver
|
||||
|
|
Loading…
Reference in New Issue
Suggestion:
curve_constraint_solver
->curve_constraint(s)
I'm guessing the current name is left over from when it was more object oriented