44 |
|
if (!isvlight(objptr(o->omod)->otype)) |
45 |
|
continue; |
46 |
|
if (sfun[o->otype].of == NULL || |
47 |
< |
sfun[o->otype].of->getpleq == NULL) |
48 |
< |
objerror(o, USER, "illegal material"); |
47 |
> |
sfun[o->otype].of->getpleq == NULL) { |
48 |
> |
objerror(o,WARNING,"secondary sources not supported"); |
49 |
> |
continue; |
50 |
> |
} |
51 |
|
if (nvobjects == 0) |
52 |
|
vobject = (OBJECT *)malloc(sizeof(OBJECT)); |
53 |
|
else |
142 |
|
ourspot.siz = PI*maxrad2; |
143 |
|
ourspot.flen = 0.; |
144 |
|
if (source[sn].sflags & SSPOT) { |
143 |
– |
copystruct(&theirspot, source[sn].sl.s); |
145 |
|
multp3(theirspot.aim, source[sn].sl.s->aim, pm); |
146 |
+ |
d = sqrt(dist2(ourspot.aim, theirspot.aim)); |
147 |
+ |
d = sqrt(source[sn].sl.s->siz/PI) + d*source[sn].ss; |
148 |
+ |
theirspot.siz = PI*d*d; |
149 |
+ |
ourspot.flen = theirspot.flen = source[sn].sl.s->flen; |
150 |
|
d = ourspot.siz; |
151 |
|
if (!commonbeam(&ourspot, &theirspot, nsloc)) |
152 |
|
return(-1); /* no overlap */ |
169 |
|
if (source[sn].sflags & SPROX && d > source[sn].sl.prox) |
170 |
|
return(-1); /* too far away */ |
171 |
|
ourspot.flen = 0.; |
172 |
< |
if (d*d > maxrad2) |
173 |
< |
ourspot.siz = 2.*PI*(1. - sqrt(1.-maxrad2/(d*d))); |
172 |
> |
d = (sqrt(maxrad2) + source[sn].ss) / d; |
173 |
> |
if (d < 1.-FTINY) |
174 |
> |
ourspot.siz = 2.*PI*(1. - sqrt(1.-d*d)); |
175 |
|
else |
176 |
|
nsflags &= ~SSPOT; |
177 |
|
if (source[sn].sflags & SSPOT) { |
201 |
|
if (source[sn].sflags & SFLAT) { /* behind source? */ |
202 |
|
multv3(nsnorm, source[sn].snorm, pm); |
203 |
|
normalize(nsnorm); |
204 |
< |
if (!checkspot(&ourspot, nsnorm)) |
204 |
> |
if (nsflags & SSPOT && !checkspot(&ourspot, nsnorm)) |
205 |
|
return(-1); |
206 |
|
} |
207 |
|
} |
293 |
|
} else { |
294 |
|
for (i = 0; i < 3; i++) |
295 |
|
offsdir[i] = source[sn].sloc[i] - oc[i]; |
296 |
< |
n = or2/DOT(offsdir,offsdir)*vspretest + .5; |
296 |
> |
d = DOT(offsdir,offsdir); |
297 |
> |
if (d <= FTINY) |
298 |
> |
n = 2.*PI * vspretest + .5; |
299 |
> |
else |
300 |
> |
n = 2.*PI * (1.-sqrt(1./(1.+or2/d)))*vspretest + .5; |
301 |
|
infront = DOT(onorm, offsdir) > 0.; |
302 |
|
} |
303 |
|
if (n < MINSAMPLES) n = MINSAMPLES; |