Changeset View
Changeset View
Standalone View
Standalone View
source/blender/geometry/intern/resample_curves.cc
| Show First 20 Lines • Show All 228 Lines • ▼ Show 20 Lines | threading::parallel_for(selection.index_range(), 512, [&](IndexRange selection_range) { | ||||
| const IndexMask sliced_selection = selection.slice(selection_range); | const IndexMask sliced_selection = selection.slice(selection_range); | ||||
| Vector<std::byte> evaluated_buffer; | Vector<std::byte> evaluated_buffer; | ||||
| /* Gather uniform samples based on the accumulated lengths of the original curve. */ | /* Gather uniform samples based on the accumulated lengths of the original curve. */ | ||||
| for (const int i_curve : sliced_selection) { | for (const int i_curve : sliced_selection) { | ||||
| const bool cyclic = curves_cyclic[i_curve]; | const bool cyclic = curves_cyclic[i_curve]; | ||||
| const IndexRange dst_points = dst_curves.points_for_curve(i_curve); | const IndexRange dst_points = dst_curves.points_for_curve(i_curve); | ||||
| length_parameterize::create_uniform_samples( | length_parameterize::sample_uniform(src_curves.evaluated_lengths_for_curve(i_curve, cyclic), | ||||
| src_curves.evaluated_lengths_for_curve(i_curve, cyclic), | !curves_cyclic[i_curve], | ||||
| curves_cyclic[i_curve], | |||||
| sample_indices.as_mutable_span().slice(dst_points), | sample_indices.as_mutable_span().slice(dst_points), | ||||
| sample_factors.as_mutable_span().slice(dst_points)); | sample_factors.as_mutable_span().slice(dst_points)); | ||||
| } | } | ||||
| /* For every attribute, evaluate attributes from every curve in the range in the original | /* For every attribute, evaluate attributes from every curve in the range in the original | ||||
| * curve's "evaluated points", then use linear interpolation to sample to the result. */ | * curve's "evaluated points", then use linear interpolation to sample to the result. */ | ||||
| for (const int i_attribute : attributes.dst.index_range()) { | for (const int i_attribute : attributes.dst.index_range()) { | ||||
| attribute_math::convert_to_static_type(attributes.src[i_attribute].type(), [&](auto dummy) { | attribute_math::convert_to_static_type(attributes.src[i_attribute].type(), [&](auto dummy) { | ||||
| using T = decltype(dummy); | using T = decltype(dummy); | ||||
| Span<T> src = attributes.src[i_attribute].typed<T>(); | Span<T> src = attributes.src[i_attribute].typed<T>(); | ||||
| ▲ Show 20 Lines • Show All 195 Lines • Show Last 20 Lines | |||||