Changeset View
Changeset View
Standalone View
Standalone View
source/blender/blenkernel/BKE_curves.hh
| Show First 20 Lines • Show All 71 Lines • ▼ Show 20 Lines | public: | ||||
| mutable std::mutex nurbs_basis_cache_mutex; | mutable std::mutex nurbs_basis_cache_mutex; | ||||
| mutable bool nurbs_basis_cache_dirty = true; | mutable bool nurbs_basis_cache_dirty = true; | ||||
| /** Cache of evaluated positions. */ | /** Cache of evaluated positions. */ | ||||
| mutable Vector<float3> evaluated_position_cache; | mutable Vector<float3> evaluated_position_cache; | ||||
| mutable std::mutex position_cache_mutex; | mutable std::mutex position_cache_mutex; | ||||
| mutable bool position_cache_dirty = true; | mutable bool position_cache_dirty = true; | ||||
| /** | |||||
| * Cache of lengths along each evaluated curve for for each evaluated point. If a curve is | |||||
| * cyclic, it needs one more length value to correspond to the last segment, so in order to | |||||
| * make slicing this array for a curve fast, an extra float is stored for every curve. | |||||
| */ | |||||
| mutable Vector<float> evaluated_length_cache; | |||||
| mutable std::mutex length_cache_mutex; | |||||
| mutable bool length_cache_dirty = true; | |||||
| /** Direction of the spline at each evaluated point. */ | /** Direction of the spline at each evaluated point. */ | ||||
| mutable Vector<float3> evaluated_tangents_cache; | mutable Vector<float3> evaluated_tangents_cache; | ||||
| mutable std::mutex tangent_cache_mutex; | mutable std::mutex tangent_cache_mutex; | ||||
| mutable bool tangent_cache_dirty = true; | mutable bool tangent_cache_dirty = true; | ||||
| /** Normal direction vectors for each evaluated point. */ | /** Normal direction vectors for each evaluated point. */ | ||||
| mutable Vector<float3> evaluated_normals_cache; | mutable Vector<float3> evaluated_normals_cache; | ||||
| mutable std::mutex normal_cache_mutex; | mutable std::mutex normal_cache_mutex; | ||||
| ▲ Show 20 Lines • Show All 174 Lines • ▼ Show 20 Lines | public: | ||||
| Span<int> evaluated_offsets() const; | Span<int> evaluated_offsets() const; | ||||
| /** Makes sure the data described by #evaluated_offsets if necessary. */ | /** Makes sure the data described by #evaluated_offsets if necessary. */ | ||||
| void ensure_evaluated_offsets() const; | void ensure_evaluated_offsets() const; | ||||
| Span<float3> evaluated_positions() const; | Span<float3> evaluated_positions() const; | ||||
| /** | /** | ||||
| * Return a cache of accumulated lengths along the curve. Each item is the length of the | |||||
| * subsequent segment, i.e. the first value is the length of the first segment rather than 0. | |||||
| * This calculation is rather trivial, and only depends on the evaluated positions. However, | |||||
| * the results are used often, and it is necessarily single threaded per curve, so it is cached. | |||||
JacquesLucke: "necessarily single threaded [per curve]" | |||||
| */ | |||||
| Span<float> evaluated_lengths_for_curve(int curve_index) const; | |||||
| /** Calculates the data described by #evaluated_lengths_for_curve if necessary. */ | |||||
| void ensure_evaluated_lengths() const; | |||||
| /** | |||||
| * Evaluate a generic data to the standard evaluated points of a specific curve, | * 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. | * 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 | * \warning This function expects offsets to the evaluated points for each curve to be | ||||
| * calculated. That can be ensured with #ensure_evaluated_offsets. | * calculated. That can be ensured with #ensure_evaluated_offsets. | ||||
| */ | */ | ||||
| void interpolate_to_evaluated(int curve_index, GSpan src, GMutableSpan dst) const; | void interpolate_to_evaluated(int curve_index, GSpan src, GMutableSpan dst) const; | ||||
| private: | private: | ||||
| /** | /** | ||||
| * Make sure the basis weights for NURBS curve's evaluated points are calculated. | * Make sure the basis weights for NURBS curve's evaluated points are calculated. | ||||
| */ | */ | ||||
| void ensure_nurbs_basis_cache() const; | void ensure_nurbs_basis_cache() const; | ||||
| /** Return the slice of #evaluated_length_cache that corresponds to this curve index. */ | |||||
| IndexRange lengths_range_for_curve(const int curve_index) const; | |||||
| /* -------------------------------------------------------------------- | /* -------------------------------------------------------------------- | ||||
| * Operations. | * Operations. | ||||
| */ | */ | ||||
| public: | public: | ||||
| /** | /** | ||||
| * Change the number of elements. New values for existing attributes should be properly | * Change the number of elements. New values for existing attributes should be properly | ||||
| * initialized afterwards. | * initialized afterwards. | ||||
| ▲ Show 20 Lines • Show All 202 Lines • Show Last 20 Lines | |||||
"necessarily single threaded [per curve]"