diff options
author | Campbell Barton <ideasman42@gmail.com> | 2012-12-21 09:07:26 +0400 |
---|---|---|
committer | Campbell Barton <ideasman42@gmail.com> | 2012-12-21 09:07:26 +0400 |
commit | b2c66e268f68ee406e5e05a65d9d1609b65d20c4 (patch) | |
tree | 722192b9fe1d7af57695860fc3639781bedf5f2b /source/blender/render | |
parent | e09ddf0d4ba6f6d1e8963d41eef153dadce482f8 (diff) |
replace MIN/MAX 3,4 with inline functions
Diffstat (limited to 'source/blender/render')
6 files changed, 30 insertions, 30 deletions
diff --git a/source/blender/render/intern/raytrace/rayobject_octree.cpp b/source/blender/render/intern/raytrace/rayobject_octree.cpp index dad7fe5fd60..148e3417ea9 100644 --- a/source/blender/render/intern/raytrace/rayobject_octree.cpp +++ b/source/blender/render/intern/raytrace/rayobject_octree.cpp @@ -542,13 +542,13 @@ static void octree_fill_rayface(Octree *oc, RayFace *face) oc2 = rts[1][c]; oc3 = rts[2][c]; if (!RE_rayface_isQuad(face)) { - ocmin[c] = MIN3(oc1, oc2, oc3); - ocmax[c] = MAX3(oc1, oc2, oc3); + ocmin[c] = min_iii(oc1, oc2, oc3); + ocmax[c] = max_iii(oc1, oc2, oc3); } else { oc4 = rts[3][c]; - ocmin[c] = MIN4(oc1, oc2, oc3, oc4); - ocmax[c] = MAX4(oc1, oc2, oc3, oc4); + ocmin[c] = min_iiii(oc1, oc2, oc3, oc4); + ocmax[c] = max_iiii(oc1, oc2, oc3, oc4); } if (ocmax[c] > oc->ocres - 1) ocmax[c] = oc->ocres - 1; if (ocmin[c] < 0) ocmin[c] = 0; @@ -993,7 +993,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) } xo = ocx1; yo = ocy1; zo = ocz1; - dda_lambda = MIN3(lambda_x, lambda_y, lambda_z); + dda_lambda = min_fff(lambda_x, lambda_y, lambda_z); vec2[0] = ox1; vec2[1] = oy1; @@ -1083,7 +1083,7 @@ static int RE_rayobject_octree_intersect(RayObject *tree, Isect *is) } - dda_lambda = MIN3(lambda_x, lambda_y, lambda_z); + dda_lambda = min_fff(lambda_x, lambda_y, lambda_z); if (dda_lambda == lambda_o) break; /* to make sure the last node is always checked */ if (lambda_o >= 1.0f) break; diff --git a/source/blender/render/intern/source/imagetexture.c b/source/blender/render/intern/source/imagetexture.c index cd06839b004..7c14e0e5465 100644 --- a/source/blender/render/intern/source/imagetexture.c +++ b/source/blender/render/intern/source/imagetexture.c @@ -286,7 +286,7 @@ int imagewrap(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], TexResul if (texres->talpha) texres->tin= texres->ta; else if (tex->imaflag & TEX_CALCALPHA) { - texres->ta= texres->tin= MAX3(texres->tr, texres->tg, texres->tb); + texres->ta = texres->tin = max_fff(texres->tr, texres->tg, texres->tb); } else texres->ta= texres->tin= 1.0; @@ -1112,10 +1112,10 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex } /* pixel coordinates */ - minx = MIN3(dxt[0], dyt[0], dxt[0] + dyt[0]); - maxx = MAX3(dxt[0], dyt[0], dxt[0] + dyt[0]); - miny = MIN3(dxt[1], dyt[1], dxt[1] + dyt[1]); - maxy = MAX3(dxt[1], dyt[1], dxt[1] + dyt[1]); + minx = min_fff(dxt[0], dyt[0], dxt[0] + dyt[0]); + maxx = max_fff(dxt[0], dyt[0], dxt[0] + dyt[0]); + miny = min_fff(dxt[1], dyt[1], dxt[1] + dyt[1]); + maxy = max_fff(dxt[1], dyt[1], dxt[1] + dyt[1]); /* tex_sharper has been removed */ minx = (maxx - minx)*0.5f; @@ -1416,7 +1416,7 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex } if (tex->imaflag & TEX_CALCALPHA) - texres->ta = texres->tin = texres->ta * MAX3(texres->tr, texres->tg, texres->tb); + texres->ta = texres->tin = texres->ta * max_fff(texres->tr, texres->tg, texres->tb); else texres->tin = texres->ta; if (tex->flag & TEX_NEGALPHA) texres->ta = 1.f - texres->ta; @@ -1535,10 +1535,10 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const /* pixel coordinates */ - minx = MIN3(dxt[0], dyt[0], dxt[0] + dyt[0]); - maxx = MAX3(dxt[0], dyt[0], dxt[0] + dyt[0]); - miny = MIN3(dxt[1], dyt[1], dxt[1] + dyt[1]); - maxy = MAX3(dxt[1], dyt[1], dxt[1] + dyt[1]); + minx = min_fff(dxt[0], dyt[0], dxt[0] + dyt[0]); + maxx = max_fff(dxt[0], dyt[0], dxt[0] + dyt[0]); + miny = min_fff(dxt[1], dyt[1], dxt[1] + dyt[1]); + maxy = max_fff(dxt[1], dyt[1], dxt[1] + dyt[1]); /* tex_sharper has been removed */ minx= (maxx-minx)/2.0f; @@ -1826,7 +1826,7 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const } if (tex->imaflag & TEX_CALCALPHA) { - texres->ta= texres->tin= texres->ta*MAX3(texres->tr, texres->tg, texres->tb); + texres->ta = texres->tin = texres->ta * max_fff(texres->tr, texres->tg, texres->tb); } else texres->tin= texres->ta; diff --git a/source/blender/render/intern/source/occlusion.c b/source/blender/render/intern/source/occlusion.c index a7308821843..747362a7974 100644 --- a/source/blender/render/intern/source/occlusion.c +++ b/source/blender/render/intern/source/occlusion.c @@ -1520,8 +1520,8 @@ static int sample_occ_cache(OcclusionTree *tree, float *co, float *n, int x, int return 0; /* require intensities not being too different */ - mino = MIN4(samples[0]->intensity, samples[1]->intensity, samples[2]->intensity, samples[3]->intensity); - maxo = MAX4(samples[0]->intensity, samples[1]->intensity, samples[2]->intensity, samples[3]->intensity); + mino = min_ffff(samples[0]->intensity, samples[1]->intensity, samples[2]->intensity, samples[3]->intensity); + maxo = max_ffff(samples[0]->intensity, samples[1]->intensity, samples[2]->intensity, samples[3]->intensity); if (maxo - mino > 0.05f) return 0; @@ -1793,9 +1793,9 @@ void sample_occ(Render *re, ShadeInput *shi) copy_v3_v3(sample->ao, shi->ao); copy_v3_v3(sample->env, shi->env); copy_v3_v3(sample->indirect, shi->indirect); - sample->intensity = MAX3(sample->ao[0], sample->ao[1], sample->ao[2]); - sample->intensity = MAX2(sample->intensity, MAX3(sample->env[0], sample->env[1], sample->env[2])); - sample->intensity = MAX2(sample->intensity, MAX3(sample->indirect[0], sample->indirect[1], sample->indirect[2])); + sample->intensity = max_fff(sample->ao[0], sample->ao[1], sample->ao[2]); + sample->intensity = max_ff(sample->intensity, max_fff(sample->env[0], sample->env[1], sample->env[2])); + sample->intensity = max_ff(sample->intensity, max_fff(sample->indirect[0], sample->indirect[1], sample->indirect[2])); sample->dist2 = dot_v3v3(shi->dxco, shi->dxco) + dot_v3v3(shi->dyco, shi->dyco); sample->filled = 1; } @@ -1888,9 +1888,9 @@ void cache_occ_samples(Render *re, RenderPart *pa, ShadeSample *ssamp) copy_v3_v3(sample->ao, shi->ao); copy_v3_v3(sample->env, shi->env); copy_v3_v3(sample->indirect, shi->indirect); - sample->intensity = MAX3(sample->ao[0], sample->ao[1], sample->ao[2]); - sample->intensity = MAX2(sample->intensity, MAX3(sample->env[0], sample->env[1], sample->env[2])); - sample->intensity = MAX2(sample->intensity, MAX3(sample->indirect[0], sample->indirect[1], sample->indirect[2])); + sample->intensity = max_fff(sample->ao[0], sample->ao[1], sample->ao[2]); + sample->intensity = max_ff(sample->intensity, max_fff(sample->env[0], sample->env[1], sample->env[2])); + sample->intensity = max_ff(sample->intensity, max_fff(sample->indirect[0], sample->indirect[1], sample->indirect[2])); sample->dist2 = dot_v3v3(shi->dxco, shi->dxco) + dot_v3v3(shi->dyco, shi->dyco); sample->x = shi->xs; sample->y = shi->ys; diff --git a/source/blender/render/intern/source/render_texture.c b/source/blender/render/intern/source/render_texture.c index e6daa5f9094..2b189352a37 100644 --- a/source/blender/render/intern/source/render_texture.c +++ b/source/blender/render/intern/source/render_texture.c @@ -1745,8 +1745,8 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi, else { /* 3d procedural, estimate from all dx/dy elems */ const float adx[3] = {fabsf(dx[0]), fabsf(dx[1]), fabsf(dx[2])}; const float ady[3] = {fabsf(dy[0]), fabsf(dy[1]), fabsf(dy[2])}; - du = MAX3(adx[0], adx[1], adx[2]); - dv = MAX3(ady[0], ady[1], ady[2]); + du = max_fff(adx[0], adx[1], adx[2]); + dv = max_fff(ady[0], ady[1], ady[2]); } } diff --git a/source/blender/render/intern/source/shadeoutput.c b/source/blender/render/intern/source/shadeoutput.c index 597196f464b..2d26ebe2b91 100644 --- a/source/blender/render/intern/source/shadeoutput.c +++ b/source/blender/render/intern/source/shadeoutput.c @@ -1884,7 +1884,7 @@ void shade_lamp_loop(ShadeInput *shi, ShadeResult *shr) /* note: shi->mode! */ if (shi->mode & MA_TRANSP && (shi->mode & (MA_ZTRANSP|MA_RAYTRANSP))) { if (shi->spectra!=0.0f) { - float t = MAX3(shr->spec[0], shr->spec[1], shr->spec[2]); + float t = max_fff(shr->spec[0], shr->spec[1], shr->spec[2]); t *= shi->spectra; if (t>1.0f) t= 1.0f; shi->alpha= (1.0f-t)*shi->alpha+t; diff --git a/source/blender/render/intern/source/volume_precache.c b/source/blender/render/intern/source/volume_precache.c index 8757be740f3..549148f4e29 100644 --- a/source/blender/render/intern/source/volume_precache.c +++ b/source/blender/render/intern/source/volume_precache.c @@ -354,7 +354,7 @@ static void ms_diffuse(Render *re, int do_test_break, float *x0, float *x, float static void multiple_scattering_diffusion(Render *re, VolumePrecache *vp, Material *ma) { const float diff = ma->vol.ms_diff * 0.001f; /* compensate for scaling for a nicer UI range */ - const int simframes = (int)(ma->vol.ms_spread * (float)MAX3(vp->res[0], vp->res[1], vp->res[2])); + const int simframes = (int)(ma->vol.ms_spread * (float)max_iii(vp->res[0], vp->res[1], vp->res[2])); const int shade_type = ma->vol.shade_type; float fac = ma->vol.ms_intensity; @@ -652,7 +652,7 @@ static int precache_resolution(Render *re, VolumePrecache *vp, ObjectInstanceRen global_bounds_obi(re, obi, bbmin, bbmax); sub_v3_v3v3(dim, bbmax, bbmin); - div = MAX3(dim[0], dim[1], dim[2]); + div = max_fff(dim[0], dim[1], dim[2]); dim[0] /= div; dim[1] /= div; dim[2] /= div; |