diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-07-21 19:27:40 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-07-21 19:27:40 +0400 |
commit | 62a73381a7ec63e75960d3c9545c638c85d3b06a (patch) | |
tree | 25d16dfc4c245bacb98c3737c3817d1a52ce8d93 /source/blender/render/intern | |
parent | 1bb7cfded603028db0d52b3c0917900e83b858e6 (diff) |
use fabsf when using floats.
Diffstat (limited to 'source/blender/render/intern')
6 files changed, 18 insertions, 19 deletions
diff --git a/source/blender/render/intern/source/convertblender.c b/source/blender/render/intern/source/convertblender.c index 3408eb74b58..a6f6458392f 100644 --- a/source/blender/render/intern/source/convertblender.c +++ b/source/blender/render/intern/source/convertblender.c @@ -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) { diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index 74e2c094850..3703f819b3b 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -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); } diff --git a/source/blender/render/intern/source/renderdatabase.c b/source/blender/render/intern/source/renderdatabase.c index b12753543e9..db045284d5b 100644 --- a/source/blender/render/intern/source/renderdatabase.c +++ b/source/blender/render/intern/source/renderdatabase.c @@ -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); } diff --git a/source/blender/render/intern/source/shadbuf.c b/source/blender/render/intern/source/shadbuf.c index 9995a3cbd17..7dc77d3632a 100644 --- a/source/blender/render/intern/source/shadbuf.c +++ b/source/blender/render/intern/source/shadbuf.c @@ -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; diff --git a/source/blender/render/intern/source/strand.c b/source/blender/render/intern/source/strand.c index 0e7c8a13043..51be519d5b8 100644 --- a/source/blender/render/intern/source/strand.c +++ b/source/blender/render/intern/source/strand.c @@ -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) { diff --git a/source/blender/render/intern/source/zbuf.c b/source/blender/render/intern/source/zbuf.c index fde25865577..e09529fd8ac 100644 --- a/source/blender/render/intern/source/zbuf.c +++ b/source/blender/render/intern/source/zbuf.c @@ -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]) { |