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.64 by greg, Fri Jun 1 19:17:17 2012 UTC vs.
Revision 2.68 by greg, Fri May 22 09:19:11 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 35 | Line 36 | static int checkhit(RAY  *r, CUBE  *cu, OBJECT  *cxs);
36   static void checkset(OBJECT  *os, OBJECT  *cs);
37  
38  
39 < extern int
39 > int
40   rayorigin(              /* start new ray from old one */
41          RAY  *r,
42          int  rt,
# 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 (photonMapping && ro != NULL && ro->crtype & AMBIENT)
112 +                return(-1);
113          if (maxdepth <= 0 && rc != NULL) {      /* Russian roulette */
114                  if (minweight <= 0.0)
115                          error(USER, "zero ray weight in Russian roulette");
# Line 124 | Line 128 | rayorigin(             /* start new ray from old one */
128   }
129  
130  
131 < extern void
131 > void
132   rayclear(                       /* clear a ray for (re)evaluation */
133          RAY  *r
134   )
# Line 143 | Line 147 | rayclear(                      /* clear a ray for (re)evaluation */
147   }
148  
149  
150 < extern void
150 > void
151   raytrace(                       /* trace a ray and compute its value */
152          RAY  *r
153   )
# Line 163 | Line 167 | raytrace(                      /* trace a ray and compute its value */
167   }
168  
169  
170 < extern void
170 > void
171   raycont(                        /* check for clipped object and continue */
172          RAY  *r
173   )
# Line 174 | Line 178 | raycont(                       /* check for clipped object and continue */
178   }
179  
180  
181 < extern void
181 > void
182   raytrans(                       /* transmit ray as is */
183          RAY  *r
184   )
185   {
186          RAY  tr;
187  
188 <        if (rayorigin(&tr, TRANS, r, NULL) == 0) {
189 <                VCOPY(tr.rdir, r->rdir);
190 <                rayvalue(&tr);
191 <                copycolor(r->rcol, tr.rcol);
192 <                r->rt = r->rot + tr.rt;
189 <        }
188 >        rayorigin(&tr, TRANS, r, NULL);         /* always continue */
189 >        VCOPY(tr.rdir, r->rdir);
190 >        rayvalue(&tr);
191 >        copycolor(r->rcol, tr.rcol);
192 >        r->rt = r->rot + tr.rt;
193   }
194  
195  
196 < extern int
196 > int
197   rayshade(               /* shade ray r with material mod */
198          RAY  *r,
199          int  mod
# Line 225 | Line 228 | rayshade(              /* shade ray r with material mod */
228   }
229  
230  
231 < extern void
231 > void
232   rayparticipate(                 /* compute ray medium participation */
233          RAY  *r
234   )
# Line 249 | Line 252 | rayparticipate(                        /* compute ray medium participation
252          multcolor(r->rcol, ce);                 /* path extinction */
253          if (r->crtype & SHADOW || intens(r->albedo) <= FTINY)
254                  return;                         /* no scattering */
255 <        setcolor(ca,
256 <                colval(r->albedo,RED)*colval(ambval,RED)*(1.-colval(ce,RED)),
257 <                colval(r->albedo,GRN)*colval(ambval,GRN)*(1.-colval(ce,GRN)),
258 <                colval(r->albedo,BLU)*colval(ambval,BLU)*(1.-colval(ce,BLU)));
259 <        addcolor(r->rcol, ca);                  /* ambient in scattering */
255 >        
256 >        /* PMAP: indirect inscattering accounted for by volume photons? */
257 >        if (!volumePhotonMapping) {
258 >                setcolor(ca,
259 >                        colval(r->albedo,RED)*colval(ambval,RED)*(1.-colval(ce,RED)),
260 >                        colval(r->albedo,GRN)*colval(ambval,GRN)*(1.-colval(ce,GRN)),
261 >                        colval(r->albedo,BLU)*colval(ambval,BLU)*(1.-colval(ce,BLU)));
262 >                addcolor(r->rcol, ca);                  /* ambient in scattering */
263 >        }
264 >        
265          srcscatter(r);                          /* source in scattering */
266   }
267  
268  
269 < extern void
269 > void
270   raytexture(                     /* get material modifiers */
271          RAY  *r,
272          OBJECT  mod
# Line 283 | Line 291 | raytexture(                    /* get material modifiers */
291   }
292  
293  
294 < extern int
294 > int
295   raymixture(             /* mix modifiers */
296          RAY  *r,
297          OBJECT  fore,
# Line 343 | Line 351 | raymixture(            /* mix modifiers */
351   }
352  
353  
354 < extern double
354 > double
355   raydist(                /* compute (cumulative) ray distance */
356          const RAY  *r,
357          int  flags
# Line 359 | Line 367 | raydist(               /* compute (cumulative) ray distance */
367   }
368  
369  
370 < extern void
370 > void
371   raycontrib(             /* compute (cumulative) ray contribution */
372          RREAL  rc[3],
373          const RAY  *r,
# Line 385 | Line 393 | raycontrib(            /* compute (cumulative) ray contribution
393   }
394  
395  
396 < extern double
396 > double
397   raynormal(              /* compute perturbed normal for ray */
398          FVECT  norm,
399          RAY  *r
# Line 421 | Line 429 | raynormal(             /* compute perturbed normal for ray */
429   }
430  
431  
432 < extern void
432 > void
433   newrayxf(                       /* get new tranformation matrix for ray */
434          RAY  *r
435   )
# Line 459 | Line 467 | newrayxf(                      /* get new tranformation matrix for ray */
467   }
468  
469  
470 < extern void
470 > void
471   flipsurface(                    /* reverse surface orientation */
472          RAY  *r
473   )
# Line 474 | Line 482 | flipsurface(                   /* reverse surface orientation */
482   }
483  
484  
485 < extern void
485 > void
486   rayhit(                 /* standard ray hit test */
487          OBJECT  *oset,
488          RAY  *r
# Line 491 | Line 499 | rayhit(                        /* standard ray hit test */
499   }
500  
501  
502 < extern int
502 > int
503   localhit(               /* check for hit in the octree */
504          RAY  *r,
505          CUBE  *scene

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines