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.5 by greg, Fri May 22 11:38:26 2015 UTC

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

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines