Merged changes in the trunk up to revision 49478.

Conflicts resolved:
source/blender/blenkernel/intern/library.c
source/blender/blenloader/intern/readfile.c
source/blender/editors/interface/resources.c
source/blender/makesrna/intern/rna_scene.c
This commit is contained in:
2012-08-02 00:10:05 +00:00
479 changed files with 10450 additions and 7473 deletions

View File

@@ -2375,9 +2375,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 */
@@ -4303,8 +4302,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

@@ -980,9 +980,9 @@ static void alpha_clip_aniso(ImBuf *ibuf, float minx, float miny, float maxx, fl
rf.ymin = miny*(ibuf->y);
rf.ymax = maxy*(ibuf->y);
alphaclip = clipx_rctf(&rf, 0.0, (float)(ibuf->x));
alphaclip*= clipy_rctf(&rf, 0.0, (float)(ibuf->y));
alphaclip= MAX2(alphaclip, 0.0f);
alphaclip = clipx_rctf(&rf, 0.0, (float)(ibuf->x));
alphaclip *= clipy_rctf(&rf, 0.0, (float)(ibuf->y));
alphaclip = maxf(alphaclip, 0.0f);
if (alphaclip!=1.0f) {
/* premul it all */
@@ -1236,8 +1236,8 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
float fProbes;
a *= ff;
b *= ff;
a = MAX2(a, 1.f);
b = MAX2(b, 1.f);
a = maxf(a, 1.0f);
b = maxf(b, 1.0f);
fProbes = 2.f*(a / b) - 1.f;
AFD.iProbes = (int)floorf(fProbes + 0.5f);
AFD.iProbes = MIN2(AFD.iProbes, tex->afmax);
@@ -1253,8 +1253,8 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
if (ecc > (float)tex->afmax) b = a / (float)tex->afmax;
b *= ff;
}
maxd = MAX2(b, 1e-8f);
levf = ((float)M_LOG2E)*logf(maxd);
maxd = maxf(b, 1e-8f);
levf = ((float)M_LOG2E) * logf(maxd);
curmap = 0;
maxlev = 1;
@@ -1338,8 +1338,8 @@ static int imagewraposa_aniso(Tex *tex, Image *ima, ImBuf *ibuf, const float tex
imp2radangle(A, B, C, F, &a, &b, &th, &ecc);
a *= ff;
b *= ff;
a = MAX2(a, 1.f);
b = MAX2(b, 1.f);
a = maxf(a, 1.0f);
b = maxf(b, 1.0f);
fProbes = 2.f*(a / b) - 1.f;
/* no limit to number of Probes here */
AFD.iProbes = (int)floorf(fProbes + 0.5f);
@@ -1622,12 +1622,12 @@ int imagewraposa(Tex *tex, Image *ima, ImBuf *ibuf, const float texvec[3], const
ImBuf *previbuf, *curibuf;
float bumpscale;
dx= minx;
dy= miny;
maxd= MAX2(dx, dy);
if (maxd>0.5f) maxd= 0.5f;
dx = minx;
dy = miny;
maxd = maxf(dx, dy);
if (maxd > 0.5f) maxd = 0.5f;
pixsize = 1.0f/ (float) MIN2(ibuf->x, ibuf->y);
pixsize = 1.0f / (float) MIN2(ibuf->x, ibuf->y);
bumpscale= pixsize/maxd;
if (bumpscale>1.0f) bumpscale= 1.0f;

View File

@@ -248,18 +248,6 @@ Render *RE_GetRender(const char *name)
return re;
}
Render *RE_GetRender_FromData(const RenderData *rd)
{
Render *re;
/* search for existing renders */
for (re = RenderGlobal.renderlist.first; re; re = re->next)
if (&re->r == rd)
break;
return re;
}
/* if you want to know exactly what has been done */
RenderResult *RE_AcquireResultRead(Render *re)
{

View File

@@ -1515,7 +1515,7 @@ void ray_trace(ShadeInput *shi, ShadeResult *shr)
if (!(shi->combinedflag & SCE_PASS_REFRACT))
sub_v3_v3v3(diff, diff, shr->refr);
shr->alpha= MIN2(1.0f, tracol[3]);
shr->alpha = minf(1.0f, tracol[3]);
}
if (do_mir) {

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);
}
@@ -1733,7 +1733,7 @@ static int compatible_bump_compute(CompatibleBump *compat_bump, ShadeInput *shi,
if (mtex->texco == TEXCO_UV) {
/* for the uv case, use the same value for both du/dv,
* since individually scaling the normal derivatives makes them useless... */
du = MIN2(du, dv);
du = minf(du, dv);
idu = (du < 1e-5f) ? bf : (bf/du);
/* +u val */
@@ -3636,7 +3636,7 @@ void RE_sample_material_color(Material *mat, float color[3], float *alpha, const
float *uv1, *uv2, *uv3;
float l;
CustomData *data = &orcoDm->faceData;
MTFace *tface = (MTFace*) data->layers[layer_index+i].data;
MTFace *tface = (MTFace *) data->layers[layer_index+i].data;
float uv[3];
/* point layer name from actual layer data */
shi.uv[i].name = data->layers[i].name;

View File

@@ -1541,8 +1541,7 @@ static void shade_sample_sss(ShadeSample *ssamp, Material *mat, ObjectInstanceRe
copy_v3_v3(shi->facenor, nor);
shade_input_set_viewco(shi, x, y, sx, sy, z);
*area= len_v3(shi->dxco)*len_v3(shi->dyco);
*area= MIN2(*area, 2.0f*orthoarea);
*area = minf(len_v3(shi->dxco) * len_v3(shi->dyco), 2.0f * orthoarea);
shade_input_set_uv(shi);
shade_input_set_normals(shi);

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

@@ -322,8 +322,8 @@ static void compress_deepshadowbuf(Render *re, ShadBuf *shb, APixstr *apixbuf, A
shsample= MEM_callocN(sizeof(ShadSampleBuf), "shad sample buf");
BLI_addtail(&shb->buffers, shsample);
shsample->totbuf= MEM_callocN(sizeof(int)*size*size, "deeptotbuf");
shsample->deepbuf= MEM_callocN(sizeof(DeepSample*)*size*size, "deepbuf");
shsample->totbuf = MEM_callocN(sizeof(int) * size * size, "deeptotbuf");
shsample->deepbuf = MEM_callocN(sizeof(DeepSample *) * size * size, "deepbuf");
ap= apixbuf;
aps= apixbufstrand;
@@ -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;
@@ -1391,7 +1391,7 @@ float shadow_halo(LampRen *lar, const float p1[3], const float p2[3])
}
}
labda= MIN2(labdax, labday);
labda = minf(labdax, labday);
if (labda==labdao || labda>=1.0f) break;
zf= zf1 + labda*(zf2-zf1);

View File

@@ -305,7 +305,7 @@ ScatterSettings *scatter_settings_new(float refl, float radius, float ior, float
ss->Fdr= -1.440f/ior*ior + 0.710f/ior + 0.668f + 0.0636f*ior;
ss->A= (1.0f + ss->Fdr)/(1.0f - ss->Fdr);
ss->ld= radius;
ss->ro= MIN2(refl, 0.999f);
ss->ro= minf(refl, 0.999f);
ss->color= ss->ro*reflfac + (1.0f-reflfac);
ss->alpha_= compute_reduced_albedo(ss);
@@ -747,8 +747,8 @@ ScatterTree *scatter_tree_new(ScatterSettings *ss[3], float scale, float error,
tree->ss[1]= ss[1];
tree->ss[2]= ss[2];
points= MEM_callocN(sizeof(ScatterPoint)*totpoint, "ScatterPoints");
refpoints= MEM_callocN(sizeof(ScatterPoint*)*totpoint, "ScatterRefPoints");
points = MEM_callocN(sizeof(ScatterPoint) * totpoint, "ScatterPoints");
refpoints = MEM_callocN(sizeof(ScatterPoint *) * totpoint, "ScatterRefPoints");
tree->points= points;
tree->refpoints= refpoints;
@@ -777,8 +777,8 @@ void scatter_tree_build(ScatterTree *tree)
float mid[3], size[3];
int totpoint= tree->totpoint;
newpoints= MEM_callocN(sizeof(ScatterPoint)*totpoint, "ScatterPoints");
tmppoints= MEM_callocN(sizeof(ScatterPoint*)*totpoint, "ScatterTmpPoints");
newpoints = MEM_callocN(sizeof(ScatterPoint) * totpoint, "ScatterPoints");
tmppoints = MEM_callocN(sizeof(ScatterPoint *) * totpoint, "ScatterTmpPoints");
tree->tmppoints= tmppoints;
tree->arena= BLI_memarena_new(0x8000 * sizeof(ScatterNode), "sss tree arena");

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

@@ -149,8 +149,8 @@ static void zbuf_add_to_span(ZSpan *zspan, const float *v1, const float *v2)
xs0= dx0*(minv[1]-my2) + minv[0];
}
else {
dx0= 0.0f;
xs0= MIN2(minv[0], maxv[0]);
dx0 = 0.0f;
xs0 = minf(minv[0], maxv[0]);
}
/* empty span */
@@ -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]) {
@@ -3874,7 +3874,7 @@ static int addtosamp_shr(ShadeResult *samp_shr, ShadeSample *ssamp, int addpassf
addAlphaUnderFloat(samp_shr->combined, shr->combined);
samp_shr->z= MIN2(samp_shr->z, shr->z);
samp_shr->z = minf(samp_shr->z, shr->z);
if (addpassflag & SCE_PASS_VECTOR) {
copy_v4_v4(samp_shr->winspeed, shr->winspeed);