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.65 by greg, Wed Feb 19 14:12:48 2014 UTC vs.
Revision 2.69 by greg, Tue May 26 15:58:35 2015 UTC

# Line 14 | Line 14 | static const char RCSid[] = "$Id$";
14   #include  "otypes.h"
15   #include  "otspecial.h"
16   #include  "random.h"
17 + #include  "pmap.h"
18  
19   #define  MAXCSET        ((MAXSET+1)*2-1)        /* maximum check set size */
20  
# Line 106 | Line 107 | rayorigin(             /* start new ray from old one */
107                  return(-1);
108          if (r->crtype & SHADOW)                 /* shadow commitment */
109                  return(0);
110 +                                                /* ambient in photon map? */
111 +        if (ro != NULL && ro->crtype & AMBIENT) {
112 +                if (causticPhotonMapping)
113 +                        return(-1);
114 +                if (photonMapping && rt != TRANS)
115 +                        return(-1);
116 +        }
117          if (maxdepth <= 0 && rc != NULL) {      /* Russian roulette */
118                  if (minweight <= 0.0)
119                          error(USER, "zero ray weight in Russian roulette");
# Line 181 | Line 189 | raytrans(                      /* transmit ray as is */
189   {
190          RAY  tr;
191  
192 <        if (rayorigin(&tr, TRANS, r, NULL) == 0) {
193 <                VCOPY(tr.rdir, r->rdir);
194 <                rayvalue(&tr);
195 <                copycolor(r->rcol, tr.rcol);
196 <                r->rt = r->rot + tr.rt;
189 <        }
192 >        rayorigin(&tr, TRANS, r, NULL);         /* always continue */
193 >        VCOPY(tr.rdir, r->rdir);
194 >        rayvalue(&tr);
195 >        copycolor(r->rcol, tr.rcol);
196 >        r->rt = r->rot + tr.rt;
197   }
198  
199  
# Line 249 | Line 256 | rayparticipate(                        /* compute ray medium participation
256          multcolor(r->rcol, ce);                 /* path extinction */
257          if (r->crtype & SHADOW || intens(r->albedo) <= FTINY)
258                  return;                         /* no scattering */
259 <        setcolor(ca,
260 <                colval(r->albedo,RED)*colval(ambval,RED)*(1.-colval(ce,RED)),
261 <                colval(r->albedo,GRN)*colval(ambval,GRN)*(1.-colval(ce,GRN)),
262 <                colval(r->albedo,BLU)*colval(ambval,BLU)*(1.-colval(ce,BLU)));
263 <        addcolor(r->rcol, ca);                  /* ambient in scattering */
259 >        
260 >        /* PMAP: indirect inscattering accounted for by volume photons? */
261 >        if (!volumePhotonMapping) {
262 >                setcolor(ca,
263 >                        colval(r->albedo,RED)*colval(ambval,RED)*(1.-colval(ce,RED)),
264 >                        colval(r->albedo,GRN)*colval(ambval,GRN)*(1.-colval(ce,GRN)),
265 >                        colval(r->albedo,BLU)*colval(ambval,BLU)*(1.-colval(ce,BLU)));
266 >                addcolor(r->rcol, ca);                  /* ambient in scattering */
267 >        }
268 >        
269          srcscatter(r);                          /* source in scattering */
270   }
271  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines