[Bf-blender-cvs] [3c3c2cd] master: Fix issue with texture painting: Tex slot scale was being applied twice.

Antony Riakiotakis noreply at git.blender.org
Sun Mar 2 18:40:56 CET 2014


Commit: 3c3c2cd53c3aa08d091ada93d337d6b99a546b08
Author: Antony Riakiotakis
Date:   Sun Mar 2 19:40:39 2014 +0200
https://developer.blender.org/rB3c3c2cd53c3aa08d091ada93d337d6b99a546b08

Fix issue with texture painting: Tex slot scale was being applied twice.

===================================================================

M	source/blender/blenkernel/intern/brush.c
M	source/blender/editors/sculpt_paint/paint_cursor.c

===================================================================

diff --git a/source/blender/blenkernel/intern/brush.c b/source/blender/blenkernel/intern/brush.c
index 4885798..4b2e791 100644
--- a/source/blender/blenkernel/intern/brush.c
+++ b/source/blender/blenkernel/intern/brush.c
@@ -561,11 +561,8 @@ float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br,
 		x /= (br->stencil_dimension[0]);
 		y /= (br->stencil_dimension[1]);
 
-		x *= mtex->size[0];
-		y *= mtex->size[1];
-
-		co[0] = x + mtex->ofs[0];
-		co[1] = y + mtex->ofs[1];
+		co[0] = x;
+		co[1] = y;
 		co[2] = 0.0f;
 
 		hasrgb = externtex(mtex, co, &intensity,
@@ -621,11 +618,8 @@ float BKE_brush_sample_tex_3D(const Scene *scene, Brush *br,
 			y = flen * sinf(angle);
 		}
 
-		x *= mtex->size[0];
-		y *= mtex->size[1];
-
-		co[0] = x + mtex->ofs[0];
-		co[1] = y + mtex->ofs[1];
+		co[0] = x;
+		co[1] = y;
 		co[2] = 0.0f;
 
 		hasrgb = externtex(mtex, co, &intensity,
@@ -985,8 +979,9 @@ unsigned int *BKE_brush_gen_texture_cache(Brush *br, int half_side, bool use_sec
 {
 	unsigned int *texcache = NULL;
 	MTex *mtex = (use_secondary) ? &br->mask_mtex : &br->mtex;
-	TexResult texres = {0};
-	int hasrgb, ix, iy;
+	float intensity;
+	float rgba[4];
+	int ix, iy;
 	int side = half_side * 2;
 
 	if (mtex->tex) {
@@ -1003,19 +998,13 @@ unsigned int *BKE_brush_gen_texture_cache(Brush *br, int half_side, bool use_sec
 
 				/* This is copied from displace modifier code */
 				/* TODO(sergey): brush are always cacheing with CM enabled for now. */
-				hasrgb = multitex_ext(mtex->tex, co, NULL, NULL, 0, &texres, NULL, true);
-
-				/* if the texture gave an RGB value, we assume it didn't give a valid
-				 * intensity, so calculate one (formula from do_material_tex).
-				 * if the texture didn't give an RGB value, copy the intensity across
-				 */
-				if (hasrgb & TEX_RGB)
-					texres.tin = rgb_to_grayscale(&texres.tr);
+				externtex(mtex, co, &intensity,
+						  rgba, rgba + 1, rgba + 2, rgba + 3, 0, NULL);
 
 				((char *)texcache)[(iy * side + ix) * 4] =
 				((char *)texcache)[(iy * side + ix) * 4 + 1] =
 				((char *)texcache)[(iy * side + ix) * 4 + 2] =
-				((char *)texcache)[(iy * side + ix) * 4 + 3] = (char)(texres.tin * 255.0f);
+				((char *)texcache)[(iy * side + ix) * 4 + 3] = (char)(intensity * 255.0f);
 			}
 		}
 	}
diff --git a/source/blender/editors/sculpt_paint/paint_cursor.c b/source/blender/editors/sculpt_paint/paint_cursor.c
index 07993db..1a5ccc8 100644
--- a/source/blender/editors/sculpt_paint/paint_cursor.c
+++ b/source/blender/editors/sculpt_paint/paint_cursor.c
@@ -238,12 +238,6 @@ static int load_tex(Brush *br, ViewContext *vc, float zoom, bool col, bool prima
 						y = len * sinf(angle);
 					}
 
-					x *= mtex->size[0];
-					y *= mtex->size[1];
-
-					x += mtex->ofs[0];
-					y += mtex->ofs[1];
-
 					if (col) {
 						float rgba[4];




More information about the Bf-blender-cvs mailing list