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.39 by greg, Thu Apr 14 18:04:12 2005 UTC vs.
Revision 2.40 by greg, Tue Apr 19 01:15:06 2005 UTC

# 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, 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;
# Line 287 | 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 302 | 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 329 | 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 451 | 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 601 | Line 622 | oputw(                         /* print weight */
622   )
623   {
624          (*putreal)(r->rweight);
625 + }
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  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines