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

Comparing ray/src/rt/pmapdata.c (file contents):
Revision 2.19 by rschregle, Tue Mar 20 19:55:33 2018 UTC vs.
Revision 2.21 by rschregle, Fri May 10 17:43:22 2019 UTC

# Line 51 | Line 51 | PhotonMap *photonMaps [NUM_PMAP_TYPES] = {
51   #endif
52   extern OBJECT ambset [MAXASET+1];
53  
54 + /* Callback to print photon attributes acc. to user defined format */
55 + int (*printPhoton)(RAY *r, Photon *p, PhotonMap *pm);
56  
57  
58 +
59   void initPhotonMap (PhotonMap *pmap, PhotonMapType t)
60   /* Init photon map 'n' stuff... */
61   {
# Line 214 | Line 217 | int newPhoton (PhotonMap* pmap, const RAY* ray)
217     if (ray -> robj > -1 && islight(objptr(ray -> ro -> omod) -> otype))
218        return -1;
219  
220 <   /*  if modifier in include/exclude set */
220 >   /* Ignore photon if modifier in/outside exclude/include set */
221     if (ambincl != -1 && ray -> ro &&
222         ambincl != inset(ambset, ray -> ro -> omod))
223        return -1;
# Line 233 | Line 236 | int newPhoton (PhotonMap* pmap, const RAY* ray)
236        if (!inROI)
237           return -1;
238     }
239 <    
239 >  
240     /* Adjust flux according to distribution ratio and ray weight */
241 <   copycolor(photonFlux, ray -> rcol);  
241 >   copycolor(photonFlux, ray -> rcol);        
242 > #if 0
243 >   /* Factored out ray -> rweight as deprecated (?) for pmap, and infact
244 >      erroneously attenuates volume photon flux based on extinction,
245 >      which is already factored in by photonParticipate() */
246     scalecolor(photonFlux,
247                ray -> rweight / (pmap -> distribRatio ? pmap -> distribRatio
248                                                       : 1));
249 + #else
250 +   scalecolor(photonFlux,
251 +              1.0 / (pmap -> distribRatio ? pmap -> distribRatio : 1));
252 + #endif
253     setPhotonFlux(&photon, photonFlux);
254 <            
254 >
255     /* Set photon position and flags */
256     VCOPY(photon.pos, ray -> rop);
257     photon.flags = 0;
# Line 287 | Line 298 | int newPhoton (PhotonMap* pmap, const RAY* ray)
298        flushPhotonHeap(pmap);
299  
300     pmap -> numPhotons++;
301 +        
302 +   /* Print photon attributes */
303 +   if (printPhoton)
304 +      /* Non-const kludge */
305 +      printPhoton((RAY*)ray, &photon, pmap);
306              
307     return 0;
308   }
# Line 383 | Line 399 | void buildPhotonMap (PhotonMap *pmap, double *photonFl
399           /* Scale photon's flux (hitherto normalised to 1 over RGB); in
400            * case of a contrib photon map, this is done per light source,
401            * and photonFlux is assumed to be an array */
402 <         getPhotonFlux(p, flux);            
402 >         getPhotonFlux(p, flux);
403  
404           if (photonFlux) {
405              scalecolor(flux, photonFlux [isContribPmap(pmap) ?

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines