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.47 by greg, Mon Jun 13 20:07:56 2005 UTC vs.
Revision 2.55 by greg, Sat Nov 17 06:21:58 2007 UTC

# Line 29 | Line 29 | static const char      RCSid[] = "$Id$";
29   #include  "source.h"
30   #include  "otypes.h"
31   #include  "resolu.h"
32 + #include  "random.h"
33  
34   CUBE  thescene;                         /* our scene */
35   OBJECT  nsceneobjs;                     /* number of objects in our scene */
# Line 46 | Line 47 | char  *outvals = "v";                  /* output specification */
47  
48   int  do_irrad = 0;                      /* compute irradiance? */
49  
50 < int  rand_samp = 0;                     /* pure Monte Carlo sampling? */
50 > int  rand_samp = 1;                     /* pure Monte Carlo sampling? */
51  
52   void  (*trace)() = NULL;                /* trace call */
53  
54 < char  *tralist[128];                    /* list of modifers to trace (or no) */
54 > #ifndef MAXMODLIST
55 > #define MAXMODLIST      1024            /* maximum modifiers we'll track */
56 > #endif
57 >
58 > char  *tralist[MAXMODLIST];             /* list of modifers to trace (or no) */
59   int  traincl = -1;                      /* include == 1, exclude == 0 */
60   #ifndef  MAXTSET
61 < #define  MAXTSET        1024            /* maximum number in trace set */
61 > #define  MAXTSET        8191            /* maximum number in trace set */
62   #endif
63   OBJECT  traset[MAXTSET+1]={0};          /* trace include/exclude set */
64  
# Line 100 | Line 105 | typedef void putf_t(double v);
105   static putf_t puta, putd, putf;
106  
107   typedef void oputf_t(RAY *r);
108 < static oputf_t  oputo, oputd, oputv, oputl, oputL, oputc, oputp,
108 > static oputf_t  oputo, oputd, oputv, oputV, oputl, oputL, oputc, oputp,
109                  oputn, oputN, oputs, oputw, oputW, oputm, oputM, oputtilde;
110  
111   static void setoutput(char *vs);
# Line 197 | Line 202 | rtrace(                                /* trace rays from file */
202                                  nextflush = hresolu;
203                          }
204                  } else {
205 <                        samplendx = rand_samp ? random() : samplendx+1;
205 >                        samplendx++;
206                                                          /* compute and print */
207                          if (imm_irrad)
208                                  irrad(orig, direc);
# Line 214 | Line 219 | rtrace(                                /* trace rays from file */
219                  if (vcount && !--vcount)                /* check for end */
220                          break;
221          }
222 <        fflush(stdout);
222 >        if (fflush(stdout) < 0)
223 >                error(SYSTEM, "write error");
224          if (vcount)
225                  error(USER, "unexpected EOF on input");
226          if (fname != NULL)
# Line 263 | Line 269 | setoutput(                             /* set up output tables */
269                          *table++ = oputv;
270                          castonly = 0;
271                          break;
272 +                case 'V':                               /* contribution */
273 +                        *table++ = oputV;
274 +                        if (ambounce > 0 && (ambacc > FTINY || ambssamp > 0))
275 +                                error(WARNING,
276 +                                        "-otV accuracy depends on -aa 0 -as 0");
277 +                        break;
278                  case 'l':                               /* effective distance */
279                          *table++ = oputl;
280                          castonly = 0;
# Line 530 | Line 542 | oputv(                         /* print value */
542  
543  
544   static void
545 + oputV(                          /* print value contribution */
546 +        RAY *r
547 + )
548 + {
549 +        double  contr[3];
550 +
551 +        raycontrib(contr, r, PRIMARY);
552 +        multcolor(contr, r->rcol);
553 +        (*putreal)(contr[RED]);
554 +        (*putreal)(contr[GRN]);
555 +        (*putreal)(contr[BLU]);
556 + }
557 +
558 +
559 + static void
560   oputl(                          /* print effective distance */
561          RAY  *r
562   )
# Line 634 | Line 661 | oputw(                         /* print weight */
661  
662  
663   static void
664 < oputW(                          /* print contribution */
664 > oputW(                          /* print coefficient */
665          RAY  *r
666   )
667   {
668 <        COLOR   contr;
668 >        double  contr[3];
669  
670          raycontrib(contr, r, PRIMARY);
671 <        (*putreal)(colval(contr,RED));
672 <        (*putreal)(colval(contr,GRN));
673 <        (*putreal)(colval(contr,BLU));
671 >        (*putreal)(contr[RED]);
672 >        (*putreal)(contr[GRN]);
673 >        (*putreal)(contr[BLU]);
674   }
675  
676  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines