use fabsf when using floats.

This commit is contained in:
2012-07-21 15:27:40 +00:00
parent 1bb7cfded6
commit 62a73381a7
26 changed files with 91 additions and 91 deletions

View File

@@ -1438,9 +1438,9 @@ static void cyclic_offs_bone(Object *ob, bPose *pose, bActionStrip *strip, float
if (strip->flag & ACTSTRIP_CYCLIC_USEZ) pose->cyclic_offset[2] = time * min[2];
}
else {
if (fabs(min[0]) >= fabs(min[1]) && fabs(min[0]) >= fabs(min[2]))
if (fabsf(min[0]) >= fabsf(min[1]) && fabsf(min[0]) >= fabsf(min[2]))
pose->cyclic_offset[0] = time * min[0];
else if (fabs(min[1]) >= fabs(min[0]) && fabs(min[1]) >= fabs(min[2]))
else if (fabsf(min[1]) >= fabsf(min[0]) && fabsf(min[1]) >= fabsf(min[2]))
pose->cyclic_offset[1] = time * min[1];
else
pose->cyclic_offset[2] = time * min[2];

View File

@@ -1712,7 +1712,7 @@ static void calc_bevel_sin_cos(float x1, float y1, float x2, float y2, float *si
y2 /= t02;
t02 = x1 * x2 + y1 * y2;
if (fabs(t02) >= 1.0)
if (fabsf(t02) >= 1.0f)
t02 = 0.5 * M_PI;
else
t02 = (saacos(t02)) / 2.0f;
@@ -2366,9 +2366,9 @@ void BKE_curve_bevelList_make(Object *ob)
bevp0 = bevp1 + (nr - 1);
nr--;
while (nr--) {
if (fabs(bevp0->vec[0] - bevp1->vec[0]) < 0.00001) {
if (fabs(bevp0->vec[1] - bevp1->vec[1]) < 0.00001) {
if (fabs(bevp0->vec[2] - bevp1->vec[2]) < 0.00001) {
if (fabsf(bevp0->vec[0] - bevp1->vec[0]) < 0.00001f) {
if (fabsf(bevp0->vec[1] - bevp1->vec[1]) < 0.00001f) {
if (fabsf(bevp0->vec[2] - bevp1->vec[2]) < 0.00001f) {
bevp0->dupe_tag = TRUE;
bl->dupe_nr++;
}

View File

@@ -95,7 +95,7 @@ int BLI_lasso_is_point_inside(int mcords[][2], short moves,
p2 = mcords[a + 1];
}
if (fabs(angletot) > 4.0) return 1;
if (fabsf(angletot) > 4.0f) return 1;
return 0;
}

View File

@@ -583,17 +583,17 @@ static short IsectLLPt2Df(const float x0, const float y0, const float x1, const
* compute slopes, note the cludge for infinity, however, this will
* be close enough
*/
if (fabs(x1 - x0) > 0.000001f)
if (fabsf(x1 - x0) > 0.000001f)
m1 = (y1 - y0) / (x1 - x0);
else
return -1; /*m1 = (float)1e+10;*/ /* close enough to infinity */
if (fabs(x3 - x2) > 0.000001f)
if (fabsf(x3 - x2) > 0.000001f)
m2 = (y3 - y2) / (x3 - x2);
else
return -1; /*m2 = (float)1e+10;*/ /* close enough to infinity */
if (fabs(m1 - m2) < 0.000001f)
if (fabsf(m1 - m2) < 0.000001f)
return -1; /* parallel lines */
/* compute constants */

View File

@@ -453,7 +453,7 @@ void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag)
nor[1] = -z2;
nor[2] = y2;
if (fabs(y2) + fabs(z2) < 0.0001)
if (fabsf(y2) + fabsf(z2) < 0.0001f)
nor[1] = 1.0;
co = x2;
@@ -463,7 +463,7 @@ void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag)
nor[1] = 0.0;
nor[2] = -x2;
if (fabs(x2) + fabs(z2) < 0.0001)
if (fabsf(x2) + fabsf(z2) < 0.0001f)
nor[2] = 1.0;
co = y2;
@@ -473,7 +473,7 @@ void vec_to_quat(float q[4], const float vec[3], short axis, const short upflag)
nor[1] = x2;
nor[2] = 0.0;
if (fabs(x2) + fabs(y2) < 0.0001)
if (fabsf(x2) + fabsf(y2) < 0.0001f)
nor[0] = 1.0;
co = z2;
@@ -696,7 +696,7 @@ void quat_to_axis_angle(float axis[3], float *angle, const float q[4])
*angle = ha * 2;
/* prevent division by zero for axis conversion */
if (fabs(si) < 0.0005)
if (fabsf(si) < 0.0005f)
si = 1.0f;
axis[0] = q[1] / si;
@@ -998,7 +998,7 @@ void mat3_to_eul(float *eul, float tmat[][3])
mat3_to_eul2(tmat, eul1, eul2);
/* return best, which is just the one with lowest values it in */
if (fabs(eul1[0]) + fabs(eul1[1]) + fabs(eul1[2]) > fabs(eul2[0]) + fabs(eul2[1]) + fabs(eul2[2])) {
if (fabsf(eul1[0]) + fabsf(eul1[1]) + fabsf(eul1[2]) > fabsf(eul2[0]) + fabsf(eul2[1]) + fabsf(eul2[2])) {
copy_v3_v3(eul, eul2);
}
else {
@@ -1083,32 +1083,32 @@ void compatible_eul(float eul[3], const float oldrot[3])
dy = eul[1] - oldrot[1];
dz = eul[2] - oldrot[2];
while (fabs(dx) > 5.1) {
while (fabsf(dx) > 5.1f) {
if (dx > 0.0f) eul[0] -= 2.0f * (float)M_PI;
else eul[0] += 2.0f * (float)M_PI;
dx = eul[0] - oldrot[0];
}
while (fabs(dy) > 5.1) {
while (fabsf(dy) > 5.1f) {
if (dy > 0.0f) eul[1] -= 2.0f * (float)M_PI;
else eul[1] += 2.0f * (float)M_PI;
dy = eul[1] - oldrot[1];
}
while (fabs(dz) > 5.1) {
while (fabsf(dz) > 5.1f) {
if (dz > 0.0f) eul[2] -= 2.0f * (float)M_PI;
else eul[2] += 2.0f * (float)M_PI;
dz = eul[2] - oldrot[2];
}
/* is 1 of the axis rotations larger than 180 degrees and the other small? NO ELSE IF!! */
if (fabs(dx) > 3.2 && fabs(dy) < 1.6 && fabs(dz) < 1.6) {
if (fabsf(dx) > 3.2f && fabsf(dy) < 1.6f && fabsf(dz) < 1.6f) {
if (dx > 0.0f) eul[0] -= 2.0f * (float)M_PI;
else eul[0] += 2.0f * (float)M_PI;
}
if (fabs(dy) > 3.2 && fabs(dz) < 1.6 && fabs(dx) < 1.6) {
if (fabsf(dy) > 3.2f && fabsf(dz) < 1.6f && fabsf(dx) < 1.6f) {
if (dy > 0.0f) eul[1] -= 2.0f * (float)M_PI;
else eul[1] += 2.0f * (float)M_PI;
}
if (fabs(dz) > 3.2 && fabs(dx) < 1.6 && fabs(dy) < 1.6) {
if (fabsf(dz) > 3.2f && fabsf(dx) < 1.6f && fabsf(dy) < 1.6f) {
if (dz > 0.0f) eul[2] -= 2.0f * (float)M_PI;
else eul[2] += 2.0f * (float)M_PI;
}
@@ -1123,29 +1123,29 @@ void compatible_eul(float eul[3], const float oldrot[3])
/* special case, tested for x-z */
if ((fabs(dx) > 3.1 && fabs(dz) > 1.5) || (fabs(dx) > 1.5 && fabs(dz) > 3.1)) {
if (dx > 0.0) eul[0] -= M_PI;
if ((fabsf(dx) > 3.1f && fabsf(dz) > 1.5f) || (fabsf(dx) > 1.5f && fabsf(dz) > 3.1f)) {
if (dx > 0.0f) eul[0] -= M_PI;
else eul[0] += M_PI;
if (eul[1] > 0.0) eul[1] = M_PI - eul[1];
else eul[1] = -M_PI - eul[1];
if (dz > 0.0) eul[2] -= M_PI;
if (dz > 0.0f) eul[2] -= M_PI;
else eul[2] += M_PI;
}
else if ((fabs(dx) > 3.1 && fabs(dy) > 1.5) || (fabs(dx) > 1.5 && fabs(dy) > 3.1)) {
if (dx > 0.0) eul[0] -= M_PI;
else if ((fabsf(dx) > 3.1f && fabsf(dy) > 1.5f) || (fabsf(dx) > 1.5f && fabsf(dy) > 3.1f)) {
if (dx > 0.0f) eul[0] -= M_PI;
else eul[0] += M_PI;
if (dy > 0.0) eul[1] -= M_PI;
if (dy > 0.0f) eul[1] -= M_PI;
else eul[1] += M_PI;
if (eul[2] > 0.0) eul[2] = M_PI - eul[2];
if (eul[2] > 0.0f) eul[2] = M_PI - eul[2];
else eul[2] = -M_PI - eul[2];
}
else if ((fabs(dy) > 3.1 && fabs(dz) > 1.5) || (fabs(dy) > 1.5 && fabs(dz) > 3.1)) {
if (eul[0] > 0.0) eul[0] = M_PI - eul[0];
else if ((fabsf(dy) > 3.1f && fabsf(dz) > 1.5f) || (fabsf(dy) > 1.5f && fabsf(dz) > 3.f1)) {
if (eul[0] > 0.0f) eul[0] = M_PI - eul[0];
else eul[0] = -M_PI - eul[0];
if (dy > 0.0) eul[1] -= M_PI;
if (dy > 0.0f) eul[1] -= M_PI;
else eul[1] += M_PI;
if (dz > 0.0) eul[2] -= M_PI;
if (dz > 0.0f) eul[2] -= M_PI;
else eul[2] += M_PI;
}
#endif
@@ -1164,8 +1164,8 @@ void mat3_to_compatible_eul(float eul[3], const float oldrot[3], float mat[][3])
compatible_eul(eul1, oldrot);
compatible_eul(eul2, oldrot);
d1 = (float)fabs(eul1[0] - oldrot[0]) + (float)fabs(eul1[1] - oldrot[1]) + (float)fabs(eul1[2] - oldrot[2]);
d2 = (float)fabs(eul2[0] - oldrot[0]) + (float)fabs(eul2[1] - oldrot[1]) + (float)fabs(eul2[2] - oldrot[2]);
d1 = (float)fabsf(eul1[0] - oldrot[0]) + (float)fabsf(eul1[1] - oldrot[1]) + (float)fabsf(eul1[2] - oldrot[2]);
d2 = (float)fabsf(eul2[0] - oldrot[0]) + (float)fabsf(eul2[1] - oldrot[1]) + (float)fabsf(eul2[2] - oldrot[2]);
/* return best, which is just the one with lowest difference */
if (d1 > d2) {
@@ -1360,7 +1360,7 @@ void mat3_to_eulO(float eul[3], const short order, float M[3][3])
mat3_to_eulo2(M, eul1, eul2, order);
/* return best, which is just the one with lowest values it in */
if (fabs(eul1[0]) + fabs(eul1[1]) + fabs(eul1[2]) > fabs(eul2[0]) + fabs(eul2[1]) + fabs(eul2[2])) {
if (fabsf(eul1[0]) + fabsf(eul1[1]) + fabsf(eul1[2]) > fabsf(eul2[0]) + fabsf(eul2[1]) + fabsf(eul2[2])) {
copy_v3_v3(eul, eul2);
}
else {

View File

@@ -2134,7 +2134,7 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor
/* TODO - investigate why block->winmat[0][0] is negative
* in the image view when viewRedrawForce is called */
block->aspect = 2.0 / fabs( (getsizex) * block->winmat[0][0]);
block->aspect = 2.0f / fabsf(getsizex * block->winmat[0][0]);
}
else {
/* no subwindow created yet, for menus for example, so we
@@ -2143,7 +2143,7 @@ uiBlock *uiBeginBlock(const bContext *C, ARegion *region, const char *name, shor
wm_subwindow_getmatrix(window, window->screen->mainwin, block->winmat);
wm_subwindow_getsize(window, window->screen->mainwin, &getsizex, &getsizey);
block->aspect = 2.0 / fabs(getsizex * block->winmat[0][0]);
block->aspect = 2.0f / fabsf(getsizex * block->winmat[0][0]);
block->auto_open = TRUE;
block->flag |= UI_BLOCK_LOOP; /* tag as menu */
}

View File

@@ -1030,13 +1030,13 @@ static float *editmesh_get_mirror_uv(BMEditMesh *em, int axis, float *uv, float
BM_ITER_MESH (efa, &iter, em->bm, BM_FACES_OF_MESH) {
uv_poly_center(em, efa, cent);
if ( (fabs(cent[0] - cent_vec[0]) < 0.001) && (fabs(cent[1] - cent_vec[1]) < 0.001) ) {
if ( (fabsf(cent[0] - cent_vec[0]) < 0.001f) && (fabsf(cent[1] - cent_vec[1]) < 0.001f) ) {
BMIter liter;
BMLoop *l;
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
MLoopUV *luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
if ( (fabs(luv->uv[0] - vec[0]) < 0.001) && (fabs(luv->uv[1] - vec[1]) < 0.001) ) {
if ( (fabsf(luv->uv[0] - vec[0]) < 0.001f) && (fabsf(luv->uv[1] - vec[1]) < 0.001f) ) {
return luv->uv;
}

View File

@@ -954,7 +954,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
dist = dists[i];
}
else {
if (fabs(dist - distToBe) < fabs(dists[i] - distToBe)) {
if (fabsf(dist - distToBe) < fabsf(dists[i] - distToBe)) {
upDown[i] = 0;
changes[i][0] = vc;
changes[i][1] = hc;
@@ -963,7 +963,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
else {
upDown[i] = 1;
}
if (fabs(dists[i] - distToBe) > fabs(distToStart - distToBe)) {
if (fabsf(dists[i] - distToBe) > fabsf(distToStart - distToBe)) {
changes[i][0] = 0;
changes[i][1] = 0;
dists[i] = distToStart;
@@ -979,7 +979,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
for (i = k + 1; i < totweight; i++) {
dist = dists[i];
if (fabs(dist) > fabs(dists[i])) {
if (fabsf(dist) > fabsf(dists[i])) {
bestIndex = i;
}
}
@@ -1009,7 +1009,7 @@ static void moveCloserToDistanceFromPlane(Scene *scene, Object *ob, Mesh *me, in
bestIndex = -1;
/* find the best change with an acceptable horizontal change */
for (i = 0; i < totweight; i++) {
if (fabs(changes[i][0]) > fabs(changes[i][1] * 2.0f)) {
if (fabsf(changes[i][0]) > fabsf(changes[i][1] * 2.0f)) {
bestIndex = i;
break;
}

View File

@@ -287,7 +287,7 @@ void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const in
/* the triangle with the largest absolute values is the one
* with the most negative weights */
imapaint_tri_weights(ob, mv[0].co, mv[1].co, mv[3].co, p, w);
absw = fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
absw = fabsf(w[0]) + fabsf(w[1]) + fabsf(w[2]);
if (absw < minabsw) {
uv[0] = tf->uv[0][0] * w[0] + tf->uv[1][0] * w[1] + tf->uv[3][0] * w[2];
uv[1] = tf->uv[0][1] * w[0] + tf->uv[1][1] * w[1] + tf->uv[3][1] * w[2];
@@ -295,7 +295,7 @@ void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const in
}
imapaint_tri_weights(ob, mv[1].co, mv[2].co, mv[3].co, p, w);
absw = fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
absw = fabsf(w[0]) + fabsf(w[1]) + fabsf(w[2]);
if (absw < minabsw) {
uv[0] = tf->uv[1][0] * w[0] + tf->uv[2][0] * w[1] + tf->uv[3][0] * w[2];
uv[1] = tf->uv[1][1] * w[0] + tf->uv[2][1] * w[1] + tf->uv[3][1] * w[2];
@@ -304,7 +304,7 @@ void imapaint_pick_uv(Scene *scene, Object *ob, unsigned int faceindex, const in
}
else {
imapaint_tri_weights(ob, mv[0].co, mv[1].co, mv[2].co, p, w);
absw = fabs(w[0]) + fabs(w[1]) + fabs(w[2]);
absw = fabsf(w[0]) + fabsf(w[1]) + fabsf(w[2]);
if (absw < minabsw) {
uv[0] = tf->uv[0][0] * w[0] + tf->uv[1][0] * w[1] + tf->uv[2][0] * w[2];
uv[1] = tf->uv[0][1] * w[0] + tf->uv[1][1] * w[1] + tf->uv[2][1] * w[2];

View File

@@ -6191,9 +6191,9 @@ static void get_local_bounds(Object *ob, float center[3], float size[3])
copy_v3_v3(size, ob->size);
}
else {
size[0] = 0.5 * fabs(bb->vec[0][0] - bb->vec[4][0]);
size[1] = 0.5 * fabs(bb->vec[0][1] - bb->vec[2][1]);
size[2] = 0.5 * fabs(bb->vec[0][2] - bb->vec[1][2]);
size[0] = 0.5 * fabsf(bb->vec[0][0] - bb->vec[4][0]);
size[1] = 0.5 * fabsf(bb->vec[0][1] - bb->vec[2][1]);
size[2] = 0.5 * fabsf(bb->vec[0][2] - bb->vec[1][2]);
center[0] = (bb->vec[0][0] + bb->vec[4][0]) / 2.0;
center[1] = (bb->vec[0][1] + bb->vec[2][1]) / 2.0;

View File

@@ -333,8 +333,9 @@ static int initFlyInfo(bContext *C, FlyInfo *fly, wmOperator *op, wmEvent *event
upvec[2] = 0.0f;
copy_m3_m4(mat, fly->rv3d->viewinv);
mul_m3_v3(mat, upvec);
if (fabs(upvec[2]) < 0.1)
if (fabsf(upvec[2]) < 0.1f) {
fly->zlock = 1;
}
upvec[0] = 0;
upvec[1] = 0;
upvec[2] = 0;

View File

@@ -288,7 +288,7 @@ static void planeProjection(TransInfo *t, float in[3], float out[3])
sub_v3_v3v3(vec, out, in);
factor = dot_v3v3(vec, norm);
if (fabs(factor) <= 0.001) {
if (fabsf(factor) <= 0.001f) {
return; /* prevent divide by zero */
}
factor = dot_v3v3(vec, vec) / factor;

View File

@@ -607,7 +607,7 @@ static void test_manipulator_axis(const bContext *C)
ED_view3d_global_to_vector(rv3d, rv3d->twmat[3], vec);
angle = fabs(angle_v3v3(rv3d->twmat[0], vec));
angle = fabsf(angle_v3v3(rv3d->twmat[0], vec));
if (angle > (float)M_PI / 2.0f) {
angle = (float)M_PI - angle;
}
@@ -616,7 +616,7 @@ static void test_manipulator_axis(const bContext *C)
rv3d->twdrawflag &= ~(MAN_TRANS_X | MAN_SCALE_X);
}
angle = fabs(angle_v3v3(rv3d->twmat[1], vec));
angle = fabsf(angle_v3v3(rv3d->twmat[1], vec));
if (angle > (float)M_PI / 2.0f) {
angle = (float)M_PI - angle;
}
@@ -625,7 +625,7 @@ static void test_manipulator_axis(const bContext *C)
rv3d->twdrawflag &= ~(MAN_TRANS_Y | MAN_SCALE_Y);
}
angle = fabs(angle_v3v3(rv3d->twmat[2], vec));
angle = fabsf(angle_v3v3(rv3d->twmat[2], vec));
if (angle > (float)M_PI / 2.0f) {
angle = (float)M_PI - angle;
}

View File

@@ -1081,7 +1081,7 @@ static void TargetSnapClosest(TransInfo *t)
dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist)) {
if (closest == NULL || fabsf(dist) < fabsf(t->tsnap.dist)) {
copy_v3_v3(t->tsnap.snapTarget, loc);
closest = td;
t->tsnap.dist = dist;
@@ -1097,7 +1097,7 @@ static void TargetSnapClosest(TransInfo *t)
dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist)) {
if (closest == NULL || fabsf(dist) < fabsf(t->tsnap.dist)) {
copy_v3_v3(t->tsnap.snapTarget, loc);
closest = td;
t->tsnap.dist = dist;
@@ -1120,7 +1120,7 @@ static void TargetSnapClosest(TransInfo *t)
dist = t->tsnap.distance(t, loc, t->tsnap.snapPoint);
if (closest == NULL || fabs(dist) < fabs(t->tsnap.dist)) {
if (closest == NULL || fabsf(dist) < fabsf(t->tsnap.dist)) {
copy_v3_v3(t->tsnap.snapTarget, loc);
closest = td;
t->tsnap.dist = dist;

View File

@@ -733,7 +733,7 @@ static void find_nearest_uv_face(Scene *scene, Image *ima, BMEditMesh *em, const
uv_poly_center(em, efa, cent);
dist = fabs(co[0] - cent[0]) + fabs(co[1] - cent[1]);
dist = fabsf(co[0] - cent[0]) + fabsf(co[1] - cent[1]);
if (dist < mindist) {
hit->tf = tf;
@@ -869,7 +869,7 @@ int ED_uvedit_nearest_uv(Scene *scene, Object *obedit, Image *ima, const float c
BM_ITER_ELEM (l, &liter, efa, BM_LOOPS_OF_FACE) {
luv = CustomData_bmesh_get(&em->bm->ldata, l->head.data, CD_MLOOPUV);
dist = fabs(co[0] - luv->uv[0]) + fabs(co[1] - luv->uv[1]);
dist = fabsf(co[0] - luv->uv[0]) + fabsf(co[1] - luv->uv[1]);
if (dist <= mindist) {
mindist = dist;

View File

@@ -381,9 +381,9 @@ static void cuboid_do(
}
/* we want a symmetric bound box around the origin */
if (fabs(min[0]) > fabs(max[0])) max[0] = fabs(min[0]);
if (fabs(min[1]) > fabs(max[1])) max[1] = fabs(min[1]);
if (fabs(min[2]) > fabs(max[2])) max[2] = fabs(min[2]);
if (fabsf(min[0]) > fabsf(max[0])) max[0] = fabsf(min[0]);
if (fabsf(min[1]) > fabsf(max[1])) max[1] = fabsf(min[1]);
if (fabsf(min[2]) > fabsf(max[2])) max[2] = fabsf(min[2]);
min[0] = -max[0];
min[1] = -max[1];
min[2] = -max[2];

View File

@@ -65,7 +65,7 @@ static void colorfn(float *out, TexParams *p, bNode *node, bNodeStack **in, shor
if (node->custom2 || node->need_exec==0) {
/* this node refers to its own texture tree! */
copy_v4_v4(out, (fabs(co[0] - co[1]) < 0.01) ? white : red);
copy_v4_v4(out, (fabsf(co[0] - co[1]) < 0.01f) ? white : red);
}
else if (nodetex) {
TexResult texres;

View File

@@ -2374,9 +2374,8 @@ static void displace_render_face(Render *re, ObjectRen *obr, VlakRen *vlr, float
displace_render_vert(re, obr, &shi, vlr->v4, 3, scale, mat, imat);
/* closest in displace value. This will help smooth edges. */
if ( fabs(vlr->v1->accum - vlr->v3->accum) > fabs(vlr->v2->accum - vlr->v4->accum))
vlr->flag |= R_DIVIDE_24;
else vlr->flag &= ~R_DIVIDE_24;
if (fabsf(vlr->v1->accum - vlr->v3->accum) > fabsf(vlr->v2->accum - vlr->v4->accum)) vlr->flag |= R_DIVIDE_24;
else vlr->flag &= ~R_DIVIDE_24;
}
/* Recalculate the face normal - if flipped before, flip now */
@@ -4260,8 +4259,8 @@ static void check_non_flat_quads(ObjectRen *obr)
normal_tri_v3(nor, vlr->v2->co, vlr->v3->co, vlr->v4->co);
d2 = dot_v3v3(nor, vlr->v2->n);
if ( fabs(d1) < fabs(d2) ) vlr->flag |= R_DIVIDE_24;
else vlr->flag &= ~R_DIVIDE_24;
if (fabsf(d1) < fabsf(d2) ) vlr->flag |= R_DIVIDE_24;
else vlr->flag &= ~R_DIVIDE_24;
/* new vertex pointers */
if (vlr->flag & R_DIVIDE_24) {

View File

@@ -791,9 +791,9 @@ static int cubemap(MTex *mtex, VlakRen *vlr, const float n[3], float x, float y,
float nor[3];
normal_tri_v3(nor, vlr->v1->orco, vlr->v2->orco, vlr->v3->orco);
if ( fabs(nor[0])<fabs(nor[2]) && fabs(nor[1])<fabs(nor[2]) ) vlr->puno |= ME_PROJXY;
else if ( fabs(nor[0])<fabs(nor[1]) && fabs(nor[2])<fabs(nor[1]) ) vlr->puno |= ME_PROJXZ;
else vlr->puno |= ME_PROJYZ;
if (fabsf(nor[0]) < fabsf(nor[2]) && fabsf(nor[1]) < fabsf(nor[2])) vlr->puno |= ME_PROJXY;
else if (fabsf(nor[0]) < fabsf(nor[1]) && fabsf(nor[2]) < fabsf(nor[1])) vlr->puno |= ME_PROJXZ;
else vlr->puno |= ME_PROJYZ;
}
else return cubemap_glob(n, x, y, z, adr1, adr2);
}

View File

@@ -1309,11 +1309,11 @@ void project_renderdata(Render *re, void (*projectfunc)(const float *, float mat
/* the Zd value is still not really correct for pano */
vec[2]-= har->hasize; /* z negative, otherwise it's clipped */
vec[2] -= har->hasize; /* z negative, otherwise it's clipped */
projectfunc(vec, re->winmat, hoco);
zn= hoco[3];
zn= fabs( (float)har->zs - 0x7FFFFF*(hoco[2]/zn));
har->zd= CLAMPIS(zn, 0, INT_MAX);
zn = hoco[3];
zn = fabsf((float)har->zs - 0x7FFFFF * (hoco[2] / zn));
har->zd = CLAMPIS(zn, 0, INT_MAX);
}

View File

@@ -1176,8 +1176,8 @@ float testshadowbuf(Render *re, ShadBuf *shb, const float co[3], const float dxc
dy[0]= xs1 - dy[0];
dy[1]= ys1 - dy[1];
xres= fac*(fabs(dx[0]) + fabs(dy[0]));
yres= fac*(fabs(dx[1]) + fabs(dy[1]));
xres = fac * (fabsf(dx[0]) + fabsf(dy[0]));
yres = fac * (fabsf(dx[1]) + fabsf(dy[1]));
if (xres<1.0f) xres= 1.0f;
if (yres<1.0f) yres= 1.0f;

View File

@@ -577,8 +577,8 @@ static void do_strand_fillac(void *handle, int x, int y, float u, float v, float
/* add to pixel list */
if (zverg < bufferz && (spart->totapixbuf[offset] < MAX_ZROW)) {
if (!spart->rectmask || zverg > maskz) {
t = u*spart->t[0] + v*spart->t[1] + (1.0f-u-v)*spart->t[2];
s = fabs(u*spart->s[0] + v*spart->s[1] + (1.0f-u-v)*spart->s[2]);
t = u * spart->t[0] + v * spart->t[1] + (1.0f - u - v) * spart->t[2];
s = fabsf(u * spart->s[0] + v * spart->s[1] + (1.0f - u - v) * spart->s[2]);
apn= spart->apixbuf + offset;
while (apn) {

View File

@@ -443,7 +443,7 @@ static void zbuflineAc(ZSpan *zspan, int obi, int zvlnr, const float vec1[3], co
mask= zspan->mask;
if (fabs(dx) > fabs(dy)) {
if (fabsf(dx) > fabsf(dy)) {
/* all lines from left to right */
if (vec1[0]<vec2[0]) {
@@ -597,7 +597,7 @@ static void zbufline(ZSpan *zspan, int obi, int zvlnr, const float vec1[3], cons
dx= vec2[0]-vec1[0];
dy= vec2[1]-vec1[1];
if (fabs(dx) > fabs(dy)) {
if (fabsf(dx) > fabsf(dy)) {
/* all lines from left to right */
if (vec1[0]<vec2[0]) {
@@ -727,7 +727,7 @@ static void zbufline_onlyZ(ZSpan *zspan, int UNUSED(obi), int UNUSED(zvlnr), con
dx= vec2[0]-vec1[0];
dy= vec2[1]-vec1[1];
if (fabs(dx) > fabs(dy)) {
if (fabsf(dx) > fabsf(dy)) {
/* all lines from left to right */
if (vec1[0]<vec2[0]) {

View File

@@ -1162,8 +1162,8 @@ void KX_GameObject::NodeSetWorldScale(const MT_Vector3& scale)
{
// Make sure the objects have some scale
MT_Vector3 p_scale = parent->GetWorldScaling();
if (fabs(p_scale[0]) < FLT_EPSILON ||
fabs(p_scale[1]) < FLT_EPSILON ||
if (fabs(p_scale[0]) < FLT_EPSILON ||
fabs(p_scale[1]) < FLT_EPSILON ||
fabs(p_scale[2]) < FLT_EPSILON)
{
return;
@@ -1190,8 +1190,8 @@ void KX_GameObject::NodeSetWorldPosition(const MT_Point3& trans)
{
// Make sure the objects have some scale
MT_Vector3 scale = parent->GetWorldScaling();
if (fabs(scale[0]) < FLT_EPSILON ||
fabs(scale[1]) < FLT_EPSILON ||
if (fabs(scale[0]) < FLT_EPSILON ||
fabs(scale[1]) < FLT_EPSILON ||
fabs(scale[2]) < FLT_EPSILON)
{
return;
@@ -1203,7 +1203,7 @@ void KX_GameObject::NodeSetWorldPosition(const MT_Point3& trans)
MT_Vector3 newpos = invori*(trans-parent->GetWorldPosition())*scale;
NodeSetLocalPosition(MT_Point3(newpos[0],newpos[1],newpos[2]));
}
else
else
{
NodeSetLocalPosition(trans);
}

View File

@@ -379,7 +379,7 @@ bool KX_IpoActuator::Update(double curtime, bool frame)
void KX_IpoActuator::ResetStartTime()
{
this->m_starttime = -2.0*fabs(this->m_endframe - this->m_startframe) - 1.0;
this->m_starttime = -2.0f * fabsf(this->m_endframe - this->m_startframe) - 1.0f;
}
int KX_IpoActuator::string2mode(const char *modename)

View File

@@ -637,8 +637,8 @@ ImageRender::ImageRender (KX_Scene * scene, KX_GameObject * observer, KX_GameObj
// otherwise the Y axis is the up direction.
// If the mirror is not perfectly vertical(horizontal), the Z(Y) axis projection on the mirror
// plan by the normal will be the up direction.
if (fabs(mirrorNormal[2]) > fabs(mirrorNormal[1]) &&
fabs(mirrorNormal[2]) > fabs(mirrorNormal[0]))
if (fabsf(mirrorNormal[2]) > fabsf(mirrorNormal[1]) &&
fabsf(mirrorNormal[2]) > fabsf(mirrorNormal[0]))
{
// the mirror is more horizontal than vertical
copy_v3_v3(axis, yaxis);
@@ -649,7 +649,7 @@ ImageRender::ImageRender (KX_Scene * scene, KX_GameObject * observer, KX_GameObj
copy_v3_v3(axis, zaxis);
}
dist = dot_v3v3(mirrorNormal, axis);
if (fabs(dist) < FLT_EPSILON)
if (fabsf(dist) < FLT_EPSILON)
{
// the mirror is already fully aligned with up axis
copy_v3_v3(mirrorUp, axis);