11 |
|
#include "copyright.h" |
12 |
|
|
13 |
|
#include "ray.h" |
14 |
– |
|
14 |
|
#include "otypes.h" |
15 |
< |
|
15 |
> |
#include "otspecial.h" |
16 |
|
#include "source.h" |
18 |
– |
|
17 |
|
#include "random.h" |
18 |
|
|
19 |
|
#define MINSAMPLES 16 /* minimum number of pretest samples */ |
322 |
|
{ |
323 |
|
RAY sr; |
324 |
|
FVECT onorm; |
325 |
< |
FVECT offsdir; |
325 |
> |
double offsdir[3]; |
326 |
|
SRCINDEX si; |
327 |
|
double or, d, d1; |
328 |
|
int stestlim, ssn; |
338 |
|
/* 32. == heuristic constant */ |
339 |
|
n = 32.*or2/(thescene.cusize*thescene.cusize)*vspretest + .5; |
340 |
|
} else { |
341 |
< |
for (i = 0; i < 3; i++) |
344 |
< |
offsdir[i] = source[sn].sloc[i] - oc[i]; |
341 |
> |
VSUB(offsdir, source[sn].sloc, oc); |
342 |
|
d = DOT(offsdir,offsdir); |
343 |
|
if (d <= FTINY) |
344 |
|
n = 2.*PI * vspretest + .5; |
374 |
|
sr.rorg[i] = oc[i] + offsdir[i] + d*onorm[i]; |
375 |
|
sr.rdir[i] = -onorm[i]; |
376 |
|
} |
377 |
+ |
sr.rmax = 0.0; |
378 |
|
rayorigin(&sr, PRIMARY, NULL, NULL); |
379 |
|
} while (!(*ofun[o->otype].funp)(o, &sr)); |
380 |
|
/* check against source */ |