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

Comparing ray/src/rt/pmapamb.c (file contents):
Revision 2.1 by greg, Tue Feb 24 19:39:26 2015 UTC vs.
Revision 2.8 by rschregle, Tue May 17 17:39:47 2016 UTC

# Line 1 | Line 1
1 + #ifndef lint
2 + static const char RCSid[] = "$Id$";
3 + #endif
4 +
5   /*
6     ==================================================================
7     Photon map interface to RADIANCE ambient calculation
8  
9     Roland Schregle (roland.schregle@{hslu.ch, gmail.com})
10     (c) Fraunhofer Institute for Solar Energy Systems,
11 <       Lucerne University of Applied Sciences & Arts
11 >   (c) Lucerne University of Applied Sciences and Arts,
12 >   supported by the Swiss National Science Foundation (SNSF, #147053)
13     ==================================================================  
14    
15     $Id$
# Line 25 | Line 30 | int ambPmap (COLOR aval, RAY *r, int rdepth)
30     PhotonMap *pmap = contribPhotonMapping ? contribPmap
31                                            : preCompPmap ? preCompPmap
32                                                          : globalPmap;
33 <        
33 >      
34     /* Get photon irradiance either via 1 ambient bounce (final
35      * gather) if ambounce > 0, or directly if ambounce < 0. */
36     if (pmap && (rdepth || ambounce < 0)) {
# Line 57 | Line 62 | int ambPmapCaustic (COLOR aval, RAY *r, int rdepth)
62     /* Handle precedence in case of multiple photon maps: contrib > caustic */
63     PhotonMap *pmap = contribPhotonMapping ? contribPmap : causticPmap;
64  
65 <   /* Get caustic photon density estimate only at primary rays */
66 <   if (pmap && !rdepth) {
65 >   /* Get caustic photon density estimate at primary rays or when
66 >    * filling in ambient rays that have no global photon map to use */
67 >   if (pmap && (!rdepth || !globalPmap & !contribPmap & !preCompPmap)) {
68        /* Temporarily factor ambient value into ray coefficient
69         * (required for contribution photon map) */
70        copycolor(rcoef, r -> rcoef);      
71        multcolor(r -> rcoef, aval);
72        
73        /* Set caustic flag and get photon irradiance via callback */
74 <      pmap -> lookupFlags = PMAP_CAUST_BIT;
74 >      pmap -> lookupCaustic = 1;
75        (pmap -> lookup)(pmap, r, photonIrrad);
76        
77        /* Factor irradiance into ambient value and restore ray coeficient */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines