diff options
author | Jeroen Bakker <j.bakker@atmind.nl> | 2022-03-16 12:37:28 +0300 |
---|---|---|
committer | Jeroen Bakker <j.bakker@atmind.nl> | 2022-03-16 12:37:28 +0300 |
commit | b42b72298ac4ba83e08d93ab6ae0d7c8786f1347 (patch) | |
tree | efbd4995e6c5664fcd385bf9410fe3f1b28e831b | |
parent | caed9482538aa3bb33d86ecddb5576d61c1e18e3 (diff) |
Remove unused code to simplify the inner loop.
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_texture_paint_d.cc | 40 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_texture_paint_intern.hh | 4 |
2 files changed, 18 insertions, 26 deletions
diff --git a/source/blender/editors/sculpt_paint/sculpt_texture_paint_d.cc b/source/blender/editors/sculpt_paint/sculpt_texture_paint_d.cc index 90631246e4d..600dd331727 100644 --- a/source/blender/editors/sculpt_paint/sculpt_texture_paint_d.cc +++ b/source/blender/editors/sculpt_paint/sculpt_texture_paint_d.cc @@ -74,7 +74,6 @@ template<typename ImagePixelAccessor> class PaintingKernel { const Brush *brush; const int thread_id; const MVert *mvert; - const MLoopUV *ldata_uv; float4 brush_color; float brush_strength; @@ -86,9 +85,8 @@ template<typename ImagePixelAccessor> class PaintingKernel { explicit PaintingKernel(SculptSession *ss, const Brush *brush, const int thread_id, - const MVert *mvert, - const MLoopUV *ldata_uv) - : ss(ss), brush(brush), thread_id(thread_id), mvert(mvert), ldata_uv(ldata_uv) + const MVert *mvert) + : ss(ss), brush(brush), thread_id(thread_id), mvert(mvert) { init_brush_color(); init_brush_strength(); @@ -150,27 +148,14 @@ template<typename ImagePixelAccessor> class PaintingKernel { brush_test_fn = SCULPT_brush_test_init_with_falloff_shape(ss, &test, brush->falloff_shape); } - Pixel init_pixel(const Triangle &triangle, const float3 weights) const - { - Pixel result; - interp_v3_v3v3v3(result.pos, - mvert[triangle.vert_indices[0]].co, - mvert[triangle.vert_indices[1]].co, - mvert[triangle.vert_indices[2]].co, - weights); - interp_v3_v3v3v3(result.uv, - ldata_uv[triangle.loop_indices[0]].uv, - ldata_uv[triangle.loop_indices[1]].uv, - ldata_uv[triangle.loop_indices[2]].uv, - weights); - return result; - } - + /** Extract the staring pixel from the given encoded_pixels belonging to the triangle. */ Pixel get_start_pixel(const Triangle &triangle, const PixelsPackage &encoded_pixels) const { return init_pixel(triangle, encoded_pixels.start_barycentric_coord); } + /** + * Extract the delta pixel that will be used to advance a Pixel instance to the next pixel. */ Pixel get_delta_pixel(const Triangle &triangle, const PixelsPackage &encoded_pixels, const Pixel &start_pixel) const @@ -179,6 +164,17 @@ template<typename ImagePixelAccessor> class PaintingKernel { triangle, encoded_pixels.start_barycentric_coord + triangle.add_barycentric_coord_x); return result - start_pixel; } + + Pixel init_pixel(const Triangle &triangle, const float3 weights) const + { + Pixel result; + interp_v3_v3v3v3(result.pos, + mvert[triangle.vert_indices[0]].co, + mvert[triangle.vert_indices[1]].co, + mvert[triangle.vert_indices[2]].co, + weights); + return result; + } }; static void do_vertex_brush_test(void *__restrict userdata, @@ -254,9 +250,7 @@ static void do_task_cb_ex(void *__restrict userdata, const int thread_id = BLI_task_parallel_thread_id(tls); MVert *mvert = SCULPT_mesh_deformed_mverts_get(ss); - Mesh *mesh = static_cast<Mesh *>(ob->data); - MLoopUV *ldata_uv = static_cast<MLoopUV *>(CustomData_get_layer(&mesh->ldata, CD_MLOOPUV)); - PaintingKernel<ImagePixelAccessorFloat4> kernel(ss, brush, thread_id, mvert, ldata_uv); + PaintingKernel<ImagePixelAccessorFloat4> kernel(ss, brush, thread_id, mvert); int packages_clipped = 0; for (const PixelsPackage &encoded_pixels : node_data->encoded_pixels) { diff --git a/source/blender/editors/sculpt_paint/sculpt_texture_paint_intern.hh b/source/blender/editors/sculpt_paint/sculpt_texture_paint_intern.hh index 76f4a7bbdc5..902fd7515e4 100644 --- a/source/blender/editors/sculpt_paint/sculpt_texture_paint_intern.hh +++ b/source/blender/editors/sculpt_paint/sculpt_texture_paint_intern.hh @@ -41,13 +41,12 @@ struct PixelsPackage { }; struct Pixel { + /** object local position of the pixel on the surface. */ float3 pos; - float2 uv; Pixel &operator+=(const Pixel &other) { pos += other.pos; - uv += other.uv; return *this; } @@ -55,7 +54,6 @@ struct Pixel { { Pixel result; result.pos = pos - other.pos; - result.uv = uv - other.uv; return result; } }; |