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 |
+ |
int vspretest = 128; /* virtual source pretest density */ |
45 |
|
|
46 |
|
int maxdepth = 6; /* maximum recursion depth */ |
47 |
|
double minweight = 5e-3; /* minimum ray weight */ |
66 |
|
|
67 |
|
extern long nrays; /* number of rays traced */ |
68 |
|
|
69 |
< |
#define MAXDIV 32 /* maximum sample size */ |
69 |
> |
#define MAXDIV 15 /* maximum sample size */ |
70 |
|
|
71 |
|
#define pixjitter() (.5+dstrpix*(.5-frandom())) |
72 |
|
|
128 |
|
/* check sampling */ |
129 |
|
if (psample < 1) |
130 |
|
psample = 1; |
131 |
< |
else if (psample > MAXDIV) |
131 |
> |
else if (psample > MAXDIV) { |
132 |
> |
sprintf(errmsg, "pixel sampling reduced from %d to %d", |
133 |
> |
psample, MAXDIV); |
134 |
> |
error(WARNING, errmsg); |
135 |
|
psample = MAXDIV; |
136 |
+ |
} |
137 |
|
/* allocate scanlines */ |
138 |
|
for (i = 0; i <= psample; i++) { |
139 |
|
scanbar[i] = (COLOR *)malloc(hresolu*sizeof(COLOR)); |
343 |
|
COLOR col; /* returned color */ |
344 |
|
int x, y; /* pixel position */ |
345 |
|
{ |
346 |
< |
static RAY thisray; /* our ray for this pixel */ |
346 |
> |
static RAY thisray; |
347 |
|
|
348 |
|
if (viewray(thisray.rorg, thisray.rdir, &ourview, |
349 |
|
(x+pixjitter())/hresolu, (y+pixjitter())/vresolu) < 0) { |
352 |
|
} |
353 |
|
|
354 |
|
rayorigin(&thisray, NULL, PRIMARY, 1.0); |
355 |
< |
|
355 |
> |
|
356 |
> |
samplendx = 3*y + x; /* set pixel index */ |
357 |
> |
|
358 |
|
rayvalue(&thisray); /* trace ray */ |
359 |
|
|
360 |
|
copycolor(col, thisray.rcol); /* return color */ |