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

Comparing ray/src/rt/pmap.c (file contents):
Revision 2.7 by greg, Fri May 22 14:09:01 2015 UTC vs.
Revision 2.8 by rschregle, Tue May 26 12:07:31 2015 UTC

# Line 324 | Line 324 | void distribPhotons (PhotonMap **pmaps)
324     double totalFlux = 0;
325     PhotonMap *pm;
326    
327 <   for (t = 0; t < NUM_PMAP_TYPES && !photonMaps [t]; t++);
327 >   for (t = 0; t < NUM_PMAP_TYPES && !pmaps [t]; t++);
328     if (t >= NUM_PMAP_TYPES)
329        error(USER, "no photon maps defined");
330        
# Line 342 | Line 342 | void distribPhotons (PhotonMap **pmaps)
342        
343     /* Initialise all defined photon maps */
344     for (t = 0; t < NUM_PMAP_TYPES; t++)
345 <      initPhotonMap(photonMaps [t], t);
345 >      initPhotonMap(pmaps [t], t);
346  
347     initPhotonEmissionFuncs();
348     initPhotonScatterFuncs();
# Line 434 | Line 434 | void distribPhotons (PhotonMap **pmaps)
434              sprintf(errmsg, "too many prepasses");
435  
436              for (t = 0; t < NUM_PMAP_TYPES; t++)
437 <               if (photonMaps [t] && !photonMaps [t] -> heapEnd) {
437 >               if (pmaps [t] && !pmaps [t] -> heapEnd) {
438                    sprintf(errmsg2, ", no %s photons stored", pmapName [t]);
439                    strcat(errmsg, errmsg2);
440                 }
# Line 447 | Line 447 | void distribPhotons (PhotonMap **pmaps)
447           numEmit = FHUGE;
448          
449           for (t = 0; t < NUM_PMAP_TYPES; t++)
450 <            if (photonMaps [t])
451 <               numEmit = min(photonMaps [t] -> distribTarget, numEmit);
450 >            if (pmaps [t])
451 >               numEmit = min(pmaps [t] -> distribTarget, numEmit);
452                
453           numEmit *= preDistrib;
454        }
# Line 469 | Line 469 | void distribPhotons (PhotonMap **pmaps)
469            * Since this biases the photon density, addPhoton() promotes the
470            * flux of stored photons to compensate. */
471           for (t = 0; t < NUM_PMAP_TYPES; t++)
472 <            if ((pm = photonMaps [t])) {
472 >            if ((pm = pmaps [t])) {
473                 pm -> distribRatio = (double)pm -> distribTarget /
474                                      pm -> heapEnd - 1;
475  
# Line 494 | Line 494 | void distribPhotons (PhotonMap **pmaps)
494           /* Normalise distribution ratios and calculate number of photons to
495            * emit in main pass */
496           for (t = 0; t < NUM_PMAP_TYPES; t++)
497 <            if ((pm = photonMaps [t]))
497 >            if ((pm = pmaps [t]))
498                 pm -> distribRatio /= maxDistribRatio;
499                
500           if ((numEmit = repProgress * maxDistribRatio) < FTINY)
# Line 581 | Line 581 | void distribPhotons (PhotonMap **pmaps)
581        }
582        
583        for (t = 0; t < NUM_PMAP_TYPES; t++)
584 <         if (photonMaps [t] && !photonMaps [t] -> heapEnd) {
584 >         if (pmaps [t] && !pmaps [t] -> heapEnd) {
585              /* Double preDistrib in case a photon map is empty and redo
586               * pass 1 --> possibility of infinite loop for pathological
587               * scenes (e.g. absorbing materials) */
# Line 609 | Line 609 | void distribPhotons (PhotonMap **pmaps)
609     totalFlux /= repProgress;
610    
611     for (t = 0; t < NUM_PMAP_TYPES; t++)
612 <      if (photonMaps [t]) {
612 >      if (pmaps [t]) {
613           if (photonRepTime) {
614              sprintf(errmsg, "\nBuilding %s photon map...\n", pmapName [t]);
615              eputs(errmsg);
616              fflush(stderr);
617           }
618        
619 <         balancePhotons(photonMaps [t], &totalFlux);
619 >         balancePhotons(pmaps [t], &totalFlux);
620        }
621        
622     /* Precompute photon irradiance if necessary */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines