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

Comparing ray/src/rt/raytrace.c (file contents):
Revision 2.76 by greg, Fri Feb 22 17:12:58 2019 UTC vs.
Revision 2.79 by greg, Thu Jul 25 16:50:54 2019 UTC

# Line 116 | Line 116 | rayorigin(             /* start new ray from old one */
116                  if (photonMapping && rt != TRANS)
117                          return(-1);
118          }
119 <        if (maxdepth <= 0 && rc != NULL) {      /* Russian roulette */
119 >        if ((maxdepth <= 0) & (rc != NULL)) {   /* Russian roulette */
120                  if (minweight <= 0.0)
121                          error(USER, "zero ray weight in Russian roulette");
122 <                if (maxdepth < 0 && r->rlvl > -maxdepth)
122 >                if ((maxdepth < 0) & (r->rlvl > -maxdepth))
123                          return(-1);             /* upper reflection limit */
124                  if (r->rweight >= minweight)
125                          return(0);
# Line 130 | Line 130 | rayorigin(             /* start new ray from old one */
130                  r->rweight = minweight;
131                  return(0);
132          }
133 <        return(r->rweight >= minweight && r->rlvl <= abs(maxdepth) ? 0 : -1);
133 >        return((r->rweight >= minweight) & (r->rlvl <= abs(maxdepth)) ? 0 : -1);
134   }
135  
136  
# Line 147 | Line 147 | rayclear(                      /* clear a ray for (re)evaluation */
147          r->rox = NULL;
148          r->rxt = r->rmt = r->rot = FHUGE;
149          r->pert[0] = r->pert[1] = r->pert[2] = 0.0;
150 +        r->rflips = 0;
151          r->uv[0] = r->uv[1] = 0.0;
152          setcolor(r->pcol, 1.0, 1.0, 1.0);
153          setcolor(r->mcol, 0.0, 0.0, 0.0);
# Line 229 | Line 230 | rayshade(              /* shade ray r with material mod */
230          int     tst_irrad = do_irrad && !(r->crtype & ~(PRIMARY|TRANS));
231          OBJREC  *m;
232  
233 <        r->rxt = r->rmt = r->rot;       /* preset effective ray length */
233 >        r->rxt = r->rot;                /* preset effective ray length */
234          for ( ; mod != OVOID; mod = m->omod) {
235                  m = objptr(mod);
236                  /****** unnecessary test since modifier() is always called
# Line 403 | Line 404 | raycontrib(            /* compute (cumulative) ray contribution
404          int  flags
405   )
406   {
407 +        static int      warnedPM = 0;
408 +
409          rc[0] = rc[1] = rc[2] = 1.;
410  
411          while (r != NULL && r->crtype&flags) {
412                  int     i = 3;
413                  while (i--)
414                          rc[i] *= colval(r->rcoef,i);
415 +                                        /* check for participating medium */
416 +                if (!warnedPM && (bright(r->cext) > FTINY) |
417 +                                (bright(r->albedo) > FTINY)) {
418 +                        error(WARNING,
419 +        "ray contribution calculation does not support participating media");
420 +                        warnedPM++;
421 +                }
422                  r = r->parent;
423          }
424   }
# Line 500 | Line 510 | flipsurface(                   /* reverse surface orientation */
510          r->pert[0] = -r->pert[0];
511          r->pert[1] = -r->pert[1];
512          r->pert[2] = -r->pert[2];
513 +        r->rflips++;
514   }
515  
516  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines