16 |
|
|
17 |
|
#ifdef DISPERSE |
18 |
|
#include "source.h" |
19 |
+ |
static disperse(); |
20 |
+ |
static int lambda(); |
21 |
|
#endif |
22 |
|
|
23 |
|
/* |
55 |
|
OBJREC *m; |
56 |
|
register RAY *r; |
57 |
|
{ |
56 |
– |
double sqrt(), pow(); |
58 |
|
double cos1, cos2, nratio; |
59 |
|
COLOR mcolor; |
60 |
|
double mabsorp; |
84 |
|
setcolor(mcolor, pow(m->oargs.farg[0], r->rot), |
85 |
|
pow(m->oargs.farg[1], r->rot), |
86 |
|
pow(m->oargs.farg[2], r->rot)); |
87 |
+ |
multcolor(mcolor, r->pcol); /* modify */ |
88 |
|
} else { /* outside */ |
89 |
|
nratio = 1.0 / nratio; |
90 |
|
if (m->otype == MAT_INTERFACE) |
129 |
|
if (m->otype != MAT_DIELECTRIC |
130 |
|
|| r->rod > 0.0 |
131 |
|
|| r->crtype & SHADOW |
132 |
+ |
|| !directvis |
133 |
|
|| m->oargs.farg[4] == 0.0 |
134 |
|
|| !disperse(m, r, p.rdir, trans)) |
135 |
|
#endif |
136 |
|
{ |
137 |
|
rayvalue(&p); |
135 |
– |
multcolor(mcolor, r->pcol); /* modify */ |
138 |
|
scalecolor(p.rcol, trans); |
139 |
|
addcolor(r->rcol, p.rcol); |
140 |
+ |
if (nratio >= 1.0-FTINY && nratio <= 1.0+FTINY) |
141 |
+ |
r->rt = r->rot + p.rt; |
142 |
|
} |
143 |
|
} |
144 |
|
} |
157 |
|
} |
158 |
|
|
159 |
|
multcolor(r->rcol, mcolor); /* multiply by transmittance */ |
160 |
+ |
|
161 |
+ |
return(1); |
162 |
|
} |
163 |
|
|
164 |
|
|
171 |
|
FVECT vt; |
172 |
|
double tr; |
173 |
|
{ |
168 |
– |
double sqrt(); |
174 |
|
RAY sray, *entray; |
175 |
|
FVECT v1, v2, n1, n2; |
176 |
|
FVECT dv, v2Xdv; |
177 |
|
double v2Xdvv2Xdv; |
178 |
< |
int sn, success = 0; |
179 |
< |
double omega; |
178 |
> |
int success = 0; |
179 |
> |
SRCINDEX si; |
180 |
|
FVECT vtmp1, vtmp2; |
181 |
|
double dtmp1, dtmp2; |
182 |
|
int l1, l2; |
238 |
|
v2Xdvv2Xdv = DOT(v2Xdv, v2Xdv); |
239 |
|
|
240 |
|
/* check sources */ |
241 |
< |
for (sn = 0; sn < nsources; sn++) { |
241 |
> |
initsrcindex(&si); |
242 |
> |
while (srcray(&sray, r, &si)) { |
243 |
|
|
244 |
< |
if ((omega = srcray(&sray, r, sn)) == 0.0 || |
239 |
< |
DOT(sray.rdir, v2) < MINCOS) |
244 |
> |
if (DOT(sray.rdir, v2) < MINCOS) |
245 |
|
continue; /* bad source */ |
241 |
– |
|
246 |
|
/* adjust source ray */ |
247 |
|
|
248 |
|
dtmp1 = DOT(v2Xdv, sray.rdir) / v2Xdvv2Xdv; |
267 |
|
*/ |
268 |
|
|
269 |
|
fcross(vtmp1, v2Xdv, sray.rdir); |
270 |
< |
dtmp1 = sqrt(omega / v2Xdvv2Xdv / PI); |
270 |
> |
dtmp1 = sqrt(si.dom / v2Xdvv2Xdv / PI); |
271 |
|
|
272 |
|
/* compute first ray */ |
273 |
|
for (i = 0; i < 3; i++) |