14 |
|
#include "otypes.h" |
15 |
|
#include "rtotypes.h" |
16 |
|
#include "func.h" |
17 |
+ |
#include "pmapmat.h" |
18 |
|
|
19 |
|
/* |
20 |
|
* Arguments to this material include the color and specularity. |
39 |
|
* Arguments for MAT_TFUNC are: |
40 |
|
* 2+ func funcfile transform |
41 |
|
* 0 |
42 |
< |
* 4+ red grn blu rspec trans tspec A7 .. |
42 |
> |
* 6+ red grn blu rspec trans tspec A7 .. |
43 |
|
* |
44 |
|
* Arguments for MAT_TDATA are: |
45 |
|
* 4+ func datafile funcfile v0 .. transform |
46 |
|
* 0 |
47 |
< |
* 4+ red grn blu rspec trans tspec A7 .. |
47 |
> |
* 6+ red grn blu rspec trans tspec A7 .. |
48 |
|
* |
49 |
|
* Arguments for the more general MAT_BRTDF are: |
50 |
|
* 10+ rrefl grefl brefl |
128 |
|
scalecolor(ctmp, dtmp); |
129 |
|
addcolor(cval, ctmp); |
130 |
|
} |
131 |
< |
if (ldot > 0.0 ? np->rspec <= FTINY : np->tspec <= FTINY) |
131 |
> |
if ((ldot > 0.0 ? np->rspec <= FTINY : np->tspec <= FTINY) || |
132 |
> |
ambRayInPmap(np->pr)) |
133 |
|
return; /* diffuse only */ |
134 |
|
/* set up function */ |
135 |
|
setbrdfunc(np); |
142 |
|
lddx[3] = omega; |
143 |
|
/* compute BRTDF */ |
144 |
|
if (np->mp->otype == MAT_BRTDF) { |
145 |
< |
if (sa[6][0] == '0') /* special case */ |
145 |
> |
if (sa[6][0] == '0' && !sa[6][1]) /* special case */ |
146 |
|
colval(ctmp,RED) = 0.0; |
147 |
|
else |
148 |
|
colval(ctmp,RED) = funvalue(sa[6], 4, lddx); |
149 |
< |
if (sa[7][0] == '0') |
149 |
> |
if (sa[7][0] == '0' && !sa[7][1]) |
150 |
|
colval(ctmp,GRN) = 0.0; |
151 |
|
else if (!strcmp(sa[7],sa[6])) |
152 |
|
colval(ctmp,GRN) = colval(ctmp,RED); |
153 |
|
else |
154 |
|
colval(ctmp,GRN) = funvalue(sa[7], 4, lddx); |
155 |
< |
if (!strcmp(sa[8],sa[6])) |
155 |
> |
if (sa[8][0] == '0' && !sa[8][1]) |
156 |
> |
colval(ctmp,BLU) = 0.0; |
157 |
> |
else if (!strcmp(sa[8],sa[6])) |
158 |
|
colval(ctmp,BLU) = colval(ctmp,RED); |
159 |
|
else if (!strcmp(sa[8],sa[7])) |
160 |
|
colval(ctmp,BLU) = colval(ctmp,GRN); |
210 |
|
BRDFDAT nd; |
211 |
|
RAY sr; |
212 |
|
double mirtest=0, mirdist=0; |
213 |
< |
double transtest, transdist; |
213 |
> |
double transtest=0, transdist=0; |
214 |
|
int hasrefl, hastrans; |
215 |
|
int hastexture; |
216 |
|
COLOR ctmp; |
367 |
|
objerror(m, USER, "bad # arguments"); |
368 |
|
/* check for back side */ |
369 |
|
if (r->rod < 0.0) { |
370 |
< |
if (!backvis && m->otype != MAT_TFUNC |
367 |
< |
&& m->otype != MAT_TDATA) { |
370 |
> |
if (!backvis) { |
371 |
|
raytrans(r); |
372 |
|
return(1); |
373 |
|
} |