19 |
|
|
20 |
|
#include "random.h" |
21 |
|
|
22 |
< |
#define MINSAMPLES 5 /* minimum number of pretest samples */ |
23 |
< |
#define STESTMAX 30 /* maximum seeks per sample */ |
22 |
> |
#define MINSAMPLES 16 /* minimum number of pretest samples */ |
23 |
> |
#define STESTMAX 32 /* maximum seeks per sample */ |
24 |
|
|
25 |
|
|
26 |
|
double getdisk(); |
287 |
|
getplaneq(onorm, o); |
288 |
|
/* set number of rays to sample */ |
289 |
|
if (source[sn].sflags & SDISTANT) { |
290 |
< |
n = (2./3.*PI*PI)*or2/(thescene.cusize*thescene.cusize)* |
291 |
< |
vspretest + .5; |
290 |
> |
n = 4.*or2/(thescene.cusize*thescene.cusize)*vspretest + .5; |
291 |
|
infront = DOT(onorm, source[sn].sloc) > 0.; |
292 |
|
} else { |
293 |
|
for (i = 0; i < 3; i++) |
318 |
|
#endif |
319 |
|
return(f); /* too small a target! */ |
320 |
|
} |
321 |
+ |
peano(offsdir, 3, urand(sn*931+5827+ssn), .005); |
322 |
|
for (i = 0; i < 3; i++) |
323 |
< |
offsdir[i] = or*(1. - |
324 |
< |
2.*urand(urind(931*i+5827,ssn))); |
323 |
> |
offsdir[i] = or*(1. - 2.*offsdir[i]); |
324 |
|
ssn++; |
325 |
|
for (i = 0; i < 3; i++) |
326 |
|
sr.rorg[i] = oc[i] + offsdir[i]; |
348 |
|
nok++; |
349 |
|
/* check against obstructions */ |
350 |
|
rayclear(&sr); |
351 |
< |
sr.revf = raytrace; |
353 |
< |
rayvalue(&sr); |
354 |
< |
if (bright(sr.rcol) > FTINY) |
351 |
> |
if (!localhit(&sr, &thescene) || sr.ro == source[sn].so) |
352 |
|
nhit++; |
353 |
|
if (nhit > 0 && nhit < nok) { |
354 |
|
#ifdef DEBUG |