[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [25798] trunk/blender/source/blender: fix for painting bug added since 25391 (own fault)
Campbell Barton
ideasman42 at gmail.com
Thu Jan 7 13:41:07 CET 2010
Revision: 25798
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=25798
Author: campbellbarton
Date: 2010-01-07 13:41:07 +0100 (Thu, 07 Jan 2010)
Log Message:
-----------
fix for painting bug added since 25391 (own fault)
Making shell_angle_to_dist use radians was needed for solidify but somehow broke paint. Need to look into further but for now this fixes it.
Modified Paths:
--------------
trunk/blender/source/blender/blenlib/BLI_math_vector.h
trunk/blender/source/blender/blenlib/intern/math_vector_inline.c
trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
Modified: trunk/blender/source/blender/blenlib/BLI_math_vector.h
===================================================================
--- trunk/blender/source/blender/blenlib/BLI_math_vector.h 2010-01-07 11:37:57 UTC (rev 25797)
+++ trunk/blender/source/blender/blenlib/BLI_math_vector.h 2010-01-07 12:41:07 UTC (rev 25798)
@@ -72,11 +72,13 @@
MINLINE void mul_v2_fl(float r[2], float f);
MINLINE void mul_v3_fl(float r[3], float f);
MINLINE void mul_v3_v3fl(float r[3], float a[3], float f);
+MINLINE void mul_v2_v2(float r[2], const float a[2]);
MINLINE void mul_v3_v3(float r[3], float a[3]);
MINLINE void mul_v3_v3v3(float r[3], float a[3], float b[3]);
MINLINE void madd_v3_v3fl(float r[3], float a[3], float f);
MINLINE void madd_v3_v3v3(float r[3], float a[3], float b[3]);
+MINLINE void madd_v2_v2v2fl(float r[2], const float a[2], const float b[2], const float f);
MINLINE void madd_v3_v3v3fl(float r[3], float a[3], float b[3], float f);
MINLINE void madd_v3_v3v3v3(float r[3], float a[3], float b[3], float c[3]);
Modified: trunk/blender/source/blender/blenlib/intern/math_vector_inline.c
===================================================================
--- trunk/blender/source/blender/blenlib/intern/math_vector_inline.c 2010-01-07 11:37:57 UTC (rev 25797)
+++ trunk/blender/source/blender/blenlib/intern/math_vector_inline.c 2010-01-07 12:41:07 UTC (rev 25798)
@@ -145,6 +145,12 @@
r[2]= a[2]*f;
}
+MINLINE void mul_v2_v2(float r[2], const float a[2])
+{
+ r[0] *= a[0];
+ r[1] *= a[1];
+}
+
MINLINE void mul_v3_v3(float r[3], float a[3])
{
r[0] *= a[0];
@@ -166,6 +172,12 @@
r[2] += a[2]*b[2];
}
+MINLINE void madd_v2_v2v2fl(float r[2], const float a[2], const float b[2], const float f)
+{
+ r[0] = a[0] + b[0]*f;
+ r[1] = a[1] + b[1]*f;
+}
+
MINLINE void madd_v3_v3v3fl(float r[3], float a[3], float b[3], float f)
{
r[0] = a[0] + b[0]*f;
Modified: trunk/blender/source/blender/editors/sculpt_paint/paint_image.c
===================================================================
--- trunk/blender/source/blender/editors/sculpt_paint/paint_image.c 2010-01-07 11:37:57 UTC (rev 25797)
+++ trunk/blender/source/blender/editors/sculpt_paint/paint_image.c 2010-01-07 12:41:07 UTC (rev 25798)
@@ -1001,8 +1001,7 @@
float puv[4][2]; /* pixelspace uv's */
float no1[2], no2[2], no3[2], no4[2]; /* normals */
float dir1[2], dir2[2], dir3[2], dir4[2];
- float ibuf_x_inv = 1.0f / (float)ibuf_x;
- float ibuf_y_inv = 1.0f / (float)ibuf_y;
+ float ibuf_inv[2] = {1.0f / (float)ibuf_x, 1.0f / (float)ibuf_y};
/* make UV's in pixel space so we can */
puv[0][0] = orig_uv[0][0] * ibuf_x;
@@ -1035,17 +1034,20 @@
sub_v2_v2v2(dir3, puv[0], puv[2]);
normalize_v2(dir3);
}
-
+
+ /* TODO - angle_normalized_v2v2(...) * (M_PI/180.0f)
+ * This is incorrect. Its already given radians but without it wont work.
+ * need to look into a fix - campbell */
if (is_quad) {
- a1 = shell_angle_to_dist(angle_normalized_v2v2(dir4, dir1));
- a2 = shell_angle_to_dist(angle_normalized_v2v2(dir1, dir2));
- a3 = shell_angle_to_dist(angle_normalized_v2v2(dir2, dir3));
- a4 = shell_angle_to_dist(angle_normalized_v2v2(dir3, dir4));
+ a1 = shell_angle_to_dist(angle_normalized_v2v2(dir4, dir1) * (M_PI/180.0f));
+ a2 = shell_angle_to_dist(angle_normalized_v2v2(dir1, dir2) * (M_PI/180.0f));
+ a3 = shell_angle_to_dist(angle_normalized_v2v2(dir2, dir3) * (M_PI/180.0f));
+ a4 = shell_angle_to_dist(angle_normalized_v2v2(dir3, dir4) * (M_PI/180.0f));
}
else {
- a1 = shell_angle_to_dist(angle_normalized_v2v2(dir3, dir1));
- a2 = shell_angle_to_dist(angle_normalized_v2v2(dir1, dir2));
- a3 = shell_angle_to_dist(angle_normalized_v2v2(dir2, dir3));
+ a1 = shell_angle_to_dist(angle_normalized_v2v2(dir3, dir1) * (M_PI/180.0f));
+ a2 = shell_angle_to_dist(angle_normalized_v2v2(dir1, dir2) * (M_PI/180.0f));
+ a3 = shell_angle_to_dist(angle_normalized_v2v2(dir2, dir3) * (M_PI/180.0f));
}
if (is_quad) {
@@ -1065,17 +1067,10 @@
add_v2_v2v2(outset_uv[1], puv[1], no2);
add_v2_v2v2(outset_uv[2], puv[2], no3);
add_v2_v2v2(outset_uv[3], puv[3], no4);
- outset_uv[0][0] *= ibuf_x_inv;
- outset_uv[0][1] *= ibuf_y_inv;
-
- outset_uv[1][0] *= ibuf_x_inv;
- outset_uv[1][1] *= ibuf_y_inv;
-
- outset_uv[2][0] *= ibuf_x_inv;
- outset_uv[2][1] *= ibuf_y_inv;
-
- outset_uv[3][0] *= ibuf_x_inv;
- outset_uv[3][1] *= ibuf_y_inv;
+ mul_v2_v2(outset_uv[0], ibuf_inv);
+ mul_v2_v2(outset_uv[1], ibuf_inv);
+ mul_v2_v2(outset_uv[2], ibuf_inv);
+ mul_v2_v2(outset_uv[3], ibuf_inv);
}
else {
sub_v2_v2v2(no1, dir3, dir1);
@@ -1090,14 +1085,10 @@
add_v2_v2v2(outset_uv[0], puv[0], no1);
add_v2_v2v2(outset_uv[1], puv[1], no2);
add_v2_v2v2(outset_uv[2], puv[2], no3);
- outset_uv[0][0] *= ibuf_x_inv;
- outset_uv[0][1] *= ibuf_y_inv;
-
- outset_uv[1][0] *= ibuf_x_inv;
- outset_uv[1][1] *= ibuf_y_inv;
-
- outset_uv[2][0] *= ibuf_x_inv;
- outset_uv[2][1] *= ibuf_y_inv;
+
+ mul_v2_v2(outset_uv[0], ibuf_inv);
+ mul_v2_v2(outset_uv[1], ibuf_inv);
+ mul_v2_v2(outset_uv[2], ibuf_inv);
}
}
More information about the Bf-blender-cvs
mailing list