24 |
|
|
25 |
|
#include "random.h" |
26 |
|
|
27 |
+ |
int dimlist[MAXDIM]; /* sampling dimensions */ |
28 |
+ |
int ndims = 0; /* number of sampling dimensions */ |
29 |
+ |
int samplendx; /* sample index number */ |
30 |
+ |
|
31 |
|
VIEW ourview = STDVIEW; /* view parameters */ |
32 |
|
int hresolu = 512; /* horizontal resolution */ |
33 |
|
int vresolu = 512; /* vertical resolution */ |
40 |
|
double dstrsrc = 0.0; /* square source distribution */ |
41 |
|
double shadthresh = .05; /* shadow threshold */ |
42 |
|
double shadcert = .5; /* shadow certainty */ |
43 |
+ |
int directrelay = 0; /* number of source relays */ |
44 |
|
|
45 |
|
int maxdepth = 6; /* maximum recursion depth */ |
46 |
|
double minweight = 5e-3; /* minimum ray weight */ |
65 |
|
|
66 |
|
extern long nrays; /* number of rays traced */ |
67 |
|
|
68 |
< |
#define MAXDIV 32 /* maximum sample size */ |
68 |
> |
#define MAXDIV 15 /* maximum sample size */ |
69 |
|
|
70 |
|
#define pixjitter() (.5+dstrpix*(.5-frandom())) |
71 |
|
|
127 |
|
/* check sampling */ |
128 |
|
if (psample < 1) |
129 |
|
psample = 1; |
130 |
< |
else if (psample > MAXDIV) |
130 |
> |
else if (psample > MAXDIV) { |
131 |
> |
sprintf(errmsg, "pixel sampling reduced from %d to %d", |
132 |
> |
psample, MAXDIV); |
133 |
> |
error(WARNING, errmsg); |
134 |
|
psample = MAXDIV; |
135 |
+ |
} |
136 |
|
/* allocate scanlines */ |
137 |
|
for (i = 0; i <= psample; i++) { |
138 |
|
scanbar[i] = (COLOR *)malloc(hresolu*sizeof(COLOR)); |
342 |
|
COLOR col; /* returned color */ |
343 |
|
int x, y; /* pixel position */ |
344 |
|
{ |
345 |
< |
static RAY thisray; /* our ray for this pixel */ |
345 |
> |
static RAY thisray; |
346 |
|
|
347 |
|
if (viewray(thisray.rorg, thisray.rdir, &ourview, |
348 |
|
(x+pixjitter())/hresolu, (y+pixjitter())/vresolu) < 0) { |
351 |
|
} |
352 |
|
|
353 |
|
rayorigin(&thisray, NULL, PRIMARY, 1.0); |
354 |
< |
|
354 |
> |
|
355 |
> |
samplendx = 3*y + x; /* set pixel index */ |
356 |
> |
|
357 |
|
rayvalue(&thisray); /* trace ray */ |
358 |
|
|
359 |
|
copycolor(col, thisray.rcol); /* return color */ |