From 94d7db2cc0024823202f5984be832ced0ec219b3 Mon Sep 17 00:00:00 2001 From: Jeroen Bakker Date: Mon, 21 Mar 2022 14:27:51 +0100 Subject: Use brush texture as color texture. --- source/blender/editors/sculpt_paint/sculpt.c | 4 ++-- source/blender/editors/sculpt_paint/sculpt_intern.h | 1 + source/blender/editors/sculpt_paint/sculpt_texture_paint_d.cc | 7 +++++-- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/source/blender/editors/sculpt_paint/sculpt.c b/source/blender/editors/sculpt_paint/sculpt.c index de6343f6e46..7dea40bd2e6 100644 --- a/source/blender/editors/sculpt_paint/sculpt.c +++ b/source/blender/editors/sculpt_paint/sculpt.c @@ -2393,6 +2393,7 @@ float SCULPT_brush_texture_eval(SculptSession *ss, float SCULPT_brush_strength_factor_custom_automask(SculptSession *ss, const Brush *br, + const MTex *mtex, const float brush_point[3], const float len, const float vno[3], @@ -2402,7 +2403,6 @@ float SCULPT_brush_strength_factor_custom_automask(SculptSession *ss, const int thread_id) { StrokeCache *cache = ss->cache; - const MTex *mtex = &br->mtex; float avg = 1.0f; float rgba[4]; @@ -2449,7 +2449,7 @@ float SCULPT_brush_strength_factor(SculptSession *ss, const float automask_factor = SCULPT_automasking_factor_get( ss->cache->automasking, ss, vertex_index); return SCULPT_brush_strength_factor_custom_automask( - ss, br, brush_point, len, vno, fno, mask, automask_factor, thread_id); + ss, br, &br->mtex, brush_point, len, vno, fno, mask, automask_factor, thread_id); } bool SCULPT_search_sphere_cb(PBVHNode *node, void *data_v) diff --git a/source/blender/editors/sculpt_paint/sculpt_intern.h b/source/blender/editors/sculpt_paint/sculpt_intern.h index 67d00680988..b22738bf3f7 100644 --- a/source/blender/editors/sculpt_paint/sculpt_intern.h +++ b/source/blender/editors/sculpt_paint/sculpt_intern.h @@ -1141,6 +1141,7 @@ float SCULPT_brush_strength_factor(struct SculptSession *ss, int thread_id); float SCULPT_brush_strength_factor_custom_automask(struct SculptSession *ss, const struct Brush *br, + const MTex *mtex, const float point[3], float len, const float vno[3], 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 bcc2d32cc3a..57a59ac2d77 100644 --- a/source/blender/editors/sculpt_paint/sculpt_texture_paint_d.cc +++ b/source/blender/editors/sculpt_paint/sculpt_texture_paint_d.cc @@ -119,6 +119,7 @@ template class PaintingKernel { SculptSession *ss; const Brush *brush; + MTex mtex; const int thread_id; const MVert *mvert; @@ -140,6 +141,7 @@ template class PaintingKernel { { init_brush_strength(); init_brush_test(); + mtex = brush->mtex; } bool paint(const Triangles &triangles, const PixelsPackage &encoded_pixels, ImBuf *image_buffer) @@ -160,8 +162,8 @@ template class PaintingKernel { continue; } - if (brush->mask_mtex.tex) { - SCULPT_brush_texture_eval(ss, brush, &brush->mask_mtex, pixel.pos, thread_id, brush_color); + if (mtex.tex) { + SCULPT_brush_texture_eval(ss, brush, &mtex, pixel.pos, thread_id, brush_color); } float4 color = image_accessor.read_pixel(image_buffer); @@ -171,6 +173,7 @@ template class PaintingKernel { const float falloff_strength = SCULPT_brush_strength_factor_custom_automask( ss, brush, + &brush->mask_mtex, pixel.pos, sqrtf(test.dist), normal, -- cgit v1.2.3