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

Comparing ray/src/rt/rpmain.c (file contents):
Revision 2.8 by schorsch, Tue Mar 30 16:13:01 2004 UTC vs.
Revision 2.19 by greg, Thu Mar 21 16:52:40 2019 UTC

# Line 7 | Line 7 | static const char      RCSid[] = "$Id$";
7  
8   #include "copyright.h"
9  
10 < #include  <sys/types.h>
10 > #include  <time.h>
11   #include  <signal.h>
12  
13   #include  "platform.h"
# 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                                          /* persistent processes define */
24   #ifdef  F_SETLKW
# Line 49 | Line 50 | extern double  dstrpix;                        /* square pixel distribution
50  
51   extern double  mblur;                   /* motion blur parameter */
52  
53 + extern double  dblur;                   /* depth-of-field blur parameter */
54 +
55   static void onsig(int signo);
56   static void sigdie(int  signo, char  *msg);
57   static void printdefaults(void);
# Line 60 | Line 63 | main(int  argc, char  *argv[])
63   #define  check(ol,al)           if (argv[i][ol] || \
64                                  badarg(argc-i-1,argv+i+1,al)) \
65                                  goto badopt
66 < #define  bool(olen,var)         switch (argv[i][olen]) { \
66 > #define  check_bool(olen,var)           switch (argv[i][olen]) { \
67                                  case '\0': var = !var; break; \
68                                  case 'y': case 'Y': case 't': case 'T': \
69                                  case '+': case '1': var = 1; break; \
# Line 74 | Line 77 | main(int  argc, char  *argv[])
77          int  loadflags = ~IO_FILES;
78          int  seqstart = 0;
79          int  persist = 0;
80 <        int  duped1;
80 >        int  duped1 = -1;
81          int  rval;
82          int  i;
83                                          /* record start time */
# Line 152 | Line 155 | main(int  argc, char  *argv[])
155                                  check(3,"f");
156                                  mblur = atof(argv[++i]);
157                                  break;
158 +                        case 'd':                               /* aperture */
159 +                                check(3,"f");
160 +                                dblur = atof(argv[++i]);
161 +                                break;
162                          default:
163                                  goto badopt;
164                          }
# Line 202 | Line 209 | main(int  argc, char  *argv[])
209   #endif
210                  case 'w':                               /* warnings */
211                          rval = erract[WARNING].pf != NULL;
212 <                        bool(2,rval);
212 >                        check_bool(2,rval);
213                          if (rval) erract[WARNING].pf = wputs;
214                          else erract[WARNING].pf = NULL;
215                          break;
# Line 220 | Line 227 | main(int  argc, char  *argv[])
227                                          /* initialize object types */
228          initotypes();
229                                          /* initialize urand */
230 <        initurand(2048);
230 >        if (rand_samp) {
231 >                srandom((long)time(0));
232 >                initurand(0);
233 >        } else {
234 >                srandom(0L);
235 >                initurand(2048);
236 >        }
237                                          /* set up signal handling */
238          sigdie(SIGINT, "Interrupt");
239   #ifdef SIGHUP
# Line 273 | Line 286 | main(int  argc, char  *argv[])
286   #endif
287          if (outfile != NULL)
288                  openheader();
276 #ifdef  _WIN32
289          SET_FILE_BINARY(stdout);
290          if (octname == NULL)
291                  SET_FILE_BINARY(stdin);
280 #endif
292          readoct(octname, loadflags, &thescene, NULL);
293          nsceneobjs = nobjects;
294  
# Line 285 | Line 296 | main(int  argc, char  *argv[])
296                  printargs(i, argv, stdout);
297                  printf("SOFTWARE= %s\n", VersionID);
298          }
299 +                  
300 +        ray_init_pmap();     /* PMAP: set up & load photon maps */
301  
302          marksources();                  /* find and mark sources */
303  
304          setambient();                   /* initialize ambient calculation */
305 <
305 >        
306   #ifdef  PERSIST
307          if (persist) {
308                  fflush(stdout);
# Line 305 | Line 318 | main(int  argc, char  *argv[])
318                                  pflock(1);
319                                  pfhold();
320                                  tstart = time((time_t *)NULL);
321 +                                ambsync();              /* load new values */
322                          }
323                          if (rval < 0)
324                                  error(SYSTEM, "cannot fork child for persist function");
325 <                        pfdetach();             /* parent exits */
325 >                        pfdetach();             /* parent will run then exit */
326                  }
327          }
328   runagain:
# Line 343 | Line 357 | runagain:
357                  goto runagain;
358          }
359   #endif
360 +
361 +
362 +        ray_done_pmap();           /* PMAP: free photon maps */
363 +        
364          quit(0);
365  
366   badopt:
# Line 351 | Line 369 | badopt:
369          return 1; /* pro forma return */
370  
371   #undef  check
372 < #undef  bool
372 > #undef  check_bool
373   }
374  
375  
# Line 429 | Line 447 | printdefaults(void)                    /* print default values to stdou
447                          ourview.type==VT_HEM ? "hemispherical" :
448                          ourview.type==VT_ANG ? "angular" :
449                          ourview.type==VT_CYL ? "cylindrical" :
450 +                        ourview.type==VT_PLS ? "planisphere" :
451                          "unknown");
452          printf("-vp %f %f %f\t# view point\n",
453                          ourview.vp[0], ourview.vp[1], ourview.vp[2]);
# Line 447 | Line 466 | printdefaults(void)                    /* print default values to stdou
466          printf("-pa %f\t\t\t# pixel aspect ratio\n", pixaspect);
467          printf("-pj %f\t\t\t# pixel jitter\n", dstrpix);
468          printf("-pm %f\t\t\t# pixel motion\n", mblur);
469 +        printf("-pd %f\t\t\t# pixel depth-of-field\n", dblur);
470          printf("-ps %-9d\t\t\t# pixel sample\n", psample);
471          printf("-pt %f\t\t\t# pixel threshold\n", maxdiff);
472          printf("-t  %-9d\t\t\t# time between reports\n", ralrm);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines