ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rmain.c
Revision: 2.19
Committed: Wed Jan 20 15:47:49 1993 UTC (32 years, 3 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.18: +2 -2 lines
Log Message:
added checks for -P or -PP with -r or -z in rpict

File Contents

# User Rev Content
1 greg 2.7 /* Copyright (c) 1992 Regents of the University of California */
2 greg 1.1
3     #ifndef lint
4     static char SCCSid[] = "$SunId$ LBL";
5     #endif
6    
7     /*
8     * rmain.c - main for ray tracing programs
9     *
10     * 3/24/87
11     */
12    
13     /* for flaky pre-processors */
14 greg 2.10 #ifndef RPICT
15     #define RPICT 0
16 greg 1.1 #endif
17 greg 2.10 #ifndef RTRACE
18     #define RTRACE 0
19 greg 1.1 #endif
20 greg 2.10 #ifndef RVIEW
21     #define RVIEW 0
22 greg 1.1 #endif
23 greg 2.18 /* persistent processes define */
24     #ifndef NIX
25     #if RPICT|RTRACE
26     #define PERSIST 1
27     #endif
28     #endif
29 greg 1.1
30     #include "ray.h"
31    
32 greg 1.50 #include "resolu.h"
33    
34 greg 1.1 #include "octree.h"
35    
36     #include <signal.h>
37    
38     #include "view.h"
39    
40 greg 2.10 #include "paths.h"
41 greg 1.1
42     char *progname; /* argv[0] */
43    
44 greg 1.19 char *octname; /* octree name */
45    
46 greg 1.1 char *libpath; /* library directory list */
47    
48     char *sigerr[NSIG]; /* signal error messages */
49    
50 greg 1.46 extern char VersionID[]; /* version ID string */
51    
52 greg 1.1 extern int stderr_v(); /* standard error output */
53     int (*errvec)() = stderr_v; /* error output vector */
54     int (*wrnvec)() = stderr_v; /* warning output vector */
55     int (*cmdvec)() = NULL; /* command error vector */
56    
57     int (*trace)() = NULL; /* trace call */
58 greg 1.36 int do_irrad = 0; /* compute irradiance? */
59 greg 1.1
60 greg 1.34 extern long time();
61     long tstart; /* start time */
62    
63 greg 1.24 extern int ambnotify(); /* new object notify functions */
64     int (*addobjnotify[])() = {ambnotify, NULL};
65    
66 greg 1.1 CUBE thescene; /* our scene */
67 greg 2.10 OBJECT nsceneobjs; /* number of objects in our scene */
68 greg 1.1
69 greg 1.36 extern int imm_irrad; /* calculate immediate irradiance? */
70    
71 greg 1.1 extern int ralrm; /* seconds between reports */
72    
73     extern int greyscale; /* map colors to brightness? */
74     extern char *devname; /* output device name */
75    
76 greg 2.8 extern char *formstr(); /* string from format */
77 greg 1.1 extern int inform; /* input format */
78     extern int outform; /* output format */
79     extern char *outvals; /* output values */
80    
81     extern VIEW ourview; /* viewing parameters */
82    
83     extern int hresolu; /* horizontal resolution */
84     extern int vresolu; /* vertical resolution */
85 greg 1.22 extern double pixaspect; /* pixel aspect ratio */
86 greg 1.1
87     extern int psample; /* pixel sample size */
88     extern double maxdiff; /* max. sample difference */
89 greg 1.11 extern double dstrpix; /* square pixel distribution */
90 greg 1.1
91     extern double dstrsrc; /* square source distribution */
92 greg 1.11 extern double shadthresh; /* shadow threshold */
93 greg 1.15 extern double shadcert; /* shadow testing certainty */
94 greg 1.39 extern int directrelay; /* number of source relays */
95 greg 1.40 extern int vspretest; /* virtual source pretest density */
96 greg 2.17 extern int directvis; /* light sources visible to eye? */
97 greg 1.47 extern double srcsizerat; /* maximum source size/dist. ratio */
98 greg 1.1
99 greg 2.4 extern double specthresh; /* specular sampling threshold */
100     extern double specjitter; /* specular sampling jitter */
101    
102 greg 1.1 extern int maxdepth; /* maximum recursion depth */
103     extern double minweight; /* minimum ray weight */
104    
105     extern COLOR ambval; /* ambient value */
106     extern double ambacc; /* ambient accuracy */
107     extern int ambres; /* ambient resolution */
108     extern int ambdiv; /* ambient divisions */
109     extern int ambssamp; /* ambient super-samples */
110     extern int ambounce; /* ambient bounces */
111     extern char *amblist[]; /* ambient include/exclude list */
112     extern int ambincl; /* include == 1, exclude == 0 */
113    
114    
115     main(argc, argv)
116     int argc;
117     char *argv[];
118     {
119 greg 2.10 #define check(ol,al) if (argv[i][ol] || \
120 greg 1.49 badarg(argc-i-1,argv+i+1,al)) \
121     goto badopt
122 greg 2.10 #define bool(olen,var) switch (argv[i][olen]) { \
123 greg 1.43 case '\0': var = !var; break; \
124     case 'y': case 'Y': case 't': case 'T': \
125     case '+': case '1': var = 1; break; \
126     case 'n': case 'N': case 'f': case 'F': \
127     case '-': case '0': var = 0; break; \
128     default: goto badopt; }
129 greg 1.1 char *err;
130     char *recover = NULL;
131 greg 2.7 char *outfile = NULL;
132 greg 1.20 char *zfile = NULL;
133 greg 1.1 char *errfile = NULL;
134     char *ambfile = NULL;
135     char **amblp = amblist;
136     int loadflags = ~IO_FILES;
137 greg 2.7 int seqstart = 0;
138 greg 2.18 int persist = 0;
139     int duped1;
140 greg 2.7 int rval;
141 greg 1.1 int i;
142 greg 1.34 /* record start time */
143     tstart = time((long *)0);
144 greg 1.1 /* global program name */
145 greg 2.11 progname = argv[0] = fixargv0(argv[0]);
146 greg 1.1 /* get library path */
147     if ((libpath = getenv(ULIBVAR)) == NULL)
148     libpath = DEFPATH;
149 greg 1.31 /* initialize object types */
150     initotypes();
151 greg 1.37 /* initialize urand */
152 greg 1.41 initurand(2048);
153 greg 1.10 /* option city */
154 greg 2.12 for (i = 1; i < argc; i++) {
155 greg 2.13 /* expand arguments */
156     while (rval = expandarg(&argc, &argv, i))
157     if (rval < 0) {
158     sprintf(errmsg, "cannot expand '%s'", argv[i]);
159     error(SYSTEM, errmsg);
160     }
161 greg 2.15 if (argv[i] == NULL || argv[i][0] != '-')
162 greg 2.12 break; /* break from options */
163 greg 1.46 if (!strcmp(argv[i], "-version")) {
164     puts(VersionID);
165     quit(0);
166     }
167 greg 1.18 if (!strcmp(argv[i], "-defaults") ||
168     !strcmp(argv[i], "-help")) {
169 greg 1.1 printdefaults();
170     quit(0);
171     }
172     #if RVIEW
173     if (!strcmp(argv[i], "-devices")) {
174     printdevices();
175     quit(0);
176     }
177     #endif
178 greg 1.21 #if RPICT|RVIEW
179     rval = getviewopt(&ourview, argc-i, argv+i);
180     if (rval >= 0) {
181     i += rval;
182     continue;
183     }
184     #endif
185 greg 1.1 switch (argv[i][1]) {
186     #if RPICT|RVIEW
187 greg 1.21 case 'v': /* view file */
188     if (argv[i][2] != 'f')
189 greg 1.10 goto badopt;
190 greg 1.49 check(3,"s");
191 greg 1.50 rval = viewfile(argv[++i], &ourview, NULL);
192 greg 1.21 if (rval < 0) {
193     sprintf(errmsg,
194     "cannot open view file \"%s\"",
195     argv[i]);
196     error(SYSTEM, errmsg);
197     } else if (rval == 0) {
198     sprintf(errmsg,
199     "bad view file \"%s\"",
200     argv[i]);
201     error(USER, errmsg);
202 greg 2.7 }
203 greg 1.1 break;
204     #endif
205 greg 1.11 case 'd': /* direct */
206 greg 1.1 switch (argv[i][2]) {
207 greg 1.13 case 't': /* threshold */
208 greg 1.49 check(3,"f");
209 greg 1.11 shadthresh = atof(argv[++i]);
210 greg 1.1 break;
211 greg 1.15 case 'c': /* certainty */
212 greg 1.49 check(3,"f");
213 greg 1.15 shadcert = atof(argv[++i]);
214     break;
215 greg 1.11 case 'j': /* jitter */
216 greg 1.49 check(3,"f");
217 greg 1.1 dstrsrc = atof(argv[++i]);
218     break;
219 greg 1.47 case 'r': /* relays */
220 greg 1.49 check(3,"i");
221 greg 1.39 directrelay = atoi(argv[++i]);
222     break;
223 greg 1.47 case 'p': /* pretest */
224 greg 1.49 check(3,"i");
225 greg 1.40 vspretest = atoi(argv[++i]);
226 greg 1.42 break;
227 greg 2.17 case 'v': /* visibility */
228     bool(3,directvis);
229 greg 1.40 break;
230 greg 1.47 case 's': /* size */
231 greg 1.49 check(3,"f");
232 greg 1.47 srcsizerat = atof(argv[++i]);
233     break;
234 greg 1.1 default:
235 greg 1.10 goto badopt;
236 greg 1.1 }
237     break;
238 greg 2.4 case 's': /* specular */
239     switch (argv[i][2]) {
240     case 't': /* threshold */
241     check(3,"f");
242     specthresh = atof(argv[++i]);
243     break;
244     case 'j': /* jitter */
245     check(3,"f");
246     specjitter = atof(argv[++i]);
247     break;
248     default:
249     goto badopt;
250     }
251     break;
252 greg 1.1 #if RPICT|RVIEW
253 greg 2.4 case 'p': /* pixel */
254 greg 1.1 switch (argv[i][2]) {
255 greg 2.4 case 's': /* sample */
256 greg 1.49 check(3,"i");
257 greg 1.1 psample = atoi(argv[++i]);
258     break;
259 greg 1.13 case 't': /* threshold */
260 greg 1.49 check(3,"f");
261 greg 1.1 maxdiff = atof(argv[++i]);
262     break;
263 greg 1.11 #if RPICT
264     case 'j': /* jitter */
265 greg 1.49 check(3,"f");
266 greg 1.11 dstrpix = atof(argv[++i]);
267     break;
268 greg 2.4 case 'a': /* aspect */
269     check(3,"f");
270     pixaspect = atof(argv[++i]);
271     break;
272 greg 1.11 #endif
273 greg 1.1 default:
274 greg 1.10 goto badopt;
275 greg 1.1 }
276     break;
277     #endif
278 greg 1.22 #if RPICT|RTRACE
279 greg 1.1 case 'x': /* x resolution */
280 greg 1.49 check(2,"i");
281 greg 1.1 hresolu = atoi(argv[++i]);
282     break;
283     case 'y': /* y resolution */
284 greg 1.49 check(2,"i");
285 greg 1.1 vresolu = atoi(argv[++i]);
286     break;
287 greg 1.22 #endif
288 greg 1.1 case 'w': /* warnings */
289 greg 1.43 rval = wrnvec != NULL;
290     bool(2,rval);
291 greg 2.6 if (rval) wrnvec = stderr_v;
292     else wrnvec = NULL;
293 greg 1.1 break;
294     case 'e': /* error file */
295 greg 1.49 check(2,"s");
296 greg 1.1 errfile = argv[++i];
297     break;
298     case 'l': /* limit */
299     switch (argv[i][2]) {
300     case 'r': /* recursion */
301 greg 1.49 check(3,"i");
302 greg 1.1 maxdepth = atoi(argv[++i]);
303     break;
304     case 'w': /* weight */
305 greg 1.49 check(3,"f");
306 greg 1.1 minweight = atof(argv[++i]);
307     break;
308     default:
309 greg 1.10 goto badopt;
310 greg 1.1 }
311     break;
312 greg 1.36 case 'i': /* irradiance */
313 greg 1.43 bool(2,do_irrad);
314 greg 1.36 break;
315 greg 1.1 #if RPICT
316 greg 2.7 case 'S': /* slave index */
317     check(2,"i");
318     seqstart = atoi(argv[++i]);
319     break;
320     case 'o': /* output file */
321     check(2,"s");
322     outfile = argv[++i];
323     break;
324 greg 1.20 case 'z': /* z file */
325 greg 1.49 check(2,"s");
326 greg 1.20 zfile = argv[++i];
327     break;
328 greg 1.1 case 'r': /* recover file */
329 greg 2.16 if (argv[i][2] == 'o') { /* +output */
330     check(3,"s");
331     outfile = argv[i+1];
332     } else
333     check(2,"s");
334 greg 1.1 recover = argv[++i];
335     break;
336     case 't': /* timer */
337 greg 1.49 check(2,"i");
338 greg 1.1 ralrm = atoi(argv[++i]);
339     break;
340     #endif
341     case 'a': /* ambient */
342     switch (argv[i][2]) {
343     case 'v': /* value */
344 greg 1.49 check(3,"fff");
345 greg 1.1 setcolor(ambval, atof(argv[i+1]),
346     atof(argv[i+2]),
347     atof(argv[i+3]));
348     i += 3;
349     break;
350     case 'a': /* accuracy */
351 greg 1.49 check(3,"f");
352 greg 1.1 ambacc = atof(argv[++i]);
353     break;
354     case 'r': /* resolution */
355 greg 1.49 check(3,"i");
356 greg 1.1 ambres = atoi(argv[++i]);
357     break;
358     case 'd': /* divisions */
359 greg 1.49 check(3,"i");
360 greg 1.1 ambdiv = atoi(argv[++i]);
361     break;
362     case 's': /* super-samp */
363 greg 1.49 check(3,"i");
364 greg 1.1 ambssamp = atoi(argv[++i]);
365     break;
366     case 'b': /* bounces */
367 greg 1.49 check(3,"i");
368 greg 1.1 ambounce = atoi(argv[++i]);
369     break;
370     case 'i': /* include */
371 greg 2.5 case 'I':
372 greg 1.49 check(3,"s");
373 greg 1.1 if (ambincl != 1) {
374     ambincl = 1;
375     amblp = amblist;
376     }
377 greg 2.5 if (argv[i][2] == 'I') { /* file */
378 greg 2.13 rval = wordfile(amblp,
379     getpath(argv[++i],libpath,R_OK));
380 greg 2.5 if (rval < 0) {
381     sprintf(errmsg,
382     "cannot open ambient include file \"%s\"",
383     argv[i]);
384     error(SYSTEM, errmsg);
385     }
386     amblp += rval;
387     } else
388     *amblp++ = argv[++i];
389 greg 1.1 break;
390     case 'e': /* exclude */
391 greg 2.5 case 'E':
392 greg 1.49 check(3,"s");
393 greg 1.1 if (ambincl != 0) {
394     ambincl = 0;
395     amblp = amblist;
396     }
397 greg 2.5 if (argv[i][2] == 'E') { /* file */
398 greg 2.13 rval = wordfile(amblp,
399     getpath(argv[++i],libpath,R_OK));
400 greg 2.5 if (rval < 0) {
401     sprintf(errmsg,
402     "cannot open ambient exclude file \"%s\"",
403     argv[i]);
404     error(SYSTEM, errmsg);
405     }
406     amblp += rval;
407     } else
408     *amblp++ = argv[++i];
409 greg 1.1 break;
410     case 'f': /* file */
411 greg 1.49 check(3,"s");
412 greg 1.1 ambfile= argv[++i];
413     break;
414     default:
415 greg 1.10 goto badopt;
416 greg 1.1 }
417     break;
418     #if RTRACE
419 greg 1.36 case 'I': /* immed. irradiance */
420 greg 1.43 bool(2,imm_irrad);
421 greg 1.36 break;
422 greg 1.1 case 'f': /* format i/o */
423     switch (argv[i][2]) {
424     case 'a': /* ascii */
425     case 'f': /* float */
426     case 'd': /* double */
427     inform = argv[i][2];
428     break;
429     default:
430 greg 1.10 goto badopt;
431 greg 1.1 }
432     switch (argv[i][3]) {
433     case '\0':
434     outform = inform;
435     break;
436     case 'a': /* ascii */
437     case 'f': /* float */
438     case 'd': /* double */
439 greg 2.7 case 'c': /* color */
440 greg 1.49 check(4,"");
441 greg 1.1 outform = argv[i][3];
442     break;
443     default:
444 greg 1.10 goto badopt;
445 greg 1.1 }
446     break;
447     case 'o': /* output */
448     outvals = argv[i]+2;
449     break;
450 greg 1.44 case 'h': /* header output */
451     rval = loadflags & IO_INFO;
452     bool(2,rval);
453     loadflags = rval ? loadflags | IO_INFO :
454     loadflags & ~IO_INFO;
455 greg 1.1 break;
456     #endif
457     #if RVIEW
458     case 'b': /* black and white */
459 greg 1.49 bool(2,greyscale);
460 greg 1.1 break;
461     case 'o': /* output device */
462 greg 1.49 check(2,"s");
463 greg 1.1 devname = argv[++i];
464     break;
465     #endif
466 greg 2.18 #ifdef PERSIST
467     case 'P': /* persist file */
468     if (argv[i][2] == 'P') {
469     check(3,"s");
470     persist = 2;
471     } else {
472     check(2,"s");
473     persist = 1;
474     }
475     persistfile(argv[++i]);
476     break;
477     #endif
478 greg 1.1 default:
479 greg 1.19 goto badopt;
480 greg 1.1 }
481     }
482 greg 1.24 *amblp = NULL;
483 greg 1.1 #if RPICT|RVIEW
484     err = setview(&ourview); /* set viewing parameters */
485     if (err != NULL)
486     error(USER, err);
487     #endif
488     /* set up signal handling */
489     sigdie(SIGINT, "Interrupt");
490     sigdie(SIGHUP, "Hangup");
491     sigdie(SIGTERM, "Terminate");
492     sigdie(SIGPIPE, "Broken pipe");
493 greg 1.45 sigdie(SIGALRM, "Alarm clock");
494 greg 2.10 #ifdef SIGXCPU
495 greg 1.1 sigdie(SIGXCPU, "CPU limit exceeded");
496     sigdie(SIGXFSZ, "File size exceeded");
497     #endif
498     /* open error file */
499     if (errfile != NULL) {
500     if (freopen(errfile, "a", stderr) == NULL)
501 greg 1.14 quit(2);
502 greg 1.1 fprintf(stderr, "**************\n*** PID %5d: ",
503     getpid());
504     printargs(argc, argv, stderr);
505 greg 2.12 putc('\n', stderr);
506 greg 1.1 fflush(stderr);
507     }
508 greg 2.10 #ifdef NICE
509 greg 1.1 nice(NICE); /* lower priority */
510     #endif
511 greg 1.19 /* get octree */
512 greg 1.1 #if RVIEW
513     loadflags &= ~IO_INFO;
514     #endif
515     if (i == argc)
516 greg 1.19 octname = NULL;
517     else if (i == argc-1)
518     octname = argv[i];
519 greg 1.1 else
520 greg 1.19 goto badopt;
521 greg 2.7 if (
522     #if RPICT
523     seqstart > 0 &&
524     #endif
525     octname == NULL)
526 greg 1.19 error(USER, "missing octree argument");
527 greg 2.18 #ifdef PERSIST
528     if (persist) {
529 greg 2.7 #if RPICT
530 greg 2.19 if (outfile != NULL | zfile != NULL | recover != NULL)
531     error(USER, "persist option used with -o, -r or -z");
532 greg 2.18 if (seqstart <= 0)
533     error(USER, "persist option only for sequences");
534     #endif
535     duped1 = dup(fileno(stdout)); /* don't lose our output */
536     openheader();
537     }
538     #endif
539     #if RPICT
540 greg 2.7 if (outfile != NULL)
541     openheader();
542 greg 1.1 #endif
543 greg 2.10 #ifdef MSDOS
544     #if RTRACE
545     if (outform != 'a')
546     #endif
547     setmode(fileno(stdout), O_BINARY);
548     if (octname == NULL)
549     setmode(fileno(stdin), O_BINARY);
550     #endif
551 greg 1.19 readoct(octname, loadflags, &thescene, NULL);
552 greg 2.9 nsceneobjs = nobjects;
553 greg 1.1
554     if (loadflags & IO_INFO) { /* print header */
555     printargs(i, argv, stdout);
556 greg 1.46 printf("SOFTWARE= %s\n", VersionID);
557 greg 2.8 #if RTRACE
558     fputformat(formstr(outform), stdout);
559     putchar('\n');
560     #endif
561 greg 1.1 }
562    
563     marksources(); /* find and mark sources */
564    
565 greg 1.24 setambient(ambfile); /* initialize ambient calculation */
566 greg 1.1
567 greg 2.18 #ifdef PERSIST
568     if (persist) {
569     fflush(stdout);
570     if (persist == 2) { /* multiprocessing */
571     preload_objs(); /* preload scene */
572     while ((rval=fork()) == 0) { /* keep on forkin' */
573     pflock(1);
574     pfhold();
575     }
576     if (rval < 0)
577     error(SYSTEM, "cannot fork child for persist function");
578     pfdetach();
579     persist = 0; /* parent shan't persist */
580     }
581     dup2(duped1, fileno(stdout)); /* reconnect stdout */
582     close(duped1);
583     dupheader();
584     }
585     runagain:
586     #endif
587 greg 1.1 #if RPICT
588 greg 2.7 rpict(seqstart, outfile, zfile, recover);
589 greg 1.1 #endif
590     #if RTRACE
591 greg 2.8 rtrace(NULL);
592 greg 1.1 #endif
593     #if RVIEW
594 greg 2.8 rview();
595 greg 2.18 #endif
596     #ifdef PERSIST
597     if (persist) {
598     pfhold(); /* loop until killed */
599     goto runagain;
600     }
601 greg 1.1 #endif
602     quit(0);
603 greg 1.19
604     badopt:
605     sprintf(errmsg, "command line error at '%s'", argv[i]);
606     error(USER, errmsg);
607    
608 greg 2.10 #undef check
609     #undef bool
610 greg 1.1 }
611    
612    
613     eputs(s) /* error output */
614     char *s;
615     {
616     if (errvec != NULL)
617     (*errvec)(s);
618     }
619    
620    
621     wputs(s) /* warning output */
622     char *s;
623     {
624 greg 2.3 int lasterrno = errno; /* save errno */
625    
626 greg 1.1 if (wrnvec != NULL)
627     (*wrnvec)(s);
628 greg 2.3
629     errno = lasterrno;
630 greg 1.1 }
631    
632    
633     cputs(s) /* command error output */
634     char *s;
635     {
636     if (cmdvec != NULL)
637     (*cmdvec)(s);
638     }
639    
640    
641     stderr_v(s) /* put string to stderr */
642     register char *s;
643     {
644 greg 1.26 static int midline = 0;
645 greg 1.1
646 greg 1.27 if (!*s)
647     return;
648 greg 1.26 if (!midline++) {
649 greg 1.1 fputs(progname, stderr);
650     fputs(": ", stderr);
651     }
652     fputs(s, stderr);
653 greg 1.27 if (s[strlen(s)-1] == '\n') {
654 greg 1.1 fflush(stderr);
655 greg 1.26 midline = 0;
656 greg 1.1 }
657     }
658    
659    
660     onsig(signo) /* fatal signal */
661     int signo;
662     {
663 greg 1.8 static int gotsig = 0;
664    
665     if (gotsig++) /* two signals and we're gone! */
666 greg 1.9 _exit(signo);
667 greg 1.8
668 greg 1.48 alarm(15); /* allow 15 seconds to clean up */
669     signal(SIGALRM, SIG_DFL); /* make certain we do die */
670 greg 1.1 eputs("signal - ");
671     eputs(sigerr[signo]);
672     eputs("\n");
673 greg 1.14 quit(3);
674 greg 1.1 }
675    
676    
677     sigdie(signo, msg) /* set fatal signal */
678     int signo;
679     char *msg;
680     {
681     if (signal(signo, onsig) == SIG_IGN)
682     signal(signo, SIG_IGN);
683     sigerr[signo] = msg;
684     }
685    
686    
687     printdefaults() /* print default values to stdout */
688     {
689     register char *cp;
690    
691 greg 1.43 #if RTRACE
692     if (imm_irrad)
693     printf("-I+\t\t\t\t# immediate irradiance on\n");
694     else
695     #endif
696     printf(do_irrad ? "-i+\t\t\t\t# irradiance calculation on\n" :
697     "-i-\t\t\t\t# irradiance calculation off\n");
698 greg 1.49 #if RVIEW
699     printf(greyscale ? "-b+\t\t\t\t# greyscale on\n" :
700     "-b-\t\t\t\t# greyscale off\n");
701     #endif
702 greg 1.1 #if RPICT|RVIEW
703 greg 1.7 printf("-vt%c\t\t\t\t# view type %s\n", ourview.type,
704 greg 1.1 ourview.type==VT_PER ? "perspective" :
705     ourview.type==VT_PAR ? "parallel" :
706 greg 1.28 ourview.type==VT_HEM ? "hemispherical" :
707     ourview.type==VT_ANG ? "angular" :
708 greg 1.1 "unknown");
709     printf("-vp %f %f %f\t# view point\n",
710     ourview.vp[0], ourview.vp[1], ourview.vp[2]);
711 greg 2.11 printf("-vd %f %f %f\t# view direction\n",
712 greg 1.1 ourview.vdir[0], ourview.vdir[1], ourview.vdir[2]);
713 greg 2.11 printf("-vu %f %f %f\t# view up\n",
714 greg 1.1 ourview.vup[0], ourview.vup[1], ourview.vup[2]);
715     printf("-vh %f\t\t\t# view horizontal size\n", ourview.horiz);
716     printf("-vv %f\t\t\t# view vertical size\n", ourview.vert);
717 greg 1.22 printf("-vs %f\t\t\t# view shift\n", ourview.hoff);
718     printf("-vl %f\t\t\t# view lift\n", ourview.voff);
719 greg 1.1 #endif
720 greg 1.22 #if RPICT|RTRACE
721 greg 1.1 printf("-x %-9d\t\t\t# x resolution\n", hresolu);
722     printf("-y %-9d\t\t\t# y resolution\n", vresolu);
723 greg 1.22 #endif
724     #if RPICT
725 greg 2.4 printf("-pa %f\t\t\t# pixel aspect ratio\n", pixaspect);
726     printf("-pj %f\t\t\t# pixel jitter\n", dstrpix);
727 greg 1.22 #endif
728 greg 1.1 #if RPICT|RVIEW
729 greg 2.4 printf("-ps %-9d\t\t\t# pixel sample\n", psample);
730     printf("-pt %f\t\t\t# pixel threshold\n", maxdiff);
731 greg 1.22 #endif
732 greg 1.29 printf("-dt %f\t\t\t# direct threshold\n", shadthresh);
733     printf("-dc %f\t\t\t# direct certainty\n", shadcert);
734     printf("-dj %f\t\t\t# direct jitter\n", dstrsrc);
735 greg 1.47 printf("-ds %f\t\t\t# direct sampling\n", srcsizerat);
736 greg 1.39 printf("-dr %-9d\t\t\t# direct relays\n", directrelay);
737 greg 1.40 printf("-dp %-9d\t\t\t# direct pretest density\n", vspretest);
738 greg 2.17 printf(directvis ? "-dv+\t\t\t\t# direct visibility on\n" :
739     "-dv-\t\t\t\t# direct visibility off\n");
740 greg 2.4 printf("-sj %f\t\t\t# specular jitter\n", specjitter);
741     printf("-st %f\t\t\t# specular threshold\n", specthresh);
742 greg 1.1 printf("-av %f %f %f\t# ambient value\n", colval(ambval,RED),
743     colval(ambval,GRN), colval(ambval, BLU));
744     printf("-ab %-9d\t\t\t# ambient bounces\n", ambounce);
745     printf("-aa %f\t\t\t# ambient accuracy\n", ambacc);
746     printf("-ar %-9d\t\t\t# ambient resolution\n", ambres);
747     printf("-ad %-9d\t\t\t# ambient divisions\n", ambdiv);
748     printf("-as %-9d\t\t\t# ambient super-samples\n", ambssamp);
749     printf("-lr %-9d\t\t\t# limit reflection\n", maxdepth);
750     printf("-lw %f\t\t\t# limit weight\n", minweight);
751     #if RPICT
752     printf("-t %-9d\t\t\t# time between reports\n", ralrm);
753     #endif
754     #if RVIEW
755     printf("-o %s\t\t\t\t# output device\n", devname);
756     #endif
757     #if RTRACE
758     printf("-f%c%c\t\t\t\t# format input/output = %s/%s\n",
759 greg 2.7 inform, outform, formstr(inform), formstr(outform));
760 greg 1.1 printf("-o%s\t\t\t\t# output", outvals);
761     for (cp = outvals; *cp; cp++)
762     switch (*cp) {
763     case 't': printf(" trace"); break;
764     case 'o': printf(" origin"); break;
765     case 'd': printf(" direction"); break;
766     case 'v': printf(" value"); break;
767     case 'l': printf(" length"); break;
768 greg 2.14 case 'L': printf(" first_length"); break;
769 greg 1.1 case 'p': printf(" point"); break;
770     case 'n': printf(" normal"); break;
771 greg 2.14 case 'N': printf(" unperturbed_normal"); break;
772 greg 1.1 case 's': printf(" surface"); break;
773     case 'w': printf(" weight"); break;
774     case 'm': printf(" modifier"); break;
775     }
776 greg 2.7 putchar('\n');
777 greg 1.1 #endif
778 greg 1.43 printf(wrnvec != NULL ? "-w+\t\t\t\t# warning messages on\n" :
779     "-w-\t\t\t\t# warning messages off\n");
780 greg 1.1 }