399 |
|
SDSpectralDF *df; |
400 |
|
SDMat *dp; |
401 |
|
char *sdata; |
402 |
– |
int tfront; |
402 |
|
int inbi, outbi; |
403 |
|
int i; |
404 |
|
/* allocate BSDF component */ |
407 |
|
return RC_FAIL; |
408 |
|
/* |
409 |
|
* Remember that front and back are reversed from WINDOW 6 orientations |
411 |
– |
* Favor their "Front" (incoming light) since that's more often valid |
410 |
|
*/ |
411 |
< |
tfront = !strcasecmp(sdata, "Transmission Back"); |
414 |
< |
if (!strcasecmp(sdata, "Transmission Front") || |
415 |
< |
tfront & (sd->tf == NULL)) { |
411 |
> |
if (!strcasecmp(sdata, "Transmission Front")) { |
412 |
|
if (sd->tf != NULL) |
413 |
|
SDfreeSpectralDF(sd->tf); |
414 |
|
if ((sd->tf = SDnewSpectralDF(1)) == NULL) |
415 |
|
return RC_MEMERR; |
416 |
|
df = sd->tf; |
417 |
+ |
} else if (!strcasecmp(sdata, "Transmission Back")) { |
418 |
+ |
if (sd->tb != NULL) |
419 |
+ |
SDfreeSpectralDF(sd->tb); |
420 |
+ |
if ((sd->tb = SDnewSpectralDF(1)) == NULL) |
421 |
+ |
return RC_MEMERR; |
422 |
+ |
df = sd->tb; |
423 |
|
} else if (!strcasecmp(sdata, "Reflection Front")) { |
424 |
|
if (sd->rb != NULL) /* note back-front reversal */ |
425 |
|
SDfreeSpectralDF(sd->rb); |
469 |
|
dp->ib_priv = &abase_list[inbi]; |
470 |
|
dp->ob_priv = &abase_list[outbi]; |
471 |
|
if (df == sd->tf) { |
472 |
< |
if (tfront) { |
473 |
< |
dp->ib_vec = &fi_getvec; |
474 |
< |
dp->ib_ndx = &fi_getndx; |
475 |
< |
dp->ob_vec = &bo_getvec; |
476 |
< |
dp->ob_ndx = &bo_getndx; |
477 |
< |
} else { |
478 |
< |
dp->ib_vec = &bi_getvec; |
479 |
< |
dp->ib_ndx = &bi_getndx; |
480 |
< |
dp->ob_vec = &fo_getvec; |
479 |
< |
dp->ob_ndx = &fo_getndx; |
480 |
< |
} |
472 |
> |
dp->ib_vec = &fi_getvec; |
473 |
> |
dp->ib_ndx = &fi_getndx; |
474 |
> |
dp->ob_vec = &bo_getvec; |
475 |
> |
dp->ob_ndx = &bo_getndx; |
476 |
> |
} else if (df == sd->tb) { |
477 |
> |
dp->ib_vec = &bi_getvec; |
478 |
> |
dp->ib_ndx = &bi_getndx; |
479 |
> |
dp->ob_vec = &fo_getvec; |
480 |
> |
dp->ob_ndx = &fo_getndx; |
481 |
|
} else if (df == sd->rf) { |
482 |
|
dp->ib_vec = &fi_getvec; |
483 |
|
dp->ib_ndx = &fi_getndx; |
616 |
|
/* separate diffuse components */ |
617 |
|
extract_diffuse(&sd->rLambFront, sd->rf); |
618 |
|
extract_diffuse(&sd->rLambBack, sd->rb); |
619 |
< |
extract_diffuse(&sd->tLamb, sd->tf); |
619 |
> |
extract_diffuse(&sd->tLamb, (sd->tf != NULL) ? sd->tf : sd->tb); |
620 |
|
/* return success */ |
621 |
|
return SDEnone; |
622 |
|
} |