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

Comparing ray/src/rt/rtrace.c (file contents):
Revision 2.90 by greg, Sat Apr 4 15:38:52 2020 UTC vs.
Revision 2.91 by greg, Sun Apr 5 15:47:02 2020 UTC

# Line 144 | Line 144 | rtrace(                                /* trace rays from file */
144          if (inform != 'a')
145                  SET_FILE_BINARY(inpfp);
146                                          /* set up output */
147        setoutput(outvals);
147          if (imm_irrad)
148                  castonly = 0;
149          else if (castonly || every_out[0] != NULL)
# Line 158 | Line 157 | rtrace(                                /* trace rays from file */
157          case 'f': putreal = putf; break;
158          case 'd': putreal = putd; break;
159          case 'c':
160 <                if (outvals[0] && (outvals[1] || !strchr("vrx", outvals[0])))
160 >                if (outvals[1] || !strchr("vrx", outvals[0]))
161                          error(USER, "color format only with -ov, -or, -ox");
162                  putreal = putrgbe; break;
163          default:
# Line 228 | Line 227 | trace_sources(void)                    /* trace rays to light sources,
227   }
228  
229  
230 < static void
231 < setoutput(                              /* set up output tables */
233 <        char  *vs
234 < )
230 > int
231 > setrtoutput(void)                       /* set up output tables, return #comp */
232   {
233 +        char  *vs = outvals;
234          oputf_t **table = ray_out;
235 +        int  ncomp = 0;
236  
237 +        if (!*vs)
238 +                error(USER, "empty output specification");
239 +
240          castonly = 1;
241 <        while (*vs)
242 <                switch (*vs++) {
241 >        do
242 >                switch (*vs) {
243                  case 'T':                               /* trace sources */
244 <                        if (!*vs) break;
244 >                        if (!vs[1]) break;
245                          trace_sources();
246                          /* fall through */
247                  case 't':                               /* trace */
248 <                        if (!*vs) break;
248 >                        if (!vs[1]) break;
249                          *table = NULL;
250                          table = every_out;
251                          trace = ourtrace;
# Line 251 | Line 253 | setoutput(                             /* set up output tables */
253                          break;
254                  case 'o':                               /* origin */
255                          *table++ = oputo;
256 +                        ncomp += 3;
257                          break;
258                  case 'd':                               /* direction */
259                          *table++ = oputd;
260 +                        ncomp += 3;
261                          break;
262                  case 'r':                               /* reflected contrib. */
263                          *table++ = oputr;
264 +                        ncomp += 3;
265                          castonly = 0;
266                          break;
267                  case 'R':                               /* reflected distance */
268                          *table++ = oputR;
269 +                        ncomp++;
270                          castonly = 0;
271                          break;
272                  case 'x':                               /* xmit contrib. */
273                          *table++ = oputx;
274 +                        ncomp += 3;
275                          castonly = 0;
276                          break;
277                  case 'X':                               /* xmit distance */
278                          *table++ = oputX;
279 +                        ncomp++;
280                          castonly = 0;
281                          break;
282                  case 'v':                               /* value */
283                          *table++ = oputv;
284 +                        ncomp += 3;
285                          castonly = 0;
286                          break;
287                  case 'V':                               /* contribution */
288                          *table++ = oputV;
289 +                        ncomp += 3;
290                          if (ambounce > 0 && (ambacc > FTINY || ambssamp > 0))
291                                  error(WARNING,
292                                          "-otV accuracy depends on -aa 0 -as 0");
293                          break;
294                  case 'l':                               /* effective distance */
295                          *table++ = oputl;
296 +                        ncomp++;
297                          castonly = 0;
298                          break;
299                  case 'c':                               /* local coordinates */
300                          *table++ = oputc;
301 +                        ncomp += 2;
302                          break;
303                  case 'L':                               /* single ray length */
304                          *table++ = oputL;
305 +                        ncomp++;
306                          break;
307                  case 'p':                               /* point */
308                          *table++ = oputp;
309 +                        ncomp += 3;
310                          break;
311                  case 'n':                               /* perturbed normal */
312                          *table++ = oputn;
313 +                        ncomp += 3;
314                          castonly = 0;
315                          break;
316                  case 'N':                               /* unperturbed normal */
317                          *table++ = oputN;
318 +                        ncomp += 3;
319                          break;
320                  case 's':                               /* surface */
321                          *table++ = oputs;
322 +                        ncomp++;
323                          break;
324                  case 'w':                               /* weight */
325                          *table++ = oputw;
326 +                        ncomp++;
327                          break;
328                  case 'W':                               /* coefficient */
329                          *table++ = oputW;
330 +                        ncomp += 3;
331                          castonly = 0;
332                          if (ambounce > 0 && (ambacc > FTINY) | (ambssamp > 0))
333                                  error(WARNING,
# Line 316 | Line 335 | setoutput(                             /* set up output tables */
335                          break;
336                  case 'm':                               /* modifier */
337                          *table++ = oputm;
338 +                        ncomp++;
339                          break;
340                  case 'M':                               /* material */
341                          *table++ = oputM;
342 +                        ncomp++;
343                          break;
344                  case '~':                               /* tilde */
345                          *table++ = oputtilde;
346                          break;
347 +                default:
348 +                        sprintf(errmsg, "unrecognized output option '%c'", *vs);
349 +                        error(USER, errmsg);
350                  }
351 +        while (*++vs);
352 +
353          *table = NULL;
354 +        if (*every_out != NULL)
355 +                ncomp = 0;
356                                                          /* compatibility */
357          for (table = ray_out; *table != NULL; table++) {
358                  if ((*table == oputV) | (*table == oputW))
# Line 334 | Line 362 | setoutput(                             /* set up output tables */
362                                  (*table == oputx) | (*table == oputX))
363                          error(WARNING, "-orRxX options incompatible with -I+ and -i+");
364          }
365 +        return(ncomp);
366   }
367  
368  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines