Merge branch 'master' into sculpt-dev

This commit is contained in:
Joseph Eagar 2022-04-08 17:28:02 -07:00
commit d75932cbef
5 changed files with 12 additions and 12 deletions

View File

@ -40,7 +40,7 @@ namespace curves::nurbs {
struct BasisCache {
/**
* For each evaluated point, the weight for all control points that influences it.
* The vector's size is the evaluated point count multiplied by the spline's order.
* The vector's size is the evaluated point count multiplied by the curve's order.
*/
Vector<float> weights;
/**
@ -61,7 +61,7 @@ class CurvesGeometryRuntime {
public:
/**
* Cache of offsets into the evaluated array for each curve, accounting for all previous
* evaluated points, Bezier curve vector segments, different resolutions per spline, etc.
* evaluated points, Bezier curve vector segments, different resolutions per curve, etc.
*/
mutable Vector<int> evaluated_offsets_cache;
mutable Vector<int> bezier_evaluated_offsets;
@ -86,13 +86,13 @@ class CurvesGeometryRuntime {
mutable std::mutex length_cache_mutex;
mutable bool length_cache_dirty = true;
/** Direction of the spline at each evaluated point. */
mutable Vector<float3> evaluated_tangents_cache;
/** Direction of the curve at each evaluated point. */
mutable Vector<float3> evaluated_tangent_cache;
mutable std::mutex tangent_cache_mutex;
mutable bool tangent_cache_dirty = true;
/** Normal direction vectors for each evaluated point. */
mutable Vector<float3> evaluated_normals_cache;
mutable Vector<float3> evaluated_normal_cache;
mutable std::mutex normal_cache_mutex;
mutable bool normal_cache_dirty = true;
};
@ -515,7 +515,7 @@ int calculate_evaluated_size(
int knots_size(int points_num, int8_t order, bool cyclic);
/**
* Calculate the knots for a spline given its properties, based on built-in standards defined by
* Calculate the knots for a curve given its properties, based on built-in standards defined by
* #KnotsMode.
*
* \note Theoretically any sorted values can be used for NURBS knots, but calculating based

View File

@ -629,6 +629,7 @@ Span<float3> CurvesGeometry::evaluated_positions() const
});
});
this->runtime->position_cache_dirty = false;
return this->runtime->evaluated_position_cache;
}

View File

@ -490,7 +490,7 @@ static ComponentAttributeProviders create_attribute_providers_for_curve()
curve_access,
make_array_read_attribute<int>,
make_array_write_attribute<int>,
tag_component_positions_changed);
tag_component_topology_changed);
static BuiltinCustomDataLayerProvider cyclic("cyclic",
ATTR_DOMAIN_CURVE,

View File

@ -51,8 +51,8 @@ typedef enum KnotsMode {
/** Method used to calculate the normals of a curve's evaluated points. */
typedef enum NormalMode {
NORMAL_MODE_Z_UP = 0,
NORMAL_MODE_MINIMUM_TWIST = 1,
NORMAL_MODE_MINIMUM_TWIST = 0,
NORMAL_MODE_Z_UP = 1,
} NormalMode;
/**
@ -84,7 +84,7 @@ typedef struct CurvesGeometry {
/**
* The start index of each curve in the point data. The size of each curve can be calculated by
* subtracting the offset from the next offset. That is valid even for the last curve because
* this array is allocated with a length one larger than the number of splines. This is allowed
* this array is allocated with a length one larger than the number of curves. This is allowed
* to be null when there are no curves.
*
* \note This is *not* stored in #CustomData because its size is one larger than #curve_data.

View File

@ -59,11 +59,10 @@ static Array<float> curve_length_point_domain(const bke::CurvesGeometry &curves)
{
curves.ensure_evaluated_lengths();
const VArray<int8_t> types = curves.curve_types();
const VArray<int> resolution = curves.resolution();
const VArray<int> resolutions = curves.resolution();
const VArray<bool> cyclic = curves.cyclic();
Array<float> result(curves.points_num());
VArray<int> resolutions = curves.resolution();
threading::parallel_for(curves.curves_range(), 128, [&](IndexRange range) {
for (const int i_curve : range) {