--- ray/src/util/rad.c 1998/06/03 16:37:51 2.56 +++ ray/src/util/rad.c 1999/02/02 08:57:56 2.60 @@ -1,7 +1,7 @@ -/* Copyright (c) 1995 Regents of the University of California */ +/* Copyright (c) 1999 Silicon Graphics, Inc. */ #ifndef lint -static char SCCSid[] = "$SunId$ LBL"; +static char SCCSid[] = "$SunId$ SGI"; #endif /* @@ -19,35 +19,37 @@ static char SCCSid[] = "$SunId$ LBL"; #define AMBFILE 0 /* ambient file name */ #define DETAIL 1 /* level of scene detail */ #define EXPOSURE 2 /* picture exposure setting */ -#define ILLUM 3 /* mkillum input files */ -#define INDIRECT 4 /* indirection in lighting */ -#define MATERIAL 5 /* material files */ -#define MKILLUM 6 /* mkillum options */ -#define OBJECT 7 /* object files */ -#define OCONV 8 /* oconv options */ -#define OCTREE 9 /* octree file name */ -#define OPTFILE 10 /* rendering options file */ -#define PENUMBRAS 11 /* shadow penumbras are desired */ -#define PFILT 12 /* pfilt options */ -#define PICTURE 13 /* picture file root name */ -#define QUALITY 14 /* desired rendering quality */ -#define RAWFILE 15 /* raw picture file root name */ -#define RENDER 16 /* rendering options */ -#define REPORT 17 /* report frequency and errfile */ -#define RESOLUTION 18 /* maximum picture resolution */ -#define SCENE 19 /* scene files */ -#define UP 20 /* view up (X, Y or Z) */ -#define VARIABILITY 21 /* level of light variability */ -#define VIEWS 22 /* view(s) for picture(s) */ -#define ZFILE 23 /* distance file root name */ -#define ZONE 24 /* simulation zone */ +#define EYESEP 3 /* interocular distance */ +#define ILLUM 4 /* mkillum input files */ +#define INDIRECT 5 /* indirection in lighting */ +#define MATERIAL 6 /* material files */ +#define MKILLUM 7 /* mkillum options */ +#define OBJECT 8 /* object files */ +#define OCONV 9 /* oconv options */ +#define OCTREE 10 /* octree file name */ +#define OPTFILE 11 /* rendering options file */ +#define PENUMBRAS 12 /* shadow penumbras are desired */ +#define PFILT 13 /* pfilt options */ +#define PICTURE 14 /* picture file root name */ +#define QUALITY 15 /* desired rendering quality */ +#define RAWFILE 16 /* raw picture file root name */ +#define RENDER 17 /* rendering options */ +#define REPORT 18 /* report frequency and errfile */ +#define RESOLUTION 19 /* maximum picture resolution */ +#define SCENE 20 /* scene files */ +#define UP 21 /* view up (X, Y or Z) */ +#define VARIABILITY 22 /* level of light variability */ +#define VIEWS 23 /* view(s) for picture(s) */ +#define ZFILE 24 /* distance file root name */ +#define ZONE 25 /* simulation zone */ /* total number of variables */ -int NVARS = 25; +int NVARS = 26; VARIABLE vv[] = { /* variable-value pairs */ {"AMBFILE", 3, 0, NULL, onevalue}, {"DETAIL", 3, 0, NULL, qualvalue}, {"EXPOSURE", 3, 0, NULL, fltvalue}, + {"EYESEP", 3, 0, NULL, fltvalue}, {"illum", 3, 0, NULL, catvalues}, {"INDIRECT", 3, 0, NULL, intvalue}, {"materials", 3, 0, NULL, catvalues}, @@ -184,7 +186,7 @@ char *argv[]; quit(0); userr: fprintf(stderr, -"Usage: %s [-s][-n][-t][-e][-V][-v view][-o dev] rfile [VAR=value ..]\n", +"Usage: %s [-w][-s][-n][-t][-e][-V][-v view][-o dev] rfile [VAR=value ..]\n", progname); quit(1); } @@ -211,16 +213,13 @@ register char *fnames; { char thisfile[MAXPATH]; time_t thisdate, lastdate = 0; - register char *cp; if (fnames == NULL) return(0); - while (*fnames) { - while (isspace(*fnames)) fnames++; - cp = thisfile; - while (*fnames && !isspace(*fnames)) - *cp++ = *fnames++; - *cp = '\0'; + while ((fnames = nextword(thisfile, MAXPATH, fnames)) != NULL) { + if (thisfile[0] == '!' || + (thisfile[0] == '\\' && thisfile[1] == '!')) + continue; if (!(thisdate = fdate(thisfile))) syserr(thisfile); if (thisdate > lastdate) @@ -339,7 +338,7 @@ double org[3], *sizp; setdefaults() /* set default values for unassigned var's */ { - double org[3], size; + double org[3], lim[3], size; char buf[128]; if (!vdef(ZONE)) { @@ -349,6 +348,16 @@ setdefaults() /* set default values for unassigned v vval(ZONE) = savqstr(buf); vdef(ZONE)++; } + if (!vdef(EYESEP)) { + if (sscanf(vval(ZONE), "%*s %lf %lf %lf %lf %lf %lf", + &org[0], &lim[0], &org[1], &lim[1], + &org[2], &lim[2]) != 6) + badvalue(ZONE); + sprintf(buf, "%f", + 0.01*(lim[0]-org[0]+lim[1]-org[1]+lim[2]-org[2])); + vval(EYESEP) = savqstr(buf); + vdef(EYESEP)++; + } if (!vdef(INDIRECT)) { vval(INDIRECT) = "0"; vdef(INDIRECT)++; @@ -1036,11 +1045,12 @@ again: } #endif copystruct(&vwr, &stdview); - cp = vopts; /* get -vf files first */ + sscanview(&vwr, cp=vopts); /* set initial options */ while ((cp = strstr(cp, "-vf ")) != NULL && - *atos(buf, sizeof(buf), cp += 4)) - viewfile(buf, &vwr, NULL); - sscanview(&vwr, vopts); /* get the rest */ + *atos(buf, sizeof(buf), cp += 4)) { + viewfile(buf, &vwr, NULL); /* load -vf file */ + sscanview(&vwr, cp); /* reset tail */ + } fputs(VIEWSTR, stdout); fprintview(&vwr, stdout); /* print full spec. */ fputc('\n', stdout);