171 |
|
|
172 |
|
if (v == NULL) |
173 |
|
return -1; |
174 |
< |
if ((v[2] < 0) | (v[2] > 1.)) |
174 |
> |
if ((v[2] < 0) | (v[2] > 1.00001)) |
175 |
|
return -1; |
176 |
|
pol = 180.0/M_PI*Acos(v[2]); |
177 |
|
azi = 180.0/M_PI*atan2(v[1], v[0]); |
295 |
|
mBSDF_color(float coef[], const SDMat *dp, int i, int o) |
296 |
|
{ |
297 |
|
C_COLOR cxy; |
298 |
+ |
double d; |
299 |
|
|
300 |
|
coef[0] = mBSDF_value(dp, o, i); |
301 |
+ |
/* position-specific perturbation */ |
302 |
+ |
d = 2*dp->ninc/(i + .22545) + 4*dp->nout/(o + .70281); |
303 |
+ |
d -= (int)d; |
304 |
+ |
coef[0] *= 1. + 6e-4*(d - .5); |
305 |
|
if (dp->chroma == NULL) |
306 |
|
return 1; /* grayscale */ |
307 |
|
|
714 |
|
/* separate diffuse components */ |
715 |
|
sd->rf = extract_diffuse(&sd->rLambFront, sd->rf); |
716 |
|
sd->rb = extract_diffuse(&sd->rLambBack, sd->rb); |
717 |
< |
if (sd->tb != NULL) |
718 |
< |
sd->tb = extract_diffuse(&sd->tLamb, sd->tb); |
719 |
< |
if (sd->tf != NULL) |
720 |
< |
sd->tf = extract_diffuse(&sd->tLamb, sd->tf); |
717 |
> |
sd->tf = extract_diffuse(&sd->tLambFront, sd->tf); |
718 |
> |
if (sd->tb != NULL) { |
719 |
> |
sd->tb = extract_diffuse(&sd->tLambBack, sd->tb); |
720 |
> |
if (sd->tf == NULL) |
721 |
> |
sd->tLambFront = sd->tLambBack; |
722 |
> |
} else if (sd->tf != NULL) |
723 |
> |
sd->tLambBack = sd->tLambFront; |
724 |
|
/* return success */ |
725 |
|
return SDEnone; |
726 |
|
} |
727 |
|
|
728 |
|
/* Get Matrix BSDF value */ |
729 |
|
static int |
730 |
< |
SDgetMtxBSDF(float coef[SDmaxCh], const FVECT outVec, |
731 |
< |
const FVECT inVec, SDComponent *sdc) |
730 |
> |
SDgetMtxBSDF(float coef[SDmaxCh], const FVECT inVec, |
731 |
> |
const FVECT outVec, SDComponent *sdc) |
732 |
|
{ |
733 |
|
const SDMat *dp; |
734 |
|
int i_ndx, o_ndx; |