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.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 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 (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 124 | Line 132 | rayorigin(             /* start new ray from old one */
132   }
133  
134  
135 < extern void
135 > void
136   rayclear(                       /* clear a ray for (re)evaluation */
137          RAY  *r
138   )
# Line 143 | Line 151 | rayclear(                      /* clear a ray for (re)evaluation */
151   }
152  
153  
154 < extern void
154 > void
155   raytrace(                       /* trace a ray and compute its value */
156          RAY  *r
157   )
# Line 163 | Line 171 | raytrace(                      /* trace a ray and compute its value */
171   }
172  
173  
174 < extern void
174 > void
175   raycont(                        /* check for clipped object and continue */
176          RAY  *r
177   )
# Line 174 | Line 182 | raycont(                       /* check for clipped object and continue */
182   }
183  
184  
185 < extern void
185 > void
186   raytrans(                       /* transmit ray as is */
187          RAY  *r
188   )
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  
200 < extern int
200 > int
201   rayshade(               /* shade ray r with material mod */
202          RAY  *r,
203          int  mod
# Line 225 | Line 232 | rayshade(              /* shade ray r with material mod */
232   }
233  
234  
235 < extern void
235 > void
236   rayparticipate(                 /* compute ray medium participation */
237          RAY  *r
238   )
# 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  
272  
273 < extern void
273 > void
274   raytexture(                     /* get material modifiers */
275          RAY  *r,
276          OBJECT  mod
# Line 283 | Line 295 | raytexture(                    /* get material modifiers */
295   }
296  
297  
298 < extern int
298 > int
299   raymixture(             /* mix modifiers */
300          RAY  *r,
301          OBJECT  fore,
# Line 343 | Line 355 | raymixture(            /* mix modifiers */
355   }
356  
357  
358 < extern double
358 > double
359   raydist(                /* compute (cumulative) ray distance */
360          const RAY  *r,
361          int  flags
# Line 359 | Line 371 | raydist(               /* compute (cumulative) ray distance */
371   }
372  
373  
374 < extern void
374 > void
375   raycontrib(             /* compute (cumulative) ray contribution */
376          RREAL  rc[3],
377          const RAY  *r,
# Line 385 | Line 397 | raycontrib(            /* compute (cumulative) ray contribution
397   }
398  
399  
400 < extern double
400 > double
401   raynormal(              /* compute perturbed normal for ray */
402          FVECT  norm,
403          RAY  *r
# Line 421 | Line 433 | raynormal(             /* compute perturbed normal for ray */
433   }
434  
435  
436 < extern void
436 > void
437   newrayxf(                       /* get new tranformation matrix for ray */
438          RAY  *r
439   )
# Line 459 | Line 471 | newrayxf(                      /* get new tranformation matrix for ray */
471   }
472  
473  
474 < extern void
474 > void
475   flipsurface(                    /* reverse surface orientation */
476          RAY  *r
477   )
# Line 474 | Line 486 | flipsurface(                   /* reverse surface orientation */
486   }
487  
488  
489 < extern void
489 > void
490   rayhit(                 /* standard ray hit test */
491          OBJECT  *oset,
492          RAY  *r
# Line 491 | Line 503 | rayhit(                        /* standard ray hit test */
503   }
504  
505  
506 < extern int
506 > int
507   localhit(               /* check for hit in the octree */
508          RAY  *r,
509          CUBE  *scene

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines