[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [40253] trunk/blender/source/blender: replace macros with math lib functions
Campbell Barton
ideasman42 at gmail.com
Fri Sep 16 08:56:50 CEST 2011
Revision: 40253
http://projects.blender.org/scm/viewvc.php?view=rev&root=bf-blender&revision=40253
Author: campbellbarton
Date: 2011-09-16 06:56:50 +0000 (Fri, 16 Sep 2011)
Log Message:
-----------
replace macros with math lib functions
Modified Paths:
--------------
trunk/blender/source/blender/blenkernel/intern/anim.c
trunk/blender/source/blender/editors/space_view3d/drawobject.c
trunk/blender/source/blender/editors/space_view3d/view3d_view.c
trunk/blender/source/blender/render/intern/raytrace/rayobject_octree.cpp
trunk/blender/source/blender/render/intern/source/convertblender.c
trunk/blender/source/blender/render/intern/source/rendercore.c
trunk/blender/source/blender/render/intern/source/zbuf.c
Modified: trunk/blender/source/blender/blenkernel/intern/anim.c
===================================================================
--- trunk/blender/source/blender/blenkernel/intern/anim.c 2011-09-16 06:47:01 UTC (rev 40252)
+++ trunk/blender/source/blender/blenkernel/intern/anim.c 2011-09-16 06:56:50 UTC (rev 40253)
@@ -1143,11 +1143,11 @@
w= (mv4)? 0.25f: 1.0f/3.0f;
if(orco) {
- VECADDFAC(dob->orco, dob->orco, orco[mv1], w);
- VECADDFAC(dob->orco, dob->orco, orco[mv2], w);
- VECADDFAC(dob->orco, dob->orco, orco[mv3], w);
+ madd_v3_v3v3fl(dob->orco, dob->orco, orco[mv1], w);
+ madd_v3_v3v3fl(dob->orco, dob->orco, orco[mv2], w);
+ madd_v3_v3v3fl(dob->orco, dob->orco, orco[mv3], w);
if(mv4)
- VECADDFAC(dob->orco, dob->orco, orco[mv4], w);
+ madd_v3_v3v3fl(dob->orco, dob->orco, orco[mv4], w);
}
if(mtface) {
Modified: trunk/blender/source/blender/editors/space_view3d/drawobject.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/drawobject.c 2011-09-16 06:47:01 UTC (rev 40252)
+++ trunk/blender/source/blender/editors/space_view3d/drawobject.c 2011-09-16 06:56:50 UTC (rev 40253)
@@ -5022,7 +5022,7 @@
#endif // XXX old animation system stuff
-static void draw_textcurs(float textcurs[][2])
+static void draw_textcurs(float textcurs[4][2])
{
cpack(0);
@@ -5039,12 +5039,14 @@
static void drawspiral(const float cent[3], float rad, float tmat[][4], int start)
{
float vec[3], vx[3], vy[3];
- int a, tot=32;
- char inverse=0;
-
+ const int tot=32;
+ const float tot_inv= (1.0f / 32.0f);
+ int a;
+ char inverse= FALSE;
+
if (start < 0) {
- inverse = 1;
- start *= -1;
+ inverse = TRUE;
+ start= -start;
}
mul_v3_v3fl(vx, tmat[0], rad);
@@ -5058,26 +5060,26 @@
start=-a + 1;
glBegin(GL_LINES);
glVertex3fv(vec);
- vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)a/(float)tot) + *(cosval+a+start) * (vy[0] * (float)a/(float)tot);
- vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)a/(float)tot) + *(cosval+a+start) * (vy[1] * (float)a/(float)tot);
- vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)a/(float)tot) + *(cosval+a+start) * (vy[2] * (float)a/(float)tot);
+ vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)a * tot_inv) + *(cosval+a+start) * (vy[0] * (float)a * tot_inv);
+ vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)a * tot_inv) + *(cosval+a+start) * (vy[1] * (float)a * tot_inv);
+ vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)a * tot_inv) + *(cosval+a+start) * (vy[2] * (float)a * tot_inv);
glVertex3fv(vec);
glEnd();
}
}
else {
a=0;
- vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[0] * (float)(-a+31)/(float)tot);
- vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[1] * (float)(-a+31)/(float)tot);
- vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[2] * (float)(-a+31)/(float)tot);
+ vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)(-a+31) * tot_inv) + *(cosval+a+start) * (vy[0] * (float)(-a+31) * tot_inv);
+ vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)(-a+31) * tot_inv) + *(cosval+a+start) * (vy[1] * (float)(-a+31) * tot_inv);
+ vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)(-a+31) * tot_inv) + *(cosval+a+start) * (vy[2] * (float)(-a+31) * tot_inv);
for(a=0; a<tot; a++) {
if (a+start>31)
start=-a + 1;
glBegin(GL_LINES);
glVertex3fv(vec);
- vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[0] * (float)(-a+31)/(float)tot);
- vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[1] * (float)(-a+31)/(float)tot);
- vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)(-a+31)/(float)tot) + *(cosval+a+start) * (vy[2] * (float)(-a+31)/(float)tot);
+ vec[0]= cent[0] + *(sinval+a+start) * (vx[0] * (float)(-a+31) * tot_inv) + *(cosval+a+start) * (vy[0] * (float)(-a+31) * tot_inv);
+ vec[1]= cent[1] + *(sinval+a+start) * (vx[1] * (float)(-a+31) * tot_inv) + *(cosval+a+start) * (vy[1] * (float)(-a+31) * tot_inv);
+ vec[2]= cent[2] + *(sinval+a+start) * (vx[2] * (float)(-a+31) * tot_inv) + *(cosval+a+start) * (vy[2] * (float)(-a+31) * tot_inv);
glVertex3fv(vec);
glEnd();
}
Modified: trunk/blender/source/blender/editors/space_view3d/view3d_view.c
===================================================================
--- trunk/blender/source/blender/editors/space_view3d/view3d_view.c 2011-09-16 06:47:01 UTC (rev 40252)
+++ trunk/blender/source/blender/editors/space_view3d/view3d_view.c 2011-09-16 06:56:50 UTC (rev 40253)
@@ -525,8 +525,8 @@
ED_view3d_win_to_vector(ar, mval, vec);
copy_v3_v3(ray_start, rv3d->viewinv[3]);
- VECADDFAC(ray_start, rv3d->viewinv[3], vec, v3d->near);
- VECADDFAC(ray_end, rv3d->viewinv[3], vec, v3d->far);
+ madd_v3_v3v3fl(ray_start, rv3d->viewinv[3], vec, v3d->near);
+ madd_v3_v3v3fl(ray_end, rv3d->viewinv[3], vec, v3d->far);
}
else {
float vec[4];
@@ -537,8 +537,8 @@
mul_m4_v4(rv3d->persinv, vec);
- VECADDFAC(ray_start, vec, rv3d->viewinv[2], 1000.0f);
- VECADDFAC(ray_end, vec, rv3d->viewinv[2], -1000.0f);
+ madd_v3_v3v3fl(ray_start, vec, rv3d->viewinv[2], 1000.0f);
+ madd_v3_v3v3fl(ray_end, vec, rv3d->viewinv[2], -1000.0f);
}
/* clipping */
Modified: trunk/blender/source/blender/render/intern/raytrace/rayobject_octree.cpp
===================================================================
--- trunk/blender/source/blender/render/intern/raytrace/rayobject_octree.cpp 2011-09-16 06:47:01 UTC (rev 40252)
+++ trunk/blender/source/blender/render/intern/raytrace/rayobject_octree.cpp 2011-09-16 06:56:50 UTC (rev 40253)
@@ -264,7 +264,7 @@
return 0;
}
-static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short z, float rtf[][3])
+static void ocwrite(Octree *oc, RayFace *face, int quad, short x, short y, short z, float rtf[4][3])
{
Branch *br;
Node *no;
Modified: trunk/blender/source/blender/render/intern/source/convertblender.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/convertblender.c 2011-09-16 06:47:01 UTC (rev 40252)
+++ trunk/blender/source/blender/render/intern/source/convertblender.c 2011-09-16 06:56:50 UTC (rev 40253)
@@ -1488,8 +1488,8 @@
if(part->draw & PART_DRAW_VEL_LENGTH)
mul_v3_fl(vel, len_v3(state->vel));
- VECADDFAC(loc0, loc, vel, -part->draw_line[0]);
- VECADDFAC(loc1, loc, vel, part->draw_line[1]);
+ madd_v3_v3v3fl(loc0, loc, vel, -part->draw_line[0]);
+ madd_v3_v3v3fl(loc1, loc, vel, part->draw_line[1]);
particle_curve(re, obr, dm, ma, sd, loc0, loc1, seed, pa_co);
Modified: trunk/blender/source/blender/render/intern/source/rendercore.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/rendercore.c 2011-09-16 06:47:01 UTC (rev 40252)
+++ trunk/blender/source/blender/render/intern/source/rendercore.c 2011-09-16 06:56:50 UTC (rev 40253)
@@ -2234,21 +2234,17 @@
maxdist= R.r.bake_maxdist;
else
maxdist= RE_RAYTRACE_MAXDIST + R.r.bake_biasdist;
-
+
/* 'dir' is always normalized */
- VECADDFAC(isect->start, start, dir, -R.r.bake_biasdist);
+ madd_v3_v3v3fl(isect->start, start, dir, -R.r.bake_biasdist);
- isect->dir[0] = dir[0]*sign;
- isect->dir[1] = dir[1]*sign;
- isect->dir[2] = dir[2]*sign;
+ mul_v3_v3fl(isect->dir, dir, sign);
isect->dist = maxdist;
hit = RE_rayobject_raycast(raytree, isect);
if(hit) {
- hitco[0] = isect->start[0] + isect->dist*isect->dir[0];
- hitco[1] = isect->start[1] + isect->dist*isect->dir[1];
- hitco[2] = isect->start[2] + isect->dist*isect->dir[2];
+ madd_v3_v3v3fl(hitco, isect->start, isect->dir, isect->dist);
*dist= isect->dist;
}
Modified: trunk/blender/source/blender/render/intern/source/zbuf.c
===================================================================
--- trunk/blender/source/blender/render/intern/source/zbuf.c 2011-09-16 06:47:01 UTC (rev 40252)
+++ trunk/blender/source/blender/render/intern/source/zbuf.c 2011-09-16 06:56:50 UTC (rev 40253)
@@ -843,7 +843,7 @@
}
-static int clipline(float *v1, float *v2) /* return 0: do not draw */
+static int clipline(float v1[4], float v2[4]) /* return 0: do not draw */
{
float dz,dw, u1=0.0, u2=1.0;
float dx, dy, v13;
@@ -893,7 +893,7 @@
return 0;
}
-void hoco_to_zco(ZSpan *zspan, float *zco, float *hoco)
+void hoco_to_zco(ZSpan *zspan, float zco[3], const float hoco[4])
{
float div;
@@ -998,7 +998,7 @@
}
-void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, float *ho1, float *ho2)
+void zbufsinglewire(ZSpan *zspan, int obi, int zvlnr, const float ho1[4], const float ho2[4])
{
float f1[4], f2[4];
int c1, c2;
@@ -1008,8 +1008,8 @@
if(c1 | c2) { /* not in the middle */
if(!(c1 & c2)) { /* not out completely */
- QUATCOPY(f1, ho1);
- QUATCOPY(f2, ho2);
+ copy_v4_v4(f1, ho1);
+ copy_v4_v4(f2, ho2);
if(clipline(f1, f2)) {
hoco_to_zco(zspan, f1, f1);
More information about the Bf-blender-cvs
mailing list