23 |
|
* sort of context, so it is impossible to simultaneously run |
24 |
|
* this library on multiple scenes or in multiple threads. |
25 |
|
* You get one scene and one thread, and if you want more, you |
26 |
< |
* will have to go with the process model used by the programs |
27 |
< |
* gen/mkillum, hd/rholo, and px/pinterp. Finally, unrecoverable |
28 |
< |
* errors result in a call to the application-defined function |
29 |
< |
* quit(). The usual thing to do is to call exit(). |
26 |
> |
* will have to go with the process model defined in raypcalls.c. |
27 |
> |
* Finally, unrecoverable errors result in a call to the application- |
28 |
> |
* defined function quit(). The usual thing to do is to call exit(). |
29 |
|
* You might want to do something else instead, like |
30 |
|
* call setjmp()/longjmp() to bring you back to the calling |
31 |
|
* function for recovery. You may also wish to define your own |
114 |
|
|
115 |
|
void (*trace)() = NULL; /* trace call */ |
116 |
|
|
118 |
– |
extern void ambnotify(); |
117 |
|
void (*addobjnotify[8])() = {ambnotify, NULL}; |
118 |
|
|
119 |
|
int do_irrad = 0; /* compute irradiance? */ |
120 |
|
|
121 |
|
double dstrsrc = 0.0; /* square source distribution */ |
122 |
< |
double shadthresh = .05; /* shadow threshold */ |
123 |
< |
double shadcert = .5; /* shadow certainty */ |
122 |
> |
double shadthresh = .03; /* shadow threshold */ |
123 |
> |
double shadcert = .75; /* shadow certainty */ |
124 |
|
int directrelay = 2; /* number of source relays */ |
125 |
|
int vspretest = 512; /* virtual source pretest density */ |
126 |
|
int directvis = 1; /* sources visible? */ |
136 |
|
|
137 |
|
int backvis = 1; /* back face visibility */ |
138 |
|
|
139 |
< |
int maxdepth = 6; /* maximum recursion depth */ |
140 |
< |
double minweight = 4e-3; /* minimum ray weight */ |
139 |
> |
int maxdepth = 8; /* maximum recursion depth */ |
140 |
> |
double minweight = 2e-3; /* minimum ray weight */ |
141 |
|
|
142 |
|
char *ambfile = NULL; /* ambient file name */ |
143 |
|
COLOR ambval = BLKCOLOR; /* ambient value */ |
144 |
|
int ambvwt = 0; /* initial weight for ambient value */ |
145 |
< |
double ambacc = 0.2; /* ambient accuracy */ |
146 |
< |
int ambres = 128; /* ambient resolution */ |
147 |
< |
int ambdiv = 512; /* ambient divisions */ |
148 |
< |
int ambssamp = 0; /* ambient super-samples */ |
145 |
> |
double ambacc = 0.1; /* ambient accuracy */ |
146 |
> |
int ambres = 256; /* ambient resolution */ |
147 |
> |
int ambdiv = 1024; /* ambient divisions */ |
148 |
> |
int ambssamp = 512; /* ambient super-samples */ |
149 |
|
int ambounce = 0; /* ambient bounces */ |
150 |
|
char *amblist[AMBLLEN+1]; /* ambient include/exclude list */ |
151 |
|
int ambincl = -1; /* include == 1, exclude == 0 */ |
152 |
|
|
153 |
|
|
154 |
< |
void |
155 |
< |
ray_init(otnm) /* initialize ray-tracing calculation */ |
156 |
< |
char *otnm; |
154 |
> |
extern void |
155 |
> |
ray_init( /* initialize ray-tracing calculation */ |
156 |
> |
char *otnm |
157 |
> |
) |
158 |
|
{ |
159 |
|
if (nobjects > 0) /* free old scene data */ |
160 |
|
ray_done(0); |
173 |
|
/* ready to go... */ |
174 |
|
} |
175 |
|
|
176 |
< |
void |
177 |
< |
ray_trace(r) /* trace a primary ray */ |
178 |
< |
RAY *r; |
176 |
> |
extern void |
177 |
> |
ray_trace( /* trace a primary ray */ |
178 |
> |
RAY *r |
179 |
> |
) |
180 |
|
{ |
181 |
< |
rayorigin(r, NULL, PRIMARY, 1.0); |
181 |
> |
rayorigin(r, PRIMARY, NULL, NULL); |
182 |
|
samplendx++; |
183 |
|
rayvalue(r); /* assumes origin and direction are set */ |
184 |
|
} |
185 |
|
|
186 |
|
|
187 |
< |
void |
188 |
< |
ray_done(freall) /* free ray-tracing data */ |
189 |
< |
int freall; |
187 |
> |
extern void |
188 |
> |
ray_done( /* free ray-tracing data */ |
189 |
> |
int freall |
190 |
> |
) |
191 |
|
{ |
192 |
|
retainfonts = 1; |
193 |
|
ambdone(); |
205 |
|
initurand(0); |
206 |
|
} |
207 |
|
if (nobjects > 0) { |
208 |
< |
sprintf(errmsg, "%d objects left after call to ray_done()", |
208 |
> |
sprintf(errmsg, "%ld objects left after call to ray_done()", |
209 |
|
nobjects); |
210 |
|
error(WARNING, errmsg); |
211 |
|
} |
212 |
|
} |
213 |
|
|
214 |
|
|
215 |
< |
void |
216 |
< |
ray_save(rp) /* save current parameter settings */ |
217 |
< |
RAYPARAMS *rp; |
215 |
> |
extern void |
216 |
> |
ray_save( /* save current parameter settings */ |
217 |
> |
RAYPARAMS *rp |
218 |
> |
) |
219 |
|
{ |
220 |
|
int i, ndx; |
221 |
|
|
263 |
|
} |
264 |
|
|
265 |
|
|
266 |
< |
void |
267 |
< |
ray_restore(rp) /* restore parameter settings */ |
268 |
< |
RAYPARAMS *rp; |
266 |
> |
extern void |
267 |
> |
ray_restore( /* restore parameter settings */ |
268 |
> |
RAYPARAMS *rp |
269 |
> |
) |
270 |
|
{ |
271 |
|
register int i; |
272 |
|
|
331 |
|
} |
332 |
|
|
333 |
|
|
334 |
< |
void |
335 |
< |
ray_defaults(rp) /* get default parameter values */ |
336 |
< |
RAYPARAMS *rp; |
334 |
> |
extern void |
335 |
> |
ray_defaults( /* get default parameter values */ |
336 |
> |
RAYPARAMS *rp |
337 |
> |
) |
338 |
|
{ |
339 |
|
int i; |
340 |
|
|
343 |
|
|
344 |
|
rp->do_irrad = 0; |
345 |
|
rp->dstrsrc = 0.0; |
346 |
< |
rp->shadthresh = .05; |
347 |
< |
rp->shadcert = .5; |
346 |
> |
rp->shadthresh = .03; |
347 |
> |
rp->shadcert = .75; |
348 |
|
rp->directrelay = 2; |
349 |
|
rp->vspretest = 512; |
350 |
|
rp->directvis = 1; |
356 |
|
rp->specthresh = .15; |
357 |
|
rp->specjitter = 1.; |
358 |
|
rp->backvis = 1; |
359 |
< |
rp->maxdepth = 6; |
360 |
< |
rp->minweight = 4e-3; |
359 |
> |
rp->maxdepth = 8; |
360 |
> |
rp->minweight = 2e-3; |
361 |
|
setcolor(rp->ambval, 0., 0., 0.); |
362 |
|
memset(rp->ambfile, '\0', sizeof(rp->ambfile)); |
363 |
|
rp->ambvwt = 0; |
364 |
< |
rp->ambres = 128; |
365 |
< |
rp->ambacc = 0.2; |
366 |
< |
rp->ambdiv = 512; |
367 |
< |
rp->ambssamp = 0; |
364 |
> |
rp->ambres = 256; |
365 |
> |
rp->ambacc = 0.15; |
366 |
> |
rp->ambdiv = 1024; |
367 |
> |
rp->ambssamp = 512; |
368 |
|
rp->ambounce = 0; |
369 |
|
rp->ambincl = -1; |
370 |
|
memset(rp->amblval, '\0', sizeof(rp->amblval)); |