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.9 by greg, Thu Aug 21 07:05:59 2008 UTC vs.
Revision 2.20 by greg, Wed Jan 17 01:31:08 2024 UTC

# Line 18 | Line 18 | static const char      RCSid[] = "$Id$";
18   #include  "random.h"
19   #include  "paths.h"
20   #include  "view.h"
21 + #include  "pmapray.h"
22  
23   extern char  *progname;                 /* global argv[0] */
24  
# Line 54 | Line 55 | static void onsig(int  signo);
55   static void sigdie(int  signo, char  *msg);
56   static void printdefaults(void);
57  
57
58   int
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)) \
63                                  goto badopt
64 < #define  bool(olen,var)         switch (argv[i][olen]) { \
64 > #define  check_bool(olen,var)           switch (argv[i][olen]) { \
65                                  case '\0': var = !var; break; \
66                                  case 'y': case 'Y': case 't': case 'T': \
67                                  case '+': case '1': var = 1; break; \
# Line 83 | Line 83 | main(int argc, char *argv[])
83          specthresh = .3;
84          specjitter = 1.;
85          maxdepth = 6;
86 <        minweight = 1e-2;
86 >        minweight = 1e-3;
87          ambacc = 0.3;
88          ambres = 32;
89          ambdiv = 256;
# Line 147 | Line 147 | main(int argc, char *argv[])
147                          }
148                          break;
149                  case 'b':                               /* grayscale */
150 <                        bool(2,greyscale);
150 >                        check_bool(2,greyscale);
151                          break;
152                  case 'p':                               /* pixel */
153                          switch (argv[i][2]) {
# Line 171 | Line 171 | main(int argc, char *argv[])
171                          break;
172                  case 'w':                               /* warnings */
173                          rval = erract[WARNING].pf != NULL;
174 <                        bool(2,rval);
174 >                        check_bool(2,rval);
175                          if (rval) erract[WARNING].pf = wputs;
176                          else erract[WARNING].pf = NULL;
177                          break;
# Line 191 | Line 191 | main(int argc, char *argv[])
191                          goto badopt;
192                  }
193          }
194 +                                        /* set/check spectral sampling */
195 +        rval = setspectrsamp(CNDX, WLPART);
196 +        if (rval < 0)
197 +                error(USER, "unsupported spectral sampling");
198 +
199          err = setview(&ourview);        /* set viewing parameters */
200          if (err != NULL)
201                  error(USER, err);
202                                                  /* set up signal handling */
203          sigdie(SIGINT, "Interrupt");
199        sigdie(SIGHUP, "Hangup");
204          sigdie(SIGTERM, "Terminate");
205 + #if !defined(_WIN32) && !defined(_WIN64)
206 +        sigdie(SIGHUP, "Hangup");
207          sigdie(SIGPIPE, "Broken pipe");
208          sigdie(SIGALRM, "Alarm clock");
209 + #endif
210                                          /* open error file */
211          if (errfile != NULL) {
212                  if (freopen(errfile, "a", stderr) == NULL)
# Line 225 | Line 232 | main(int argc, char *argv[])
232                                          /* set up output & start process(es) */
233          SET_FILE_BINARY(stdout);
234          
235 <        ray_pinit(octnm, 0);
236 <
235 >        ray_init(octnm);                /* also calls ray_init_pmap() */
236 >        
237 > /* temporary shortcut, until winrview is refactored into a "device" */
238 > #ifndef WIN_RVIEW
239          rview();                        /* run interactive viewer */
240  
241 +
242          devclose();                     /* close output device */
243 + #endif
244  
245 +        /* PMAP: free photon maps */
246 +        ray_done_pmap();
247 +        
248 + #ifdef WIN_RVIEW
249 +        return 1;
250 + #endif
251          quit(0);
252  
253   badopt:
# Line 239 | Line 256 | badopt:
256          return 1; /* pro forma return */
257  
258   #undef  check
259 < #undef  bool
259 > #undef  check_bool
260   }
261  
262  
263   void
264   wputs(                          /* warning output function */
265 <        char    *s
265 >        const char      *s
266   )
267   {
268          int  lasterrno = errno;
# Line 256 | Line 273 | wputs(                         /* warning output function */
273  
274   void
275   eputs(                          /* put string to stderr */
276 <        char  *s
276 >        const char  *s
277   )
278   {
279          static int  midline = 0;
# Line 285 | Line 302 | onsig(                         /* fatal signal */
302          if (gotsig++)                   /* two signals and we're gone! */
303                  _exit(signo);
304  
305 + #if !defined(_WIN32) && !defined(_WIN64)
306          alarm(15);                      /* allow 15 seconds to clean up */
307          signal(SIGALRM, SIG_DFL);       /* make certain we do die */
308 + #endif
309          eputs("signal - ");
310          eputs(sigerr[signo]);
311          eputs("\n");

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines