From 0d70e8a4fd6a2d04f0bc37ad4d0eb6eea8d831ce Mon Sep 17 00:00:00 2001 From: Antony Riakiotakis Date: Thu, 14 Mar 2013 02:27:36 +0000 Subject: Two new Features: * Support for Rake in projective paint (2D painting will be a separate commit) * Support for smooth stroke across all paint systems --- source/blender/blenkernel/BKE_brush.h | 4 +-- source/blender/blenkernel/intern/brush.c | 48 ++------------------------------ 2 files changed, 4 insertions(+), 48 deletions(-) (limited to 'source/blender/blenkernel') diff --git a/source/blender/blenkernel/BKE_brush.h b/source/blender/blenkernel/BKE_brush.h index e8193b4a026..f44436f965c 100644 --- a/source/blender/blenkernel/BKE_brush.h +++ b/source/blender/blenkernel/BKE_brush.h @@ -69,10 +69,8 @@ float BKE_brush_curve_strength_clamp(struct Brush *br, float p, const float len) float BKE_brush_curve_strength(struct Brush *br, float p, const float len); /* used for sculpt */ /* sampling */ -void BKE_brush_sample_tex(const struct Scene *scene, struct Brush *brush, const float sampleco[3], - float rgba[4], const int thread, struct ImagePool *pool); float BKE_brush_sample_tex_3D(const Scene *scene, struct Brush *br, const float point[3], - float rgba[3], struct ImagePool *pool); + float rgba[3], const int thread, struct ImagePool *pool); float BKE_brush_sample_tex_2D(const struct Scene *scene, struct Brush *brush, const float xy[2], float rgba[4], struct ImagePool *pool); void BKE_brush_imbuf_new(const struct Scene *scene, struct Brush *brush, short flt, short texfalloff, int size, diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c index 71db2fc56da..636f6160b9f 100644 --- a/source/blender/blenkernel/intern/brush.c +++ b/source/blender/blenkernel/intern/brush.c @@ -472,52 +472,10 @@ int BKE_brush_clone_image_delete(Brush *brush) return 0; } -/* Brush Sampling for 3d brushes. Currently used for texture painting only, but should be generalized */ -void BKE_brush_sample_tex(const Scene *scene, Brush *brush, const float sampleco[3], float rgba[4], const int thread, struct ImagePool *pool) -{ - MTex *mtex = &brush->mtex; - - if (mtex && mtex->tex) { - float tin, tr, tg, tb, ta; - int hasrgb; - const int radius = BKE_brush_size_get(scene, brush); - - if (brush->mtex.brush_map_mode == MTEX_MAP_MODE_3D) { - hasrgb = externtex(mtex, sampleco, &tin, &tr, &tg, &tb, &ta, thread, pool); - } - else { - float co[3]; - - co[0] = sampleco[0] / radius; - co[1] = sampleco[1] / radius; - co[2] = 0.0f; - - hasrgb = externtex(mtex, co, &tin, &tr, &tg, &tb, &ta, thread, pool); - } - - if (hasrgb) { - rgba[0] = tr; - rgba[1] = tg; - rgba[2] = tb; - rgba[3] = ta; - } - else { - rgba[0] = tin; - rgba[1] = tin; - rgba[2] = tin; - rgba[3] = 1.0f; - } - } - else { - rgba[0] = rgba[1] = rgba[2] = rgba[3] = 1.0f; - } -} - - /* Return a multiplier for brush strength on a particular vertex. */ float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br, const float point[3], - float rgba[3], + float rgba[3], const int thread, struct ImagePool *pool) { UnifiedPaintSettings *ups = &scene->toolsettings->unified_paint_settings; @@ -532,7 +490,7 @@ float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br, /* Get strength by feeding the vertex * location directly into a texture */ hasrgb = externtex(mtex, point, &intensity, - rgba, rgba + 1, rgba + 2, rgba + 3, 0, pool); + rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool); } else { float rotation = -mtex->rot; @@ -587,7 +545,7 @@ float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br, co[2] = 0.0f; hasrgb = externtex(mtex, co, &intensity, - rgba, rgba + 1, rgba + 2, rgba + 3, 0, pool); + rgba, rgba + 1, rgba + 2, rgba + 3, thread, pool); } intensity += br->texture_sample_bias; -- cgit v1.2.3