forked from bartvdbraak/blender
replace fabs with fabsf where both input and output are floats.
This commit is contained in:
parent
14ddf19ad2
commit
4924abaad6
@ -1373,17 +1373,17 @@ void animsys_evaluate_action (PointerRNA *ptr, bAction *act, AnimMapper *remap,
|
||||
static float nlastrip_get_influence (NlaStrip *strip, float cframe)
|
||||
{
|
||||
/* sanity checks - normalise the blendin/out values? */
|
||||
strip->blendin= (float)fabs(strip->blendin);
|
||||
strip->blendout= (float)fabs(strip->blendout);
|
||||
strip->blendin= fabsf(strip->blendin);
|
||||
strip->blendout= fabsf(strip->blendout);
|
||||
|
||||
/* result depends on where frame is in respect to blendin/out values */
|
||||
if (IS_EQ(strip->blendin, 0)==0 && (cframe <= (strip->start + strip->blendin))) {
|
||||
/* there is some blend-in */
|
||||
return (float)fabs(cframe - strip->start) / (strip->blendin);
|
||||
return fabsf(cframe - strip->start) / (strip->blendin);
|
||||
}
|
||||
else if (IS_EQ(strip->blendout, 0)==0 && (cframe >= (strip->end - strip->blendout))) {
|
||||
/* there is some blend-out */
|
||||
return (float)fabs(strip->end - cframe) / (strip->blendout);
|
||||
return fabsf(strip->end - cframe) / (strip->blendout);
|
||||
}
|
||||
else {
|
||||
/* in the middle of the strip, we should be full strength */
|
||||
|
@ -158,7 +158,7 @@ float object_camera_dof_distance(Object *ob)
|
||||
normalize_m4(obmat);
|
||||
invert_m4_m4(imat, obmat);
|
||||
mul_m4_m4m4(mat, cam->dof_ob->obmat, imat);
|
||||
return (float)fabs(mat[3][2]);
|
||||
return fabsf(mat[3][2]);
|
||||
}
|
||||
return cam->YF_dofdist;
|
||||
}
|
||||
|
@ -1707,8 +1707,8 @@ void correct_bezpart (float *v1, float *v2, float *v3, float *v4)
|
||||
* - len2 = length of handle of end key
|
||||
*/
|
||||
len= v4[0]- v1[0];
|
||||
len1= (float)fabs(h1[0]);
|
||||
len2= (float)fabs(h2[0]);
|
||||
len1= fabsf(h1[0]);
|
||||
len2= fabsf(h2[0]);
|
||||
|
||||
/* if the handles have no length, no need to do any corrections */
|
||||
if ((len1+len2) == 0.0f)
|
||||
|
@ -1781,11 +1781,11 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
|
||||
|
||||
calc_mballco(mainb[a], vec);
|
||||
|
||||
size= (float)fabs( vec[0] );
|
||||
size= fabsf( vec[0] );
|
||||
if( size > totsize ) totsize= size;
|
||||
size= (float)fabs( vec[1] );
|
||||
size= fabsf( vec[1] );
|
||||
if( size > totsize ) totsize= size;
|
||||
size= (float)fabs( vec[2] );
|
||||
size= fabsf( vec[2] );
|
||||
if( size > totsize ) totsize= size;
|
||||
|
||||
vec[0]= mainb[a]->x - mainb[a]->rad;
|
||||
@ -1794,11 +1794,11 @@ float init_meta(Scene *scene, Object *ob) /* return totsize */
|
||||
|
||||
calc_mballco(mainb[a], vec);
|
||||
|
||||
size= (float)fabs( vec[0] );
|
||||
size= fabsf( vec[0] );
|
||||
if( size > totsize ) totsize= size;
|
||||
size= (float)fabs( vec[1] );
|
||||
size= fabsf( vec[1] );
|
||||
if( size > totsize ) totsize= size;
|
||||
size= (float)fabs( vec[2] );
|
||||
size= fabsf( vec[2] );
|
||||
if( size > totsize ) totsize= size;
|
||||
}
|
||||
|
||||
|
@ -400,7 +400,7 @@ static float nlastrip_get_frame_actionclip (NlaStrip *strip, float cframe, short
|
||||
|
||||
/* scaling */
|
||||
if (IS_EQF(strip->scale, 0.0f)) strip->scale= 1.0f;
|
||||
scale = (float)fabs(strip->scale); /* scale must be positive - we've got a special flag for reversing */
|
||||
scale = fabsf(strip->scale); /* scale must be positive - we've got a special flag for reversing */
|
||||
|
||||
/* length of referenced action */
|
||||
actlength = strip->actend - strip->actstart;
|
||||
@ -1087,7 +1087,7 @@ void BKE_nlastrip_set_active (AnimData *adt, NlaStrip *strip)
|
||||
short BKE_nlastrip_within_bounds (NlaStrip *strip, float min, float max)
|
||||
{
|
||||
const float stripLen= (strip) ? strip->end - strip->start : 0.0f;
|
||||
const float boundsLen= (float)fabs(max - min);
|
||||
const float boundsLen= fabsf(max - min);
|
||||
|
||||
/* sanity checks */
|
||||
if ((strip == NULL) || IS_EQF(stripLen, 0.0f) || IS_EQF(boundsLen, 0.0f))
|
||||
|
@ -1901,7 +1901,7 @@ static int where_is_object_parslow(Object *ob, float obmat[4][4], float slowmat[
|
||||
int a;
|
||||
|
||||
// include framerate
|
||||
fac1= ( 1.0f / (1.0f + (float)fabs(ob->sf)) );
|
||||
fac1= ( 1.0f / (1.0f + fabsf(ob->sf)) );
|
||||
if(fac1 >= 1.0f) return 0;
|
||||
fac2= 1.0f-fac1;
|
||||
|
||||
|
@ -134,9 +134,9 @@ float area_poly_v3(int nr, float verts[][3], const float normal[3])
|
||||
int a, px=0, py=1;
|
||||
|
||||
/* first: find dominant axis: 0==X, 1==Y, 2==Z */
|
||||
x= (float)fabs(normal[0]);
|
||||
y= (float)fabs(normal[1]);
|
||||
z= (float)fabs(normal[2]);
|
||||
x= fabsf(normal[0]);
|
||||
y= fabsf(normal[1]);
|
||||
z= fabsf(normal[2]);
|
||||
max = MAX3(x, y, z);
|
||||
if(max==y) py=2;
|
||||
else if(max==x) {
|
||||
@ -1689,9 +1689,9 @@ static int barycentric_weights(const float v1[3], const float v2[3], const float
|
||||
|
||||
/* find best projection of face XY, XZ or YZ: barycentric weights of
|
||||
the 2d projected coords are the same and faster to compute */
|
||||
xn= (float)fabs(n[0]);
|
||||
yn= (float)fabs(n[1]);
|
||||
zn= (float)fabs(n[2]);
|
||||
xn= fabsf(n[0]);
|
||||
yn= fabsf(n[1]);
|
||||
zn= fabsf(n[2]);
|
||||
if(zn>=xn && zn>=yn) {i= 0; j= 1;}
|
||||
else if(yn>=xn && yn>=zn) {i= 0; j= 2;}
|
||||
else {i= 1; j= 2;}
|
||||
|
@ -1322,8 +1322,8 @@ void mat3_to_compatible_eulO(float eul[3], float oldrot[3], short order,float ma
|
||||
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= fabsf(eul1[0]-oldrot[0]) + fabsf(eul1[1]-oldrot[1]) + fabsf(eul1[2]-oldrot[2]);
|
||||
d2= fabsf(eul2[0]-oldrot[0]) + fabsf(eul2[1]-oldrot[1]) + fabsf(eul2[2]-oldrot[2]);
|
||||
|
||||
/* return best, which is just the one with lowest difference */
|
||||
if (d1 > d2)
|
||||
|
@ -985,12 +985,12 @@ static int view_zoomdrag_modal(bContext *C, wmOperator *op, wmEvent *event)
|
||||
|
||||
/* x-axis transform */
|
||||
dist = (v2d->mask.xmax - v2d->mask.xmin) / 2.0f;
|
||||
dx= 1.0f - ((float)fabs(vzd->lastx - dist) + 2.0f) / ((float)fabs(event->x - dist) + 2.0f);
|
||||
dx= 1.0f - (fabsf(vzd->lastx - dist) + 2.0f) / (fabsf(event->x - dist) + 2.0f);
|
||||
dx*= 0.5f * (v2d->cur.xmax - v2d->cur.xmin);
|
||||
|
||||
/* y-axis transform */
|
||||
dist = (v2d->mask.ymax - v2d->mask.ymin) / 2.0f;
|
||||
dy= 1.0f - ((float)fabs(vzd->lasty - dist) + 2.0f) / ((float)fabs(event->y - dist) + 2.0f);
|
||||
dy= 1.0f - (fabsf(vzd->lasty - dist) + 2.0f) / (fabsf(event->y - dist) + 2.0f);
|
||||
dy*= 0.5f * (v2d->cur.ymax - v2d->cur.ymin);
|
||||
}
|
||||
else {
|
||||
|
@ -291,7 +291,7 @@ static float turb(float x, float y, float z, int oct, int hard, int nb,
|
||||
amp = 1.f;
|
||||
out = (float)(2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f);
|
||||
if (hard)
|
||||
out = (float)fabs(out);
|
||||
out = fabsf(out);
|
||||
for (i = 1; i < oct; i++) {
|
||||
amp *= ampscale;
|
||||
x *= freqscale;
|
||||
@ -299,7 +299,7 @@ static float turb(float x, float y, float z, int oct, int hard, int nb,
|
||||
z *= freqscale;
|
||||
t = (float)(amp * (2.0f * BLI_gNoise(1.f, x, y, z, 0, nb) - 1.0f));
|
||||
if (hard)
|
||||
t = (float)fabs(t);
|
||||
t = fabsf(t);
|
||||
out += t;
|
||||
}
|
||||
return out;
|
||||
@ -328,9 +328,9 @@ static void vTurb(float x, float y, float z, int oct, int hard, int nb,
|
||||
amp = 1.f;
|
||||
noise_vector(x, y, z, nb, v);
|
||||
if (hard) {
|
||||
v[0] = (float)fabs(v[0]);
|
||||
v[1] = (float)fabs(v[1]);
|
||||
v[2] = (float)fabs(v[2]);
|
||||
v[0] = fabsf(v[0]);
|
||||
v[1] = fabsf(v[1]);
|
||||
v[2] = fabsf(v[2]);
|
||||
}
|
||||
for (i = 1; i < oct; i++) {
|
||||
amp *= ampscale;
|
||||
@ -339,9 +339,9 @@ static void vTurb(float x, float y, float z, int oct, int hard, int nb,
|
||||
z *= freqscale;
|
||||
noise_vector(x, y, z, nb, t);
|
||||
if (hard) {
|
||||
t[0] = (float)fabs(t[0]);
|
||||
t[1] = (float)fabs(t[1]);
|
||||
t[2] = (float)fabs(t[2]);
|
||||
t[0] = fabsf(t[0]);
|
||||
t[1] = fabsf(t[1]);
|
||||
t[2] = fabsf(t[2]);
|
||||
}
|
||||
v[0] += amp * t[0];
|
||||
v[1] += amp * t[1];
|
||||
|
Loading…
Reference in New Issue
Block a user