13 |
|
#include "func.h" |
14 |
|
#include "bsdf.h" |
15 |
|
#include "random.h" |
16 |
+ |
#include "pmapmat.h" |
17 |
|
|
18 |
|
/* |
19 |
|
* Arguments to this material include optional diffuse colors. |
447 |
|
hitfront = (r->rod > 0); |
448 |
|
/* load cal file */ |
449 |
|
mf = getfunc(m, 5, 0x1d, 1); |
450 |
+ |
setfunc(m, r); |
451 |
|
/* get thickness */ |
452 |
|
nd.thick = evalue(mf->ep[0]); |
453 |
|
if ((-FTINY <= nd.thick) & (nd.thick <= FTINY)) |
458 |
|
raytrans(r); /* pass-through */ |
459 |
|
return(1); /* or shadow */ |
460 |
|
} |
461 |
+ |
/* check backface visibility */ |
462 |
+ |
if (!hitfront & !backvis) { |
463 |
+ |
raytrans(r); |
464 |
+ |
return(1); |
465 |
+ |
} |
466 |
|
/* check other rays to pass */ |
467 |
|
if (nd.thick != 0 && (!(r->crtype & (SPECULAR|AMBIENT)) || |
468 |
|
nd.thick > 0 ^ hitfront)) { |
469 |
|
raytrans(r); /* hide our proxy */ |
470 |
|
return(1); |
471 |
|
} |
472 |
+ |
|
473 |
+ |
/* PMAP: skip ambient ray if accounted for by photon map */ |
474 |
+ |
if (ambRayInPmap(r)) |
475 |
+ |
return(1); |
476 |
+ |
|
477 |
|
/* get BSDF data */ |
478 |
|
nd.sd = loadBSDF(m->oargs.sarg[1]); |
479 |
|
/* diffuse reflectance */ |
485 |
|
m->oargs.farg[1], |
486 |
|
m->oargs.farg[2]); |
487 |
|
} else { |
488 |
< |
if (m->oargs.nfargs < 6) { /* check invisible backside */ |
477 |
< |
if (!backvis && (nd.sd->rb == NULL) & |
478 |
< |
(nd.sd->tb == NULL)) { |
479 |
< |
SDfreeCache(nd.sd); |
480 |
< |
raytrans(r); |
481 |
< |
return(1); |
482 |
< |
} |
488 |
> |
if (m->oargs.nfargs < 6) |
489 |
|
setcolor(nd.rdiff, .0, .0, .0); |
490 |
< |
} else |
490 |
> |
else |
491 |
|
setcolor(nd.rdiff, m->oargs.farg[3], |
492 |
|
m->oargs.farg[4], |
493 |
|
m->oargs.farg[5]); |