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

Comparing ray/src/util/rsensor.c (file contents):
Revision 2.2 by greg, Thu Feb 21 20:18:25 2008 UTC vs.
Revision 2.3 by greg, Fri Feb 22 18:04:02 2008 UTC

# Line 45 | Line 45 | double         gscale = 1.;    /* global scaling value */
45   static void     comp_sensor(char *sfile);
46  
47   static void
48 < print_defaults()
48 > over_options()                  /* overriding options */
49   {
50 +        directvis = (ndsamps <= 0);
51 +        do_irrad = 0;
52 + }
53 +
54 + static void
55 + print_defaults()                /* print out default parameters */
56 + {
57 +        over_options();
58          printf("-n %-9d\t\t\t# number of processes\n", nprocs);
59          printf("-rd %-9ld\t\t\t# ray directions\n", nsamps);
60          /* printf("-rs %-9ld\t\t\t# ray super-samples\n", nssamps); */
# Line 68 | Line 76 | main(
76   )
77   {
78          int     doheader = 1;
79 +        int     optwarn = 0;
80          int     i, rval;
81  
82          progname = argv[0];
# Line 78 | Line 87 | main(
87          directrelay = 3;
88          ambounce = 1;
89          maxdepth = -10;
81                                /* just asking defaults? */
82        if (argc == 2 && !strcmp(argv[1], "-defaults")) {
83                print_defaults();
84                return(0);
85        }
86                                /* check octree */
87        if (argc < 2 || argv[argc-1][0] == '-')
88                error(USER, "missing octree argument");
90                                  /* get options from command line */
91 <        for (i = 1; i < argc-1; i++) {
91 >        for (i = 1; i < argc; i++) {
92                  while ((rval = expandarg(&argc, &argv, i)) > 0)
93                          ;
94                  if (rval < 0) {
95                          sprintf(errmsg, "cannot expand '%s'", argv[i]);
96                          error(SYSTEM, errmsg);
97                  }
98 <                if (argv[i][0] != '-') {        /* process a sensor file */
98 >                if (argv[i][0] != '-') {
99 >                        if (i >= argc-1)
100 >                                break;          /* final octree argument */
101                          if (!ray_pnprocs) {
102 <                                                /* overriding options */
100 <                                directvis = (ndsamps <= 0);
101 <                                do_irrad = 0;
102 >                                over_options();
103                                  if (doheader) { /* print header */
104                                          printargs(argc, argv, stdout);
105                                          fputformat("ascii", stdout);
# Line 107 | Line 108 | main(
108                                                  /* start process(es) */
109                                  ray_pinit(argv[argc-1], nprocs);
110                          }
111 <                        comp_sensor(argv[i]);
111 >                        comp_sensor(argv[i]);   /* process a sensor file */
112                          continue;
113                  }
114                  if (argv[i][1] == 'r') {        /* sampling options */
# Line 150 | Line 151 | main(
151                          sprintf(errmsg, "bad view option at '%s'", argv[i]);
152                          error(USER, errmsg);
153                  }
154 <                if (!strcmp(argv[i], "-w")) {   /* turn off warnings */
155 <                        nowarn = 1;
154 >                if (!strcmp(argv[i], "-w")) {   /* toggle warnings */
155 >                        nowarn = !nowarn;
156                          continue;
157                  }
158                  if (ray_pnprocs) {
159 <                        error(WARNING,
159 >                        if (!optwarn++)
160 >                                error(WARNING,
161                          "rendering options should appear before first sensor");
162                  } else if (!strcmp(argv[i], "-defaults")) {
163                          print_defaults();
# Line 178 | Line 180 | main(
180                  }
181                  i += rval;
182          }
183 +        if (!ray_pnprocs)
184 +                error(USER, i<argc ? "missing sensor file" : "missing octree");
185          quit(0);
186   }
187  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines