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.40 by greg, Tue Apr 19 01:15:06 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;
101  
102   static void setoutput(char *vs);
103   static void tranotify(OBJECT obj);
# Line 220 | Line 220 | rtrace(                                /* trace rays from file */
220  
221  
222   static void
223 + trace_sources(void)                     /* trace rays to light sources, also */
224 + {
225 +        int     sn;
226 +        
227 +        for (sn = 0; sn < nsources; sn++)
228 +                source[sn].sflags |= SFOLLOW;
229 + }
230 +
231 +
232 + static void
233   setoutput(                              /* set up output tables */
234          register char  *vs
235   )
# Line 229 | Line 239 | setoutput(                             /* set up output tables */
239          castonly = 1;
240          while (*vs)
241                  switch (*vs++) {
242 +                case 'T':                               /* trace sources */
243 +                        trace_sources();
244 +                        /* fall through */
245                  case 't':                               /* trace */
246                          *table = NULL;
247                          table = every_out;
# 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 requires -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                  }
300          *table = NULL;
301   }
# Line 284 | Line 306 | bogusray(void)                 /* print out empty record */
306   {
307          thisray.rorg[0] = thisray.rorg[1] = thisray.rorg[2] =
308          thisray.rdir[0] = thisray.rdir[1] = thisray.rdir[2] = 0.0;
309 <        rayorigin(&thisray, NULL, PRIMARY, 1.0);
309 >        thisray.rmax = 0.0;
310 >        rayorigin(&thisray, PRIMARY, NULL, NULL);
311          printvals(&thisray);
312   }
313  
# Line 299 | Line 322 | rad(           /* compute and print ray value(s) */
322          VCOPY(thisray.rorg, org);
323          VCOPY(thisray.rdir, dir);
324          thisray.rmax = dmax;
325 <        rayorigin(&thisray, NULL, PRIMARY, 1.0);
325 >        rayorigin(&thisray, PRIMARY, NULL, NULL);
326          if (castonly) {
327                  if (!localhit(&thisray, &thescene)) {
328                          if (thisray.ro == &Aftplane) {  /* clipped */
# Line 326 | Line 349 | irrad(                 /* compute immediate irradiance value */
349                  thisray.rorg[i] = org[i] + dir[i];
350                  thisray.rdir[i] = -dir[i];
351          }
352 <        rayorigin(&thisray, NULL, PRIMARY, 1.0);
352 >        thisray.rmax = 0.0;
353 >        rayorigin(&thisray, PRIMARY, NULL, NULL);
354                                          /* pretend we hit surface */
355          thisray.rot = 1.0-1e-4;
356          thisray.rod = 1.0;
# Line 448 | Line 472 | tabin(                         /* tab in appropriate amount */
472          RAY  *r
473   )
474   {
475 <        register RAY  *rp;
475 >        const RAY  *rp;
476  
477          for (rp = r->parent; rp != NULL; rp = rp->parent)
478                  putchar('\t');
# Line 602 | Line 626 | oputw(                         /* print weight */
626  
627  
628   static void
629 + oputW(                          /* print contribution */
630 +        RAY  *r
631 + )
632 + {
633 +        COLOR   contr;
634 +        COLR    cout;
635 +
636 +        raycontrib(contr, r, PRIMARY);
637 +        if (outform == 'c') {
638 +                setcolr(cout,   colval(contr,RED),
639 +                                colval(contr,GRN),
640 +                                colval(contr,BLU));
641 +                fwrite((char *)cout, sizeof(cout), 1, stdout);
642 +                return;
643 +        }
644 +        (*putreal)(colval(contr,RED));
645 +        (*putreal)(colval(contr,GRN));
646 +        (*putreal)(colval(contr,BLU));
647 + }
648 +
649 +
650 + static void
651   oputm(                          /* print modifier */
652          RAY  *r
653   )
# Line 612 | Line 658 | oputm(                         /* print modifier */
658                  else
659                          fputs(VOIDID, stdout);
660          else
661 +                putchar('*');
662 +        putchar('\t');
663 + }
664 +
665 +
666 + static void
667 + oputM(                          /* print material */
668 +        RAY  *r
669 + )
670 + {
671 +        OBJREC  *mat;
672 +
673 +        if (r->ro != NULL) {
674 +                if ((mat = findmaterial(r->ro)) != NULL)
675 +                        fputs(mat->oname, stdout);
676 +                else
677 +                        fputs(VOIDID, stdout);
678 +        } else
679                  putchar('*');
680          putchar('\t');
681   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines