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.37 by schorsch, Tue Mar 30 16:13:01 2004 UTC vs.
Revision 2.43 by greg, Thu Jun 2 04:47:27 2005 UTC

# Line 85 | Line 85 | int  ambres = 256;                     /* ambient resolution */
85   int  ambdiv = 1024;                     /* ambient divisions */
86   int  ambssamp = 512;                    /* ambient super-samples */
87   int  ambounce = 0;                      /* ambient bounces */
88 < char  *amblist[128];                    /* ambient include/exclude list */
88 > char  *amblist[AMBLLEN];                /* ambient include/exclude list */
89   int  ambincl = -1;                      /* include == 1, exclude == 0 */
90  
91   static int  castonly = 0;
# Line 96 | Line 96 | typedef void putf_t(double v);
96   static putf_t puta, putd, putf;
97  
98   typedef void oputf_t(RAY *r);
99 < static oputf_t  oputo, oputd, oputv, oputl, oputL, oputc,
100 <                oputp, oputn, oputN, oputs, oputw, oputm;
99 > static oputf_t  oputo, oputd, oputv, oputl, oputL, oputc, oputp,
100 >                oputn, oputN, oputs, oputw, oputW, oputm, oputM, oputtilde;
101  
102   static void setoutput(char *vs);
103   static void tranotify(OBJECT obj);
# Line 160 | Line 160 | rtrace(                                /* trace rays from file */
160                  sprintf(errmsg, "cannot open input file \"%s\"", fname);
161                  error(SYSTEM, errmsg);
162          }
163 #ifdef _WIN32
163          if (inform != 'a')
164                  SET_FILE_BINARY(fp);
166 #endif
165                                          /* set up output */
166          setoutput(outvals);
167          switch (outform) {
# Line 213 | Line 211 | rtrace(                                /* trace rays from file */
211          }
212          fflush(stdout);
213          if (vcount > 0)
214 <                error(USER, "read error");
214 >                error(USER, "unexpected EOF on input");
215          if (fname != NULL)
216                  fclose(fp);
217   }
218  
219  
220   static void
221 + trace_sources(void)                     /* trace rays to light sources, also */
222 + {
223 +        int     sn;
224 +        
225 +        for (sn = 0; sn < nsources; sn++)
226 +                source[sn].sflags |= SFOLLOW;
227 + }
228 +
229 +
230 + static void
231   setoutput(                              /* set up output tables */
232          register char  *vs
233   )
# Line 229 | Line 237 | setoutput(                             /* set up output tables */
237          castonly = 1;
238          while (*vs)
239                  switch (*vs++) {
240 +                case 'T':                               /* trace sources */
241 +                        if (!*vs) break;
242 +                        trace_sources();
243 +                        /* fall through */
244                  case 't':                               /* trace */
245 +                        if (!*vs) break;
246                          *table = NULL;
247                          table = every_out;
248                          trace = ourtrace;
# Line 271 | Line 284 | setoutput(                             /* set up output tables */
284                  case 'w':                               /* weight */
285                          *table++ = oputw;
286                          break;
287 +                case 'W':                               /* coefficient */
288 +                        *table++ = oputW;
289 +                        if (ambounce > 0 && (ambacc > FTINY || ambssamp > 0))
290 +                                error(WARNING,
291 +                                        "-otW accuracy depends on -aa 0 -as 0");
292 +                        break;
293                  case 'm':                               /* modifier */
294                          *table++ = oputm;
295                          break;
296 +                case 'M':                               /* material */
297 +                        *table++ = oputM;
298 +                        break;
299 +                case '~':                               /* tilde */
300 +                        *table++ = oputtilde;
301 +                        break;
302                  }
303          *table = NULL;
304   }
# Line 284 | Line 309 | bogusray(void)                 /* print out empty record */
309   {
310          thisray.rorg[0] = thisray.rorg[1] = thisray.rorg[2] =
311          thisray.rdir[0] = thisray.rdir[1] = thisray.rdir[2] = 0.0;
312 <        rayorigin(&thisray, NULL, PRIMARY, 1.0);
312 >        thisray.rmax = 0.0;
313 >        rayorigin(&thisray, PRIMARY, NULL, NULL);
314          printvals(&thisray);
315   }
316  
# Line 299 | Line 325 | rad(           /* compute and print ray value(s) */
325          VCOPY(thisray.rorg, org);
326          VCOPY(thisray.rdir, dir);
327          thisray.rmax = dmax;
328 <        rayorigin(&thisray, NULL, PRIMARY, 1.0);
328 >        rayorigin(&thisray, PRIMARY, NULL, NULL);
329          if (castonly) {
330                  if (!localhit(&thisray, &thescene)) {
331                          if (thisray.ro == &Aftplane) {  /* clipped */
# Line 326 | Line 352 | irrad(                 /* compute immediate irradiance value */
352                  thisray.rorg[i] = org[i] + dir[i];
353                  thisray.rdir[i] = -dir[i];
354          }
355 <        rayorigin(&thisray, NULL, PRIMARY, 1.0);
355 >        thisray.rmax = 0.0;
356 >        rayorigin(&thisray, PRIMARY, NULL, NULL);
357                                          /* pretend we hit surface */
358          thisray.rot = 1.0-1e-4;
359          thisray.rod = 1.0;
# Line 439 | Line 466 | ourtrace(                              /* print ray values */
466          tabin(r);
467          for (tp = every_out; *tp != NULL; tp++)
468                  (**tp)(r);
469 <        putchar('\n');
469 >        if (outform == 'a')
470 >                putchar('\n');
471   }
472  
473  
# Line 448 | Line 476 | tabin(                         /* tab in appropriate amount */
476          RAY  *r
477   )
478   {
479 <        register RAY  *rp;
479 >        const RAY  *rp;
480  
481          for (rp = r->parent; rp != NULL; rp = rp->parent)
482                  putchar('\t');
# Line 482 | Line 510 | oputv(                         /* print value */
510          RAY  *r
511   )
512   {
485        COLR  cout;
486        
513          if (outform == 'c') {
514 +                COLR  cout;
515                  setcolr(cout,   colval(r->rcol,RED),
516                                  colval(r->rcol,GRN),
517                                  colval(r->rcol,BLU));
# Line 602 | Line 629 | oputw(                         /* print weight */
629  
630  
631   static void
632 + oputW(                          /* print contribution */
633 +        RAY  *r
634 + )
635 + {
636 +        COLOR   contr;
637 +
638 +        raycontrib(contr, r, PRIMARY);
639 +        (*putreal)(colval(contr,RED));
640 +        (*putreal)(colval(contr,GRN));
641 +        (*putreal)(colval(contr,BLU));
642 + }
643 +
644 +
645 + static void
646   oputm(                          /* print modifier */
647          RAY  *r
648   )
# Line 614 | Line 655 | oputm(                         /* print modifier */
655          else
656                  putchar('*');
657          putchar('\t');
658 + }
659 +
660 +
661 + static void
662 + oputM(                          /* print material */
663 +        RAY  *r
664 + )
665 + {
666 +        OBJREC  *mat;
667 +
668 +        if (r->ro != NULL) {
669 +                if ((mat = findmaterial(r->ro)) != NULL)
670 +                        fputs(mat->oname, stdout);
671 +                else
672 +                        fputs(VOIDID, stdout);
673 +        } else
674 +                putchar('*');
675 +        putchar('\t');
676 + }
677 +
678 +
679 + static void
680 + oputtilde(                      /* output tilde (spacer) */
681 +        RAY  *r
682 + )
683 + {
684 +        fputs("~\t", stdout);
685   }
686  
687  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines