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.14 by schorsch, Sun Mar 6 01:13:18 2016 UTC vs.
Revision 2.24 by greg, Wed Apr 23 02:35:26 2025 UTC

# Line 55 | Line 55 | static void onsig(int  signo);
55   static void sigdie(int  signo, char  *msg);
56   static void printdefaults(void);
57  
58 + static void
59 + set_defaults(void)
60 + {
61 +        shadthresh = .1;
62 +        shadcert = .25;
63 +        directrelay = 0;
64 +        vspretest = 128;
65 +        srcsizerat = 0.;
66 +        specthresh = .3;
67 +        specjitter = 1.;
68 +        maxdepth = 6;
69 +        minweight = 1e-3;
70 +        ambacc = 0.3;
71 +        ambres = 32;
72 +        ambdiv = 256;
73 +        ambssamp = 64;
74 + }
75  
76   int
77   main(int argc, char *argv[])
# Line 62 | Line 79 | main(int argc, char *argv[])
79   #define  check(ol,al)           if (argv[i][ol] || \
80                                  badarg(argc-i-1,argv+i+1,al)) \
81                                  goto badopt
82 < #define  bool(olen,var)         switch (argv[i][olen]) { \
82 > #define  check_bool(olen,var)           switch (argv[i][olen]) { \
83                                  case '\0': var = !var; break; \
84                                  case 'y': case 'Y': case 't': case 'T': \
85                                  case '+': case '1': var = 1; break; \
# Line 76 | Line 93 | main(int argc, char *argv[])
93                                          /* global program name */
94          progname = argv[0] = fixargv0(argv[0]);
95                                          /* set our defaults */
96 <        shadthresh = .1;
80 <        shadcert = .25;
81 <        directrelay = 0;
82 <        vspretest = 128;
83 <        srcsizerat = 0.;
84 <        specthresh = .3;
85 <        specjitter = 1.;
86 <        maxdepth = 6;
87 <        minweight = 1e-2;
88 <        ambacc = 0.3;
89 <        ambres = 32;
90 <        ambdiv = 256;
91 <        ambssamp = 64;
96 >        set_defaults();
97                                          /* option city */
98          for (i = 1; i < argc; i++) {
99                                                  /* expand arguments */
# Line 148 | Line 153 | main(int argc, char *argv[])
153                          }
154                          break;
155                  case 'b':                               /* grayscale */
156 <                        bool(2,greyscale);
156 >                        check_bool(2,greyscale);
157                          break;
158                  case 'p':                               /* pixel */
159                          switch (argv[i][2]) {
# Line 172 | Line 177 | main(int argc, char *argv[])
177                          break;
178                  case 'w':                               /* warnings */
179                          rval = erract[WARNING].pf != NULL;
180 <                        bool(2,rval);
180 >                        check_bool(2,rval);
181                          if (rval) erract[WARNING].pf = wputs;
182                          else erract[WARNING].pf = NULL;
183                          break;
# Line 192 | Line 197 | main(int argc, char *argv[])
197                          goto badopt;
198                  }
199          }
200 +                                        /* set/check spectral sampling */
201 +        if (setspectrsamp(CNDX, WLPART) <= 0)
202 +                error(USER, "unsupported spectral sampling");
203 +
204          err = setview(&ourview);        /* set viewing parameters */
205          if (err != NULL)
206                  error(USER, err);
# Line 230 | Line 239 | main(int argc, char *argv[])
239          
240          ray_init(octnm);                /* also calls ray_init_pmap() */
241          
242 + /* temporary shortcut, until winrview is refactored into a "device" */
243 + #ifndef WIN_RVIEW
244          rview();                        /* run interactive viewer */
245  
246 +
247          devclose();                     /* close output device */
248 + #endif
249  
250          /* PMAP: free photon maps */
251          ray_done_pmap();
252          
253 + #ifdef WIN_RVIEW
254 +        return 1;
255 + #endif
256          quit(0);
257  
258   badopt:
# Line 245 | Line 261 | badopt:
261          return 1; /* pro forma return */
262  
263   #undef  check
264 < #undef  bool
264 > #undef  check_bool
265   }
266  
267  
268   void
269   wputs(                          /* warning output function */
270 <        char    *s
270 >        const char      *s
271   )
272   {
273          int  lasterrno = errno;
274 +        if (erract[WARNING].pf == NULL)
275 +                return;         /* called by calcomp or someone */
276          eputs(s);
277          errno = lasterrno;
278   }
# Line 262 | Line 280 | wputs(                         /* warning output function */
280  
281   void
282   eputs(                          /* put string to stderr */
283 <        char  *s
283 >        const char  *s
284   )
285   {
286          static int  midline = 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines