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

Comparing ray/src/util/vwrays.c (file contents):
Revision 3.23 by greg, Sat Dec 4 16:29:29 2021 UTC vs.
Revision 3.25 by greg, Fri Jan 12 17:29:10 2024 UTC

# Line 79 | Line 79 | main(
79                                          fprintf(stderr,
80                                                  "%s: no view in file\n",
81                                                          argv[i]);
82 <                                        exit(1);
82 >                                        return(1);
83                                  }
84                                  break;
85                          }
# Line 96 | Line 96 | main(
96                          if (rs.xr <= 0) {
97                                  fprintf(stderr, "%s: bad x resolution\n",
98                                                  progname);
99 <                                exit(1);
99 >                                return(1);
100                          }
101                          break;
102                  case 'y':                       /* y resolution */
# Line 104 | Line 104 | main(
104                          if (rs.yr <= 0) {
105                                  fprintf(stderr, "%s: bad y resolution\n",
106                                                  progname);
107 <                                exit(1);
107 >                                return(1);
108                          }
109                          break;
110                  case 'c':                       /* repeat count */
111                          repeatcnt = atoi(argv[++i]);
112 +                        if (repeatcnt < 1) repeatcnt = 1;
113                          break;
114                  case 'p':                       /* pixel aspect or jitter */
115                          if (argv[i][2] == 'a')
# Line 135 | Line 136 | main(
136                  rval = viewfile(argv[i], &vw, &rs);
137                  if (rval <= 0) {
138                          fprintf(stderr, "%s: no view in picture\n", argv[i]);
139 <                        exit(1);
139 >                        return(1);
140                  }
141                  if (!getdim & (i+1 < argc)) {
142                          zfd = open_float_depth(argv[i+1], (long)rs.xr*rs.yr);
143                          if (zfd < 0)
144 <                                exit(1);
144 >                                return(1);
145                  }
146          }
147          if ((err = setview(&vw)) != NULL) {
148                  fprintf(stderr, "%s: %s\n", progname, err);
149 <                exit(1);
149 >                return(1);
150          }
151          if (i == argc)
152                  normaspect(viewaspect(&vw), &pa, &rs.xr, &rs.yr);
153          if (getdim) {
154 <                printf("-x %d -y %d -ld%c\n", rs.xr, rs.yr,
155 <                                (i+1 == argc) & (vw.vaft > FTINY) ? '+' : '-');
156 <                exit(0);
154 >                printf("-x %d -y %d%s\n", rs.xr, rs.yr,
155 >                                (vw.vaft > FTINY) ? " -ld+" : "");
156 >                return(0);
157          }
158 +        if ((repeatcnt > 1) & (pj > FTINY))
159 +                initurand(1024);
160          if (fromstdin)
161                  pix2rays(stdin);
162          else
163                  putrays();
164 <        exit(0);
164 >        return(0);
165   userr:
166          fprintf(stderr,
167          "Usage: %s [ -i -u -f{a|f|d} -c rept | -d ] { view opts .. | picture [zbuf] }\n",
168                          progname);
169 <        exit(1);
169 >        return(1);
170   }
171  
172  
# Line 172 | Line 175 | jitterloc(
175          RREAL   loc[2]
176   )
177   {
178 <        if (pj > FTINY) {
179 <                loc[0] += pj*(.5 - frandom())/rs.xr;
180 <                loc[1] += pj*(.5 - frandom())/rs.yr;
181 <        }
178 >        static int      nsamp;
179 >        double          xyr[2];
180 >
181 >        if (pj <= FTINY)
182 >                return;
183 >
184 >        if (repeatcnt == 1) {
185 >                xyr[0] = frandom();
186 >                xyr[1] = frandom();
187 >        } else                          /* stratify samples */
188 >                multisamp(xyr, 2, urand(nsamp++));
189 >
190 >        loc[0] += pj*(.5 - xyr[0])/rs.xr;
191 >        loc[1] += pj*(.5 - xyr[1])/rs.yr;
192   }
193  
194  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines