From 5bf8993661d61d2ccff0dc24bdf69e14f381f59d Mon Sep 17 00:00:00 2001 From: Hans Goudey Date: Tue, 6 Aug 2024 15:03:22 -0400 Subject: [PATCH] Cleanup: Sculpt: Use BitVector instead of std::vector BitVector has a proper interface for storing bits. --- .../editors/sculpt_paint/sculpt_paint_image.cc | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/source/blender/editors/sculpt_paint/sculpt_paint_image.cc b/source/blender/editors/sculpt_paint/sculpt_paint_image.cc index f9671a4b13f..521df141744 100644 --- a/source/blender/editors/sculpt_paint/sculpt_paint_image.cc +++ b/source/blender/editors/sculpt_paint/sculpt_paint_image.cc @@ -11,6 +11,7 @@ #include "ED_paint.hh" +#include "BLI_bit_vector.hh" #include "BLI_math_color_blend.h" #include "BLI_math_geom.h" #include "BLI_task.h" @@ -290,12 +291,12 @@ template class PaintingKernel { } }; -static std::vector init_uv_primitives_brush_test(SculptSession &ss, - PaintGeometryPrimitives &geom_primitives, - PaintUVPrimitives &uv_primitives, - const Span positions) +static BitVector<> init_uv_primitives_brush_test(SculptSession &ss, + PaintGeometryPrimitives &geom_primitives, + PaintUVPrimitives &uv_primitives, + const Span positions) { - std::vector brush_test(uv_primitives.size()); + BitVector<> brush_test(uv_primitives.size()); SculptBrushTest test; SCULPT_brush_test_init(ss, test); float3 brush_min_bounds(test.location[0] - test.radius, @@ -320,8 +321,8 @@ static std::vector init_uv_primitives_brush_test(SculptSession &ss, triangle_max_bounds.y = max_ff(triangle_max_bounds.y, pos.y); triangle_max_bounds.z = max_ff(triangle_max_bounds.z, pos.z); } - brush_test[uv_prim_index] = isect_aabb_aabb_v3( - brush_min_bounds, brush_max_bounds, triangle_min_bounds, triangle_max_bounds); + brush_test[uv_prim_index].set(isect_aabb_aabb_v3( + brush_min_bounds, brush_max_bounds, triangle_min_bounds, triangle_max_bounds)); } return brush_test; } @@ -338,7 +339,7 @@ static void do_paint_pixels(TexturePaintingUserData *data, const int n) const int thread_id = BLI_task_parallel_thread_id(nullptr); const Span positions = SCULPT_mesh_deformed_positions_get(ss); - std::vector brush_test = init_uv_primitives_brush_test( + BitVector<> brush_test = init_uv_primitives_brush_test( ss, pbvh_data.geom_primitives, node_data.uv_primitives, positions); PaintingKernel kernel_float4(ss, brush, thread_id, positions);