Revision: 38893
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=38893
Author: campbellbarton
Date: 2011-08-01 08:53:57 +0000 (Mon, 01 Aug 2011)
Log Message:
-----------
fix [#28061] Texture (paint) bleeding on edges
respect clamp u/v image options.
Modified Paths:
--------------
trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
2011-08-01 08:29:17 UTC (rev 38892)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
2011-08-01 08:53:57 UTC (rev 38893)
@@ -2187,7 +2187,7 @@
/* One of the most important function for projectiopn painting, since it
selects the pixels to be added into each bucket.
* initialize pixels from this face where it intersects with the bucket_index,
optionally initialize pixels for removing seams */
-static void project_paint_face_init(const ProjPaintState *ps, const int
thread_index, const int bucket_index, const int face_index, const int
image_index, rctf *bucket_bounds, const ImBuf *ibuf)
+static void project_paint_face_init(const ProjPaintState *ps, const int
thread_index, const int bucket_index, const int face_index, const int
image_index, rctf *bucket_bounds, const ImBuf *ibuf, const short clamp_u, const
short clamp_v)
{
/* Projection vars, to get the 3D locations into screen space */
MemArena *arena = ps->arena_mt[thread_index];
@@ -2304,14 +2304,24 @@
if (pixel_bounds_array(uv_clip, &bounds_px, ibuf->x, ibuf->y,
uv_clip_tot)) {
-
+
+ if(clamp_u) {
+ CLAMP(bounds_px.xmin, 0, ibuf->x);
+ CLAMP(bounds_px.xmax, 0, ibuf->x);
+ }
+
+ if(clamp_v) {
+ CLAMP(bounds_px.ymin, 0, ibuf->y);
+ CLAMP(bounds_px.ymax, 0, ibuf->y);
+ }
+
/* clip face and */
has_isect = 0;
for (y = bounds_px.ymin; y < bounds_px.ymax; y++) {
//uv[1] = (((float)y) + 0.5f) / (float)ibuf->y;
uv[1] = (float)y / ibuf_yf; /* use pixel offset
UV coords instead */
-
+
has_x_isect = 0;
for (x = bounds_px.xmin; x < bounds_px.xmax;
x++) {
//uv[0] = (((float)x) + 0.5f) / ibuf->x;
@@ -2630,6 +2640,7 @@
LinkNode *node;
int face_index, image_index=0;
ImBuf *ibuf = NULL;
+ Image *ima = NULL;
MTFace *tf;
Image *tpage_last = NULL;
@@ -2638,9 +2649,10 @@
if (ps->image_tot==1) {
/* Simple loop, no context switching */
ibuf = ps->projImages[0].ibuf;
-
+ ima = ps->projImages[0].ima;
+
for (node = ps->bucketFaces[bucket_index]; node; node=
node->next) {
- project_paint_face_init(ps, thread_index, bucket_index,
GET_INT_FROM_POINTER(node->link), 0, bucket_bounds, ibuf);
+ project_paint_face_init(ps, thread_index, bucket_index,
GET_INT_FROM_POINTER(node->link), 0, bucket_bounds, ibuf, ima->tpageflag &
IMA_CLAMP_U, ima->tpageflag & IMA_CLAMP_V);
}
}
else {
@@ -2659,14 +2671,14 @@
for (image_index=0; image_index <
ps->image_tot; image_index++) {
if (ps->projImages[image_index].ima ==
tpage_last) {
ibuf =
ps->projImages[image_index].ibuf;
+ ima =
ps->projImages[image_index].ima;
break;
}
}
}
/* context switching done */
- project_paint_face_init(ps, thread_index, bucket_index,
face_index, image_index, bucket_bounds, ibuf);
-
+ project_paint_face_init(ps, thread_index, bucket_index,
face_index, image_index, bucket_bounds, ibuf, ima->tpageflag & IMA_CLAMP_U,
ima->tpageflag & IMA_CLAMP_V);
}
}
_______________________________________________
Bf-blender-cvs mailing list
[email protected]
http://lists.blender.org/mailman/listinfo/bf-blender-cvs