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 */ |
20 |
|
#define STESTMAX 32 /* maximum seeks per sample */ |
21 |
|
|
24 |
– |
#define FEQ(a,b) ((a)-(b)+FTINY >= 0 && (b)-(a)+FTINY >= 0) |
22 |
|
|
26 |
– |
|
23 |
|
static OBJECT *vobject; /* virtual source objects */ |
24 |
|
static int nvobjects = 0; /* number of virtual source objects */ |
25 |
|
|
31 |
|
|
32 |
|
for (i = 4; i--; ) |
33 |
|
for (j = 4; j--; ) |
34 |
< |
if (!FEQ(m[i][j], i==j)) |
34 |
> |
if (!FABSEQ(m[i][j], i==j)) |
35 |
|
return(0); |
36 |
|
return(1); |
37 |
|
} |
137 |
|
OBJREC *m; |
138 |
|
|
139 |
|
i = o->omod; |
140 |
< |
m = findmaterial(objptr(i)); |
140 |
> |
m = findmaterial(o); |
141 |
|
if (m == NULL) |
142 |
|
return(objptr(i)); |
143 |
|
if (m->otype != MAT_ILLUM || m->oargs.nsargs < 1 || |
372 |
|
sr.rorg[i] = oc[i] + offsdir[i] + d*onorm[i]; |
373 |
|
sr.rdir[i] = -onorm[i]; |
374 |
|
} |
375 |
+ |
sr.rmax = 0.0; |
376 |
|
rayorigin(&sr, PRIMARY, NULL, NULL); |
377 |
|
} while (!(*ofun[o->otype].funp)(o, &sr)); |
378 |
|
/* check against source */ |
387 |
|
} |
388 |
|
sr.revf = srcvalue; |
389 |
|
rayvalue(&sr); /* check sample validity */ |
390 |
< |
if ((d = bright(sr.rcol)) <= FTINY) |
390 |
> |
if ((d = scolor_mean(sr.rcol)) <= FTINY) |
391 |
|
continue; |
392 |
|
nok++; /* got sample; check obstructions */ |
393 |
|
rayclear(&sr); |
394 |
|
sr.revf = raytrace; |
395 |
|
rayvalue(&sr); |
396 |
< |
if ((d1 = bright(sr.rcol)) > FTINY) { |
396 |
> |
if ((d1 = scolor_mean(sr.rcol)) > FTINY) { |
397 |
|
if (d - d1 > FTINY) { |
398 |
|
#ifdef DEBUG |
399 |
|
fprintf(stderr, "\tpartially shadowed\n"); |