diff options
author | Hans Goudey <h.goudey@me.com> | 2022-03-25 17:03:35 +0300 |
---|---|---|
committer | Hans Goudey <h.goudey@me.com> | 2022-03-25 17:03:35 +0300 |
commit | cea51c1bb500eb2cfca425e1cae5dcc419dda2ce (patch) | |
tree | a7074ea2c67c0c8a40d27faac5ebfa1793390656 /source/blender/blenkernel/BKE_curves.hh | |
parent | c0016d85b2a62858229d31bd97399fbe2608f99d (diff) |
Curves: Bezier and general interpolate to evaluated utility
This commit implements generic evaluation for Bezier curves (which is
really just linear interpolation, since attributes are not stored on
Bezier handles). For complete parity with the old curve type, we would
have to add options for this (RNA: `Spline.radius_interpolation`),
but it's not clear that we want to do that.
This also adds a generic `interpolate_to_evaluate` utility on curves
that hides the implementation details. Though there is theoretically
a performance cost to that, without some abstraction calling code
would usually be too complex.
Differential Revision: https://developer.blender.org/D14447
Diffstat (limited to 'source/blender/blenkernel/BKE_curves.hh')
-rw-r--r-- | source/blender/blenkernel/BKE_curves.hh | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/source/blender/blenkernel/BKE_curves.hh b/source/blender/blenkernel/BKE_curves.hh index 96963dcbd8d..82f77d83bec 100644 --- a/source/blender/blenkernel/BKE_curves.hh +++ b/source/blender/blenkernel/BKE_curves.hh @@ -266,6 +266,15 @@ class CurvesGeometry : public ::CurvesGeometry { Span<float3> evaluated_positions() const; + /** + * Evaluate a generic data to the standard evaluated points of a specific curve, + * defined by the resolution attribute or other factors, depending on the curve type. + * + * \warning This function expects offsets to the evaluated points for each curve to be + * calculated. That can be ensured with #ensure_evaluated_offsets. + */ + void interpolate_to_evaluated(int curve_index, GSpan src, GMutableSpan dst) const; + private: /** * Make sure the basis weights for NURBS curve's evaluated points are calculated. @@ -381,6 +390,13 @@ void calculate_evaluated_positions(Span<float3> positions, Span<int> evaluated_offsets, MutableSpan<float3> evaluated_positions); +/** + * Evaluate generic data to the evaluated points, with counts for each segment described by + * #evaluated_offsets. Unlike other curve types, for Bezier curves generic data and positions + * are treated separately, since attribute values aren't stored for the handle control points. + */ +void interpolate_to_evaluated(GSpan src, Span<int> evaluated_offsets, GMutableSpan dst); + } // namespace bezier namespace catmull_rom { |