11 |
|
#include "otypes.h" |
12 |
|
#include "rtotypes.h" |
13 |
|
#include "source.h" |
14 |
– |
#include "pmapmat.h" |
14 |
|
|
15 |
|
/* |
16 |
|
* The real arguments for MAT_MIRROR are simply: |
39 |
|
RAY nr; |
40 |
|
int rpure = 1; |
41 |
|
int i; |
43 |
– |
|
44 |
– |
/* PMAP: skip specular refl via ambient bounce if already accounted for |
45 |
– |
* in photon map */ |
46 |
– |
if (ambRayInPmap(r)) |
47 |
– |
return(1); |
42 |
|
/* check arguments */ |
43 |
|
if (m->oargs.nfargs != 3 || m->oargs.nsargs > 1) |
44 |
|
objerror(m, USER, "bad number of arguments"); |
45 |
|
/* check for substitute material */ |
46 |
|
/* but avoid double-counting */ |
47 |
< |
if (m->oargs.nsargs > 0 && !(r->crtype & (AMBIENT|SPECULAR)) && |
48 |
< |
(r->rsrc < 0 || source[r->rsrc].so != r->ro)) { |
47 |
> |
if ( m->oargs.nsargs > 0 && |
48 |
> |
(r->rsrc < 0 || source[r->rsrc].so != r->ro) && |
49 |
> |
!(r->crtype & (AMBIENT|SPECULAR) && r->rod > 0.) ) { |
50 |
|
if (!strcmp(m->oargs.sarg[0], VOIDID)) { |
51 |
|
raytrans(r); |
52 |
|
return(1); |
98 |
|
checknorm(nr.rdir); |
99 |
|
rayvalue(&nr); |
100 |
|
multcolor(nr.rcol, nr.rcoef); |
101 |
+ |
copycolor(r->mcol, nr.rcol); |
102 |
|
addcolor(r->rcol, nr.rcol); |
103 |
+ |
r->rmt = r->rot; |
104 |
|
if (rpure && r->ro != NULL && isflat(r->ro->otype)) |
105 |
< |
r->rt = r->rot + nr.rt; |
105 |
> |
r->rmt += raydistance(&nr); |
106 |
|
return(1); |
107 |
|
} |
108 |
|
|