[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [13504] trunk/blender/source/blender/src/ sculptmode.c: == Sculpt ==
Nicholas Bishop
nicholasbishop at gmail.com
Thu Jan 31 19:32:34 CET 2008
Revision: 13504
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=13504
Author: nicholasbishop
Date: 2008-01-31 19:32:33 +0100 (Thu, 31 Jan 2008)
Log Message:
-----------
== Sculpt ==
Switched point projection used in brush texturing to floating point rather than integer; fixes some ugly artifacts in texture application.
Modified Paths:
--------------
trunk/blender/source/blender/src/sculptmode.c
Modified: trunk/blender/source/blender/src/sculptmode.c
===================================================================
--- trunk/blender/source/blender/src/sculptmode.c 2008-01-31 18:03:46 UTC (rev 13503)
+++ trunk/blender/source/blender/src/sculptmode.c 2008-01-31 18:32:33 UTC (rev 13504)
@@ -313,7 +313,7 @@
}
/* Convert a point in model coordinates to 2D screen coordinates. */
-void project(const float v[3], short p[2])
+static void projectf(const float v[3], float p[2])
{
SculptSession *ss= sculpt_session();
double ux, uy, uz;
@@ -324,6 +324,15 @@
p[1]= uy;
}
+static void project(const float v[3], short p[2])
+{
+ float f[2];
+ projectf(v, f);
+
+ p[0]= f[0];
+ p[1]= f[1];
+}
+
/* ===== Sculpting =====
*
*/
@@ -748,19 +757,14 @@
const unsigned tcw = ss->texcache_w, tch = ss->texcache_h;
int px, py;
unsigned i, *p;
- ProjVert pv;
-
+ float flip[3], point_2d[2];
+
/* If the active area is being applied for symmetry, flip it
across the symmetry axis in order to project it. This insures
that the brush texture will be oriented correctly. */
- if(!a->symm.index)
- pv= ss->projverts[vindex];
- else {
- float co[3];
- VecCopyf(co, point);
- flip_coord(co, a->symm.index);
- project(co, pv.co);
- }
+ VecCopyf(flip, point);
+ flip_coord(flip, a->symm.index);
+ projectf(flip, point_2d);
/* For Tile and Drag modes, get the 2D screen coordinates of the
and scale them up or down to the texture size. */
@@ -768,15 +772,15 @@
const int sx= (const int)sd->mtex[sd->texact]->size[0];
const int sy= (const int)sd->texsep ? sd->mtex[sd->texact]->size[1] : sx;
- float fx= pv.co[0];
- float fy= pv.co[1];
+ float fx= point_2d[0];
+ float fy= point_2d[1];
float angle= atan2(fy, fx) - rot;
float len= sqrtf(fx*fx + fy*fy);
if(rot<0.001 && rot>-0.001) {
- px= pv.co[0];
- py= pv.co[1];
+ px= point_2d[0];
+ py= point_2d[1];
} else {
px= len * cos(angle) + 2000;
py= len * sin(angle) + 2000;
@@ -785,10 +789,10 @@
px %= sx-1;
if(sy != 1)
py %= sy-1;
- p= get_texcache_pixel(ss, tcw*px/sx, tch*py/sy);
+ p= get_texcache_pixel(ss, tcw*px/sx, tch*py/sy);
} else {
- float fx= (pv.co[0] - a->mouse[0] + half) * (tcw*1.0f/bsize) - tcw/2;
- float fy= (pv.co[1] - a->mouse[1] + half) * (tch*1.0f/bsize) - tch/2;
+ float fx= (point_2d[0] - a->mouse[0] + half) * (tcw*1.0f/bsize) - tcw/2;
+ float fy= (point_2d[1] - a->mouse[1] + half) * (tch*1.0f/bsize) - tch/2;
float angle= atan2(fy, fx) - rot;
float len= sqrtf(fx*fx + fy*fy);
More information about the Bf-blender-cvs
mailing list