Cleanup: Use standard variable name for curve points
This commit is contained in:
parent
4944167dee
commit
3090edfecf
|
@ -397,10 +397,10 @@ static void curves_batch_cache_fill_strands_data(const Curves &curves_id,
|
|||
curves_id.geometry);
|
||||
|
||||
for (const int i : IndexRange(curves.curves_num())) {
|
||||
const IndexRange curve_range = curves.points_for_curve(i);
|
||||
const IndexRange points = curves.points_for_curve(i);
|
||||
|
||||
*(uint *)GPU_vertbuf_raw_step(&data_step) = curve_range.start();
|
||||
*(ushort *)GPU_vertbuf_raw_step(&seg_step) = curve_range.size() - 1;
|
||||
*(uint *)GPU_vertbuf_raw_step(&data_step) = points.start();
|
||||
*(ushort *)GPU_vertbuf_raw_step(&seg_step) = points.size() - 1;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -114,9 +114,9 @@ bke::CurvesGeometry primitive_random_sphere(const int curves_size, const int poi
|
|||
RandomNumberGenerator rng;
|
||||
|
||||
for (const int i : curves.curves_range()) {
|
||||
const IndexRange curve_range = curves.points_for_curve(i);
|
||||
MutableSpan<float3> curve_positions = positions.slice(curve_range);
|
||||
MutableSpan<float> curve_radii = radii.slice(curve_range);
|
||||
const IndexRange points = curves.points_for_curve(i);
|
||||
MutableSpan<float3> curve_positions = positions.slice(points);
|
||||
MutableSpan<float> curve_radii = radius.span.slice(points);
|
||||
|
||||
const float theta = 2.0f * M_PI * rng.get_float();
|
||||
const float phi = saacosf(2.0f * rng.get_float() - 1.0f);
|
||||
|
|
|
@ -144,21 +144,20 @@ class ExtrapolateCurvesEffect : public CurvesEffect {
|
|||
for (const int influence_i : range) {
|
||||
const int curve_i = curve_indices[influence_i];
|
||||
const float move_distance_cu = move_distances_cu[influence_i];
|
||||
const IndexRange curve_points = curves.points_for_curve(curve_i);
|
||||
const IndexRange points = curves.points_for_curve(curve_i);
|
||||
|
||||
if (curve_points.size() <= 1) {
|
||||
if (points.size() <= 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const float3 old_last_pos_cu = positions_cu[curve_points.last()];
|
||||
const float3 old_last_pos_cu = positions_cu[points.last()];
|
||||
/* Use some point within the curve rather than the end point to smooth out some random
|
||||
* variation. */
|
||||
const float3 direction_reference_point =
|
||||
positions_cu[curve_points[curve_points.size() / 2]];
|
||||
const float3 direction_reference_point = positions_cu[points[points.size() / 2]];
|
||||
const float3 direction = math::normalize(old_last_pos_cu - direction_reference_point);
|
||||
|
||||
const float3 new_last_pos_cu = old_last_pos_cu + direction * move_distance_cu;
|
||||
move_last_point_and_resample(positions_cu.slice(curve_points), new_last_pos_cu);
|
||||
move_last_point_and_resample(positions_cu.slice(points), new_last_pos_cu);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -64,12 +64,12 @@ class EndpointFieldInput final : public bke::CurvesFieldInput {
|
|||
devirtualize_varray2(start_size, end_size, [&](const auto &start_size, const auto &end_size) {
|
||||
threading::parallel_for(curves.curves_range(), 1024, [&](IndexRange curves_range) {
|
||||
for (const int i : curves_range) {
|
||||
const IndexRange range = curves.points_for_curve(i);
|
||||
const IndexRange points = curves.points_for_curve(i);
|
||||
const int start = std::max(start_size[i], 0);
|
||||
const int end = std::max(end_size[i], 0);
|
||||
|
||||
selection_span.slice(range.take_front(start)).fill(true);
|
||||
selection_span.slice(range.take_back(end)).fill(true);
|
||||
selection_span.slice(points.take_front(start)).fill(true);
|
||||
selection_span.slice(points.take_back(end)).fill(true);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue