From c324cf153924ae2ec5b7c59eabff71652847aeae Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Wed, 16 Feb 2022 11:32:37 -0600 Subject: Curves: Further implementation of new curves data structure The general idea here is to wrap the `CurvesGeometry` DNA struct with a C++ class that can do most of the heavy lifting for the curve geometry. Using a C++ class allows easier ways to group methods, easier const correctness, and code that's more readable and faster to write. This way, it works much more like a version of `CurveEval` that uses more efficient attribute storage. This commit adds the structure of some yet-to-be-implemented code, the largest thing being mutexes and vectors meant to hold lazily calculated evaluated positions, tangents, and normals. That part might change slightly, but it's helpful to be able to see the direction this commit is aiming in. In particular, the inherently single-threaded accumulated lengths and Bezier evaluated point offsets might be cached. Ref T95355 Differential Revision: https://developer.blender.org/D14054 --- source/blender/draw/intern/draw_cache_impl_curves.cc | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'source/blender/draw/intern') diff --git a/source/blender/draw/intern/draw_cache_impl_curves.cc b/source/blender/draw/intern/draw_cache_impl_curves.cc index a779c694cd2..2153b674463 100644 --- a/source/blender/draw/intern/draw_cache_impl_curves.cc +++ b/source/blender/draw/intern/draw_cache_impl_curves.cc @@ -22,7 +22,7 @@ #include "DNA_curves_types.h" #include "DNA_object_types.h" -#include "BKE_curves.h" +#include "BKE_curves.hh" #include "GPU_batch.h" #include "GPU_material.h" @@ -133,7 +133,7 @@ static void curves_batch_cache_fill_segments_proc_pos(Curves *curves, { /* TODO: use hair radius layer if available. */ const int curve_size = curves->geometry.curve_size; - Span offsets{curves->geometry.offsets, curves->geometry.curve_size + 1}; + Span offsets{curves->geometry.curve_offsets, curves->geometry.curve_size + 1}; Span positions{(float3 *)curves->geometry.position, curves->geometry.point_size}; @@ -216,7 +216,7 @@ static void curves_batch_cache_fill_strands_data(Curves *curves, GPUVertBufRaw *seg_step) { const int curve_size = curves->geometry.curve_size; - Span offsets{curves->geometry.offsets, curves->geometry.curve_size + 1}; + Span offsets{curves->geometry.curve_offsets, curves->geometry.curve_size + 1}; for (const int i : IndexRange(curve_size)) { const IndexRange curve_range(offsets[i], offsets[i + 1] - offsets[i]); -- cgit v1.2.3