diff options
author | Jeroen Bakker <jeroen@blender.org> | 2022-03-21 16:27:51 +0300 |
---|---|---|
committer | Jeroen Bakker <jeroen@blender.org> | 2022-03-21 16:27:51 +0300 |
commit | 94d7db2cc0024823202f5984be832ced0ec219b3 (patch) | |
tree | d4138f915079a5fed4e11057ba4d706a5dd19771 | |
parent | b05d10dde7ce8f7a7fc5721aeec036a1053a1adc (diff) |
Use brush texture as color texture.
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt.c | 4 | ||||
-rw-r--r-- | source/blender/editors/sculpt_paint/sculpt_intern.h | 1 | ||||
-rw-r--r-- | 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<typename ImagePixelAccessor> class PaintingKernel { SculptSession *ss; const Brush *brush; + MTex mtex; const int thread_id; const MVert *mvert; @@ -140,6 +141,7 @@ template<typename ImagePixelAccessor> 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<typename ImagePixelAccessor> 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<typename ImagePixelAccessor> class PaintingKernel { const float falloff_strength = SCULPT_brush_strength_factor_custom_automask( ss, brush, + &brush->mask_mtex, pixel.pos, sqrtf(test.dist), normal, |