Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/source
diff options
context:
space:
mode:
authorCampbell Barton <ideasman42@gmail.com>2009-04-27 18:22:02 +0400
committerCampbell Barton <ideasman42@gmail.com>2009-04-27 18:22:02 +0400
commit369c8b8055da5f43f52158fc629b6bb4e112d8a8 (patch)
tree1abca44df46ae892ce46f1aaea703af01c9e8814 /source
parente2582ba6c1eb075a3971c7a51e4873a954120c47 (diff)
[#18628] stuck triangle when projection painting -- 2.49RC1
Increasing the tolerance when making intersection comparisons fixed this. There is also a problem where a pixel aligned quad would get a diagonal line down the face. offset the pixel locations a little to avoid this (crappy I know but will fix most cases).
Diffstat (limited to 'source')
-rw-r--r--source/blender/src/imagepaint.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/source/blender/src/imagepaint.c b/source/blender/src/imagepaint.c
index 478debfb922..89dff67585e 100644
--- a/source/blender/src/imagepaint.c
+++ b/source/blender/src/imagepaint.c
@@ -186,7 +186,7 @@ typedef struct ImagePaintPartialRedraw {
// #define PROJ_BUCKET_CLONE_INIT 1<<1
/* used for testing doubles, if a point is on a line etc */
-#define PROJ_GEOM_TOLERANCE 0.0002f
+#define PROJ_GEOM_TOLERANCE 0.00075f
/* vert flags */
#define PROJ_VERT_CULL 1
@@ -2315,9 +2315,20 @@ static void project_paint_face_init(const ProjPaintState *ps, const int thread_i
/* Use tf_uv_pxoffset instead of tf->uv so we can offset the UV half a pixel
* this is done so we can avoid offseting all the pixels by 0.5 which causes
* problems when wrapping negative coords */
- xhalfpx = 0.5f / ibuf_xf;
- yhalfpx = 0.5f / ibuf_yf;
-
+ xhalfpx = (0.5f+ (PROJ_GEOM_TOLERANCE/3.0f) ) / ibuf_xf;
+ yhalfpx = (0.5f+ (PROJ_GEOM_TOLERANCE/4.0f) ) / ibuf_yf;
+
+ /* Note about (PROJ_GEOM_TOLERANCE/x) above...
+ Needed to add this offset since UV coords are often quads aligned to pixels.
+ In this case pixels can be exactly between 2 triangles causing nasty
+ artifacts.
+
+ This workaround can be removed and painting will still work on most cases
+ but since the first thing most people try is painting onto a quad- better make it work.
+ */
+
+
+
tf_uv_pxoffset[0][0] = tf->uv[0][0] - xhalfpx;
tf_uv_pxoffset[0][1] = tf->uv[0][1] - yhalfpx;