13 |
|
#include "platform.h" |
14 |
|
#include "rtprocess.h" /* getpid() */ |
15 |
|
#include "ray.h" |
16 |
+ |
#include "func.h" |
17 |
|
#include "source.h" |
18 |
|
#include "ambient.h" |
19 |
|
#include "random.h" |
32 |
|
char *octname; /* octree name */ |
33 |
|
char *sigerr[NSIG]; /* signal error messages */ |
34 |
|
char *errfile = NULL; /* error output file */ |
35 |
< |
#ifdef SSKIPOPT |
35 |
< |
int *ssndx_map = NULL; /* loaded source index map */ |
36 |
< |
float *scorr_map = NULL; /* loaded source correction map */ |
37 |
< |
#endif |
38 |
< |
extern time_t time(); |
35 |
> |
|
36 |
|
extern time_t tstart; /* start time */ |
37 |
|
|
38 |
|
extern int ralrm; /* seconds between reports */ |
95 |
|
char *recover = NULL; |
96 |
|
char *outfile = NULL; |
97 |
|
char *zfile = NULL; |
101 |
– |
#ifdef SSKIPOPT |
102 |
– |
char *sskipspec = NULL; |
103 |
– |
char *scorrfile = NULL; |
104 |
– |
#endif |
98 |
|
int loadflags = ~IO_FILES; |
99 |
|
int seqstart = 0; |
100 |
|
int persist = 0; |
109 |
|
strcat(RFeatureList, RPICT_FEATURES); |
110 |
|
if (argc > 1 && !strcmp(argv[1], "-features")) |
111 |
|
return feature_status(argc-2, argv+2); |
112 |
+ |
/* initialize calcomp routines */ |
113 |
+ |
initfunc(); |
114 |
|
/* option city */ |
115 |
|
for (i = 1; i < argc; i++) { |
116 |
|
/* expand arguments */ |
243 |
|
check(2,"s"); |
244 |
|
recover = argv[++i]; |
245 |
|
break; |
251 |
– |
#ifdef SSKIPOPT |
252 |
– |
case 'd': |
253 |
– |
switch (argv[i][2]) { |
254 |
– |
case 'S': /* direct skip */ |
255 |
– |
check(3,"s"); |
256 |
– |
sskipspec = argv[++i]; |
257 |
– |
break; |
258 |
– |
case 'C': /* direct correction */ |
259 |
– |
check(3,"s"); |
260 |
– |
scorrfile = argv[++i]; |
261 |
– |
break; |
262 |
– |
default: |
263 |
– |
goto badopt; |
264 |
– |
} |
265 |
– |
break; |
266 |
– |
#endif |
246 |
|
#ifdef PERSIST |
247 |
|
case 'P': /* persist file */ |
248 |
|
if (argv[i][2] == 'P') { |
356 |
|
ray_init_pmap(); /* PMAP: set up & load photon maps */ |
357 |
|
|
358 |
|
marksources(); /* find and mark sources */ |
380 |
– |
#ifdef SSKIPOPT |
381 |
– |
if (sskipspec != NULL) { /* load source skip maps? */ |
382 |
– |
if ((seqstart > 0) | (persist > 0)) |
383 |
– |
error(USER, |
384 |
– |
"source skip map incompatible with -S/-P/-PP"); |
385 |
– |
if (srcskip_open(sskipspec, scorrfile) <= 0) |
386 |
– |
quit(1); |
387 |
– |
if ((ssndx_map = srcskip_ndxmap()) == NULL) |
388 |
– |
quit(1); |
389 |
– |
if (scorrfile != NULL && |
390 |
– |
(scorr_map = srcskip_corrmap()) == NULL) |
391 |
– |
quit(1); |
392 |
– |
srcskip_close(); /* leaves maps loaded */ |
393 |
– |
} |
394 |
– |
#endif |
359 |
|
setambient(); /* initialize ambient calculation */ |
360 |
|
|
361 |
|
fflush(stdout); /* in case we're duplicating header */ |
426 |
|
#undef check_bool |
427 |
|
} |
428 |
|
|
465 |
– |
#ifdef SSKIPOPT |
466 |
– |
void /* source skip parameters for primary */ |
467 |
– |
sskip_ray(RAY *r, double h, double v) |
468 |
– |
{ |
469 |
– |
size_t ssi; |
470 |
– |
|
471 |
– |
if (ssndx_map == NULL) |
472 |
– |
return; /* nothing to do */ |
473 |
– |
|
474 |
– |
/* rows counted from the top! */ |
475 |
– |
ssi = (size_t)((1.-v)*sskip_dim[1])*sskip_dim[0] + |
476 |
– |
(size_t)(h*sskip_dim[0]); |
477 |
– |
|
478 |
– |
if (ssi >= sskip_dim[0]*sskip_dim[1]) |
479 |
– |
error(CONSISTENCY, "bad index in sskip_ray()"); |
480 |
– |
|
481 |
– |
r->rsrc = ssndx_map[ssi]; |
482 |
– |
if (scorr_map != NULL) |
483 |
– |
r->scorr = scorr_map[ssi]; |
484 |
– |
} |
485 |
– |
#endif |
429 |
|
|
430 |
|
void |
431 |
|
wputs( /* warning output function */ |