| 14 |
|
|
| 15 |
|
#include "platform.h" |
| 16 |
|
#include "RpictSimulManager.h" |
| 17 |
+ |
#include "func.h" |
| 18 |
|
#include "ambient.h" |
| 19 |
|
#include "pmapray.h" |
| 20 |
|
#include "random.h" |
| 21 |
|
|
| 21 |
– |
extern char *progname; /* argv[0] */ |
| 22 |
|
const char *sigerr[NSIG]; /* signal error messages */ |
| 23 |
|
|
| 24 |
|
VIEW ourview = STDVIEW; /* global view parameters */ |
| 56 |
|
"AdaptiveShadowTesting\nOutputs=v,l\n" \ |
| 57 |
|
"OutputCS=RGB,XYZ,prims,spec\n" |
| 58 |
|
|
| 59 |
– |
|
| 59 |
|
// Exit program |
| 60 |
|
void |
| 61 |
|
quit(int code) /* quit program */ |
| 62 |
|
{ |
| 63 |
< |
if (nproc < 0) { |
| 65 |
< |
ray_pnprocs = -1; // hack to avoid cleanup in child |
| 66 |
< |
_exit(code); |
| 67 |
< |
} |
| 68 |
< |
exit(code); // parent still frees everything (*yawn*) |
| 63 |
> |
exit(code); // don't bother to free data structs |
| 64 |
|
} |
| 65 |
|
|
| 66 |
+ |
/* Set default options */ |
| 67 |
+ |
static void |
| 68 |
+ |
default_options(void) |
| 69 |
+ |
{ |
| 70 |
+ |
shadthresh = .05; |
| 71 |
+ |
shadcert = .5; |
| 72 |
+ |
srcsizerat = .25; |
| 73 |
+ |
directrelay = 1; |
| 74 |
+ |
ambacc = 0.2; |
| 75 |
+ |
ambres = 64; |
| 76 |
+ |
ambdiv = 512; |
| 77 |
+ |
ambssamp = 128; |
| 78 |
+ |
maxdepth = 7; |
| 79 |
+ |
} |
| 80 |
|
|
| 81 |
|
int |
| 82 |
|
main(int argc, char *argv[]) |
| 98 |
|
int outfmt = 'c'; |
| 99 |
|
int rval; |
| 100 |
|
int i; |
| 101 |
< |
/* global program name */ |
| 102 |
< |
progname = argv[0]; |
| 101 |
> |
/* set global program name */ |
| 102 |
> |
fixargv0(argv[0]); |
| 103 |
|
/* feature check only? */ |
| 104 |
|
strcat(RFeatureList, RXPIECE_FEATURES); |
| 105 |
|
if (argc > 1 && !strcmp(argv[1], "-features")) |
| 106 |
|
return feature_status(argc-2, argv+2); |
| 107 |
+ |
/* initialize calcomp routines */ |
| 108 |
+ |
initfunc(); |
| 109 |
+ |
/* set defaults */ |
| 110 |
+ |
default_options(); |
| 111 |
|
/* option city */ |
| 112 |
|
for (i = 1; i < argc; i++) { |
| 113 |
|
/* expand arguments */ |
| 637 |
|
pixaspect = .0; // need to leave this as is |
| 638 |
|
myRPmanager.NewHeader(pout); // get prev. header info |
| 639 |
|
const char * tval = myRPmanager.GetHeadStr("TILED="); |
| 640 |
< |
if (tval) sscanf(tval, "%d %d", &tileGrid[0], &tileGrid[1]); |
| 640 |
> |
if (!tval || sscanf(tval, "%d %d", &tileGrid[0], &tileGrid[1]) != 2) |
| 641 |
> |
error(USER, "existing picture must be tiled"); |
| 642 |
|
CHECK(myRPmanager.GetView()==NULL, |
| 643 |
|
USER, "missing view in picture file"); |
| 644 |
|
ourview = *myRPmanager.GetView(); |
| 747 |
|
ndone++; |
| 748 |
|
} |
| 749 |
|
if (!ndone) |
| 750 |
< |
error(WARNING, "no tiles need rendering, exit"); |
| 750 |
> |
error(WARNING, "no tiles to render, exiting"); |
| 751 |
|
/* |
| 752 |
|
munmap(pixMap, pmlen); // technically unnecessary... |
| 753 |
|
if (zdMap) munmap(zdMap, zmlen); |