ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/rvmain.c
(Generate patch)

Comparing ray/src/rt/rvmain.c (file contents):
Revision 2.6 by greg, Tue Jun 21 00:26:44 2005 UTC vs.
Revision 2.11 by greg, Wed Oct 5 17:20:55 2011 UTC

# Line 19 | Line 19 | static const char      RCSid[] = "$Id$";
19   #include  "paths.h"
20   #include  "view.h"
21  
22 < char  *progname;                        /* argv[0] */
22 > extern char  *progname;                 /* global argv[0] */
23  
24 < char  *octname;                         /* octree name */
24 > VIEW  ourview = STDVIEW;                /* viewing parameters */
25 > int  hresolu, vresolu;                  /* image resolution */
26  
27 < char  *sigerr[NSIG];                    /* signal error messages */
27 > int  psample = 8;                       /* pixel sample size */
28 > double  maxdiff = .15;                  /* max. sample difference */
29  
30 < char  *shm_boundary = NULL;             /* boundary of shared memory */
30 > int  greyscale = 0;                     /* map colors to brightness? */
31 > char  *dvcname = dev_default;           /* output device name */
32  
33 < char  *errfile = NULL;                  /* error output file */
33 > double  exposure = 1.0;                 /* exposure for scene */
34  
35 < extern int  greyscale;                  /* map colors to brightness? */
36 < extern char  *dvcname;                  /* output device name */
37 < extern double  exposure;                /* exposure compensation */
35 > int  newparam = 1;                      /* parameter setting changed */
36 >
37 > struct driver  *dev = NULL;             /* driver functions */
38  
39 < extern VIEW  ourview;                   /* viewing parameters */
39 > char  rifname[128];                     /* rad input file name */
40  
41 < extern char  rifname[];                 /* rad input file name */
41 > VIEW  oldview;                          /* previous view parameters */
42  
43 < extern int  hresolu;                    /* horizontal resolution */
44 < extern int  vresolu;                    /* vertical resolution */
43 > PNODE  ptrunk;                          /* the base of our image */
44 > RECT  pframe;                           /* current frame boundaries */
45 > int  pdepth;                            /* image depth in current frame */
46  
47 < extern int  psample;                    /* pixel sample size */
44 < extern double  maxdiff;                 /* max. sample difference */
47 > char  *errfile = NULL;                  /* error output file */
48  
49 + int  nproc = 1;                         /* number of processes */
50 +
51 + char  *sigerr[NSIG];                    /* signal error messages */
52 +
53   static void onsig(int  signo);
54   static void sigdie(int  signo, char  *msg);
55   static void printdefaults(void);
56  
57  
58   int
59 < main(int  argc, char  *argv[])
59 > main(int argc, char *argv[])
60   {
61   #define  check(ol,al)           if (argv[i][ol] || \
62                                  badarg(argc-i-1,argv+i+1,al)) \
# Line 61 | Line 68 | main(int  argc, char  *argv[])
68                                  case 'n': case 'N': case 'f': case 'F': \
69                                  case '-': case '0': var = 0; break; \
70                                  default: goto badopt; }
71 +        char  *octnm = NULL;
72          char  *err;
73          int  rval;
74          int  i;
75                                          /* global program name */
76          progname = argv[0] = fixargv0(argv[0]);
77 +                                        /* set our defaults */
78 +        shadthresh = .1;
79 +        shadcert = .25;
80 +        directrelay = 0;
81 +        vspretest = 128;
82 +        srcsizerat = 0.;
83 +        specthresh = .3;
84 +        specjitter = 1.;
85 +        maxdepth = 6;
86 +        minweight = 1e-2;
87 +        ambacc = 0.3;
88 +        ambres = 32;
89 +        ambdiv = 256;
90 +        ambssamp = 64;
91                                          /* option city */
92          for (i = 1; i < argc; i++) {
93                                                  /* expand arguments */
# Line 101 | Line 123 | main(int  argc, char  *argv[])
123                          continue;
124                  }
125                  switch (argv[i][1]) {
126 +                case 'n':                               /* # processes */
127 +                        check(2,"i");
128 +                        nproc = atoi(argv[++i]);
129 +                        if (nproc <= 0)
130 +                                error(USER, "bad number of processes");
131 +                        break;
132                  case 'v':                               /* view file */
133                          if (argv[i][2] != 'f')
134                                  goto badopt;
# Line 166 | Line 194 | main(int  argc, char  *argv[])
194          err = setview(&ourview);        /* set viewing parameters */
195          if (err != NULL)
196                  error(USER, err);
197 <                                        /* initialize object types */
170 <        initotypes();
171 <                                        /* initialize urand */
172 <        srandom(rand_samp ? (long)time(0) : 0L);
173 <        initurand(2048);
174 <                                        /* set up signal handling */
197 >                                                /* set up signal handling */
198          sigdie(SIGINT, "Interrupt");
176        sigdie(SIGHUP, "Hangup");
199          sigdie(SIGTERM, "Terminate");
200 + #ifndef _WIN32
201 +        sigdie(SIGHUP, "Hangup");
202          sigdie(SIGPIPE, "Broken pipe");
203          sigdie(SIGALRM, "Alarm clock");
180 #ifdef  SIGXCPU
181        sigdie(SIGXCPU, "CPU limit exceeded");
182        sigdie(SIGXFSZ, "File size exceeded");
204   #endif
205                                          /* open error file */
206          if (errfile != NULL) {
# Line 196 | Line 217 | main(int  argc, char  *argv[])
217   #endif
218                                          /* get octree */
219          if (i == argc)
220 <                octname = NULL;
220 >                octnm = NULL;
221          else if (i == argc-1)
222 <                octname = argv[i];
222 >                octnm = argv[i];
223          else
224                  goto badopt;
225 <        if (octname == NULL)
225 >        if (octnm == NULL)
226                  error(USER, "missing octree argument");
227 <                                        /* set up output */
227 >                                        /* set up output & start process(es) */
228          SET_FILE_BINARY(stdout);
229 <        readoct(octname, ~(IO_FILES|IO_INFO), &thescene, NULL);
230 <        nsceneobjs = nobjects;
229 >        
230 >        ray_init(octnm);
231  
211        marksources();                  /* find and mark sources */
212
213        setambient();                   /* initialize ambient calculation */
214
232          rview();                        /* run interactive viewer */
233  
234 <        ambsync();                      /* flush ambient file */
234 >        devclose();                     /* close output device */
235  
236          quit(0);
237  
# Line 241 | Line 258 | wputs(                         /* warning output function */
258  
259   void
260   eputs(                          /* put string to stderr */
261 <        register char  *s
261 >        char  *s
262   )
263   {
264          static int  midline = 0;
# Line 270 | Line 287 | onsig(                         /* fatal signal */
287          if (gotsig++)                   /* two signals and we're gone! */
288                  _exit(signo);
289  
290 + #ifndef _WIN32
291          alarm(15);                      /* allow 15 seconds to clean up */
292          signal(SIGALRM, SIG_DFL);       /* make certain we do die */
293 + #endif
294          eputs("signal - ");
295          eputs(sigerr[signo]);
296          eputs("\n");
297 +        devclose();
298          quit(3);
299   }
300  
# Line 294 | Line 314 | sigdie(                        /* set fatal signal */
314   static void
315   printdefaults(void)                     /* print default values to stdout */
316   {
317 +        printf("-n %-2d\t\t\t\t# number of rendering processes\n", nproc);
318          printf(greyscale ? "-b+\t\t\t\t# greyscale on\n" :
319                          "-b-\t\t\t\t# greyscale off\n");
320          printf("-vt%c\t\t\t\t# view type %s\n", ourview.type,
# Line 302 | Line 323 | printdefaults(void)                    /* print default values to stdou
323                          ourview.type==VT_HEM ? "hemispherical" :
324                          ourview.type==VT_ANG ? "angular" :
325                          ourview.type==VT_CYL ? "cylindrical" :
326 +                        ourview.type==VT_PLS ? "planisphere" :
327                          "unknown");
328          printf("-vp %f %f %f\t# view point\n",
329                          ourview.vp[0], ourview.vp[1], ourview.vp[2]);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines