Commit: fc42aca8485de60e6eb7a552b4e01b0e36550678 Author: Jeroen Bakker Date: Mon Mar 14 07:54:55 2022 +0100 Branches: temp-3d-texturing-brush-b https://developer.blender.org/rBfc42aca8485de60e6eb7a552b4e01b0e36550678
Use struct of structs. =================================================================== M source/blender/editors/sculpt_paint/sculpt_texture_paint_b.cc M source/blender/editors/sculpt_paint/sculpt_texture_paint_intern.hh M source/blender/editors/sculpt_paint/sculpt_texture_paint_pixel_extraction_b.cc =================================================================== diff --git a/source/blender/editors/sculpt_paint/sculpt_texture_paint_b.cc b/source/blender/editors/sculpt_paint/sculpt_texture_paint_b.cc index b20e3e85ddd..9b02cab3744 100644 --- a/source/blender/editors/sculpt_paint/sculpt_texture_paint_b.cc +++ b/source/blender/editors/sculpt_paint/sculpt_texture_paint_b.cc @@ -62,11 +62,13 @@ static void do_task_cb_ex(void *__restrict userdata, float4 brush_linear; srgb_to_linearrgb_v3_v3(brush_linear, brush_srgb); brush_linear[3] = 1.0f; + MVert *mvert = SCULPT_mesh_deformed_mverts_get(ss); + const float brush_strength = ss->cache->bstrength; for (int i = 0; i < node_data->pixels.size(); i++) { - const float3 &local_pos = node_data->pixels.local_position(i); + const float3 &local_pos = node_data->pixels.local_position(i, mvert); if (!sculpt_brush_test_sq_fn(&test, local_pos)) { continue; } 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 ef0fce78b41..31864148588 100644 --- a/source/blender/editors/sculpt_paint/sculpt_texture_paint_intern.hh +++ b/source/blender/editors/sculpt_paint/sculpt_texture_paint_intern.hh @@ -3,12 +3,17 @@ namespace blender::ed::sculpt_paint::texture_paint { struct PixelData { int2 pixel_pos; float3 local_pos; + float3 weights; + int3 vertices; float4 content; }; struct Pixels { Vector<int2> image_coordinates; Vector<float3> local_positions; + Vector<int3> vertices; + Vector<float3> weights; + Vector<float4> colors; std::vector<bool> dirty; @@ -31,6 +36,18 @@ struct Pixels { return local_positions[index]; } + const float3 local_position(uint64_t index, MVert *mvert) const + { + const int3 &verts = vertices[index]; + const float3 &weight = weights[index]; + const float3 &pos1 = mvert[verts.x].co; + const float3 &pos2 = mvert[verts.y].co; + const float3 &pos3 = mvert[verts.z].co; + float3 local_pos; + interp_v3_v3v3v3(local_pos, pos1, pos2, pos3, weight); + return local_pos; + } + const float4 &color(uint64_t index) const { return colors[index]; @@ -55,6 +72,8 @@ struct Pixels { image_coordinates.append(pixel.pixel_pos); local_positions.append(pixel.local_pos); colors.append(pixel.content); + weights.append(pixel.weights); + vertices.append(pixel.vertices); dirty.push_back(false); } }; diff --git a/source/blender/editors/sculpt_paint/sculpt_texture_paint_pixel_extraction_b.cc b/source/blender/editors/sculpt_paint/sculpt_texture_paint_pixel_extraction_b.cc index 09df18270ca..aaf78d7403d 100644 --- a/source/blender/editors/sculpt_paint/sculpt_texture_paint_pixel_extraction_b.cc +++ b/source/blender/editors/sculpt_paint/sculpt_texture_paint_pixel_extraction_b.cc @@ -84,6 +84,8 @@ static bool init_using_intersection(SculptSession *ss, PixelData new_pixel; new_pixel.local_pos = local_pos; new_pixel.pixel_pos = xy; + new_pixel.vertices = int3(v1_index, v2_index, v3_index); + new_pixel.weights = weights; new_pixel.content = float4(&image_buffer->rect_float[pixel_offset * 4]); PBVHNode *node = entry.node; _______________________________________________ Bf-blender-cvs mailing list Bf-blender-cvs@blender.org List details, subscription details or unsubscribe: https://lists.blender.org/mailman/listinfo/bf-blender-cvs