| 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? */ |
| 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); |
| 182 |
< |
samplendx++; |
| 181 |
> |
rayorigin(r, PRIMARY, NULL, NULL); |
| 182 |
> |
samplendx = rand_samp ? random() : samplendx+1; |
| 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 |
|
|
| 362 |
|
memset(rp->ambfile, '\0', sizeof(rp->ambfile)); |
| 363 |
|
rp->ambvwt = 0; |
| 364 |
|
rp->ambres = 256; |
| 365 |
< |
rp->ambacc = 0.1; |
| 365 |
> |
rp->ambacc = 0.15; |
| 366 |
|
rp->ambdiv = 1024; |
| 367 |
|
rp->ambssamp = 512; |
| 368 |
|
rp->ambounce = 0; |