[Bf-blender-cvs] [45803403216] temp-geometry-nodes-curve-sample: Some progress

Hans Goudey noreply at git.blender.org
Tue Jul 13 01:43:14 CEST 2021


Commit: 45803403216e31ea43e9e56b9c9b90c3cb20740c
Author: Hans Goudey
Date:   Mon Jul 5 07:26:10 2021 -0500
Branches: temp-geometry-nodes-curve-sample
https://developer.blender.org/rB45803403216e31ea43e9e56b9c9b90c3cb20740c

Some progress

===================================================================

M	source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc

===================================================================

diff --git a/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc b/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc
index 89c46b58405..5e8094169d7 100644
--- a/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc
+++ b/source/blender/nodes/geometry/nodes/node_geo_curve_sample.cc
@@ -92,12 +92,29 @@ static AttributeDomain get_result_domain(const GeometryComponent &component,
   return ATTR_DOMAIN_POINT;
 }
 
+Array<float> calculate_spline_accumulated_lengths(Span<SplinePtr> splines)
+{
+  Array<float> lengths(splines.size() + 1);
+  float length = 0.0f;
+  for (const int i : splines.index_range()) {
+    length += splines[i]->length();
+    lengths[i] = length;
+  }
+  lengths.last() = length;
+  return lengths;
+}
+
+static void spline_sample_data(const Span<GSpan> evaluated_spans)
+{
+}
+
 /**
  * 1. Sort input parameters
  * 2. For each spline in the curve, sample the values on it.
  */
-static void curve_sample_attributes(const CurveEval &curve,
-                                    const StringRef name,
+static void curve_sample_attributes(const Span<SplinePtr> splines,
+                                    const Span<float> spline_lengths,
+                                    const Span<GSpan> evaluated_spans,
                                     const Span<float> parameters,
                                     GMutableSpan result)
 {
@@ -110,6 +127,15 @@ static void curve_sample_attributes(const CurveEval &curve,
     return parameters[a] > parameters[b];
   });
 
+  Span<float> remaining_parameters = parameters;
+
+  std::lower_bound
+
+      int spline_start_index = 0;
+  int spline_end_index = 0;
+  for (const int i : splines.index_range()) {
+  }
+
   for (const int i : range) {
   }
 }
@@ -133,9 +159,11 @@ static void execute_on_component(GeometryComponent &component,
   GMutableSpan result_span = result.as_span();
 
   const CurveEval &curve = *curve_component.get_for_read();
+  const Array<float> lengths = calculate_spline_accumulated_lengths(curve.splines());
 
   threading::parallel_for(IndexRange(result_span.size()), 1024, [&](IndexRange range) {
     curve_sample_attributes(curve,
+                            lengths,
                             attribute_name,
                             parameters_span.slice(range.start(), range.size()),
                             result_span.slice(range.start(), range.size()));



More information about the Bf-blender-cvs mailing list