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

Comparing ray/src/rt/pmapsrc.c (file contents):
Revision 2.2 by greg, Tue Apr 21 19:16:51 2015 UTC vs.
Revision 2.8 by greg, Tue Sep 1 16:27:53 2015 UTC

# Line 1 | Line 1
1 + #ifndef lint
2 + static const char RCSid[] = "$Id$";
3 + #endif
4   /*
5     ==================================================================
6     Photon map support routines for emission from light sources
7  
8     Roland Schregle (roland.schregle@{hslu.ch, gmail.com})
9     (c) Fraunhofer Institute for Solar Energy Systems,
10 <       Lucerne University of Applied Sciences & Arts  
10 >   (c) Lucerne University of Applied Sciences and Arts,
11 >   supported by the Swiss National Science Foundation (SNSF, #147053)
12     ==================================================================
13 <  
10 <   $Id$
13 >
14   */
15  
16  
# Line 591 | Line 594 | void initPhotonEmission (EmissionMap *emap, float numP
594     unsigned i, t, p;
595     double phi, cosTheta, sinTheta, du, dv, dOmega, thetaScale;
596     EmissionSample* sample;
597 <   const OBJREC* mod =  objptr(emap -> src -> so -> omod);
597 >   const OBJREC* mod =  findmaterial(emap -> src -> so);
598     static RAY r;
599   #if 0  
600     static double lastCosNorm = FHUGE;
601     static SRCREC *lastSrc = NULL, *lastPort = NULL;
602   #endif  
603  
604 +   setcolor(emap -> partFlux, 0, 0, 0);
605 +
606     photonOrigin [emap -> src -> so -> otype] (emap);
607     cosTheta = DOT(emap -> ws, emap -> wh);
608  
# Line 620 | Line 625 | void initPhotonEmission (EmissionMap *emap, float numP
625   #endif
626          
627     /* Need to recompute flux & PDF */
623   setcolor(emap -> partFlux, 0, 0, 0);
628     emap -> cdf = 0;
629     emap -> numSamples = 0;
630    
# Line 669 | Line 673 | void initPhotonEmission (EmissionMap *emap, float numP
673          
674        VCOPY(r.rorg, emap -> photonOrg);
675        VCOPY(r.rop, emap -> photonOrg);
676 <      r.rmax = FHUGE;
676 >      r.rmax = 0;
677        
678        for (t = 0; t < emap -> numTheta; t++) {
679           for (p = 0; p < emap -> numPhi; p++) {
# Line 739 | Line 743 | void emitPhoton (const EmissionMap* emap, RAY* ray)
743     unsigned long i, lo, hi;
744     const EmissionSample* sample = emap -> samples;
745     RREAL du, dv, cosTheta, cosThetaSqr, sinTheta, phi;  
746 <   const OBJREC* mod = objptr(emap -> src -> so -> omod);
746 >   const OBJREC* mod = findmaterial(emap -> src -> so);
747    
748     /* Choose a new origin within current partition for every
749        emitted photon to break up clustering artifacts */
750     photonOrigin [emap -> src -> so -> otype] ((EmissionMap*)emap);
751 +   /* If we have a local glow source with a maximum radius, then
752 +      restrict our photon to the specified distance (otherwise no limit) */
753 +   if (mod -> otype == MAT_GLOW && !(emap -> src -> sflags & SDISTANT)
754 +                && mod -> oargs.farg[3] > FTINY)
755 +      ray -> rmax = mod -> oargs.farg[3];
756 +   else
757 +      ray -> rmax = 0;
758     rayorigin(ray, PRIMARY, NULL, NULL);
748   ray -> rmax = FHUGE;
759    
760     if (!emap -> numSamples) {
761        /* Source is unmodified and has no port, and either local with

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines