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.18 by rschregle, Fri Aug 7 01:21:13 2020 UTC vs.
Revision 2.20 by rschregle, Fri Apr 9 17:42:34 2021 UTC

# Line 137 | Line 137 | void getPhotonPorts (char **portList)
137  
138  
139   static void setPhotonPortNormal (EmissionMap* emap)
140 < /* Set normal for current photon port partition based on its orientation */
140 > /* Set normal for current photon port partition (if defined) based on its
141 > * orientation */
142   {
142   /* Extract photon port orientation flags, set surface normal as follows:
143      -- Port oriented forwards --> flip surface normal to point
144         outwards, since normal points inwards per mkillum convention)
145      -- Port oriented backwards --> surface normal is NOT flipped,
146         since it already points inwards.
147      -- Port is bidirectionally/bilaterally oriented --> flip normal based
148         on the parity of the current partition emap -> partitionCnt.
149         In this case, photon emission alternates between port front/back
150         faces for consecutive partitions.
151   */
152   int i, portFlags = PMAP_GETPORTFLAGS(emap -> port -> sflags);
143  
144 <   if (
145 <      portFlags == PMAP_PORTFWD ||
146 <      portFlags == PMAP_PORTBI && !(emap -> partitionCnt & 1)
147 <   )
148 <      for (i = 0; i < 3; i++)    
149 <         emap -> ws [i] = -emap -> ws [i];
144 >   int i, portFlags;
145 >  
146 >   if (emap -> port) {
147 >      /* Extract photon port orientation flags, set surface normal as follows:
148 >         -- Port oriented forwards --> flip surface normal to point outwards,
149 >            since normal points inwards per mkillum convention)
150 >         -- Port oriented backwards --> surface normal is NOT flipped, since
151 >            it already points inwards.
152 >         -- Port is bidirectionally/bilaterally oriented --> flip normal based
153 >            on the parity of the current partition emap -> partitionCnt. In
154 >            this case, photon emission alternates between port front/back
155 >            faces for consecutive partitions.
156 >      */  
157 >      portFlags = PMAP_GETPORTFLAGS(emap -> port -> sflags);
158 >
159 >      if (
160 >         portFlags == PMAP_PORTFWD ||
161 >         portFlags == PMAP_PORTBI && !(emap -> partitionCnt & 1)
162 >      )
163 >         for (i = 0; i < 3; i++)    
164 >            emap -> ws [i] = -emap -> ws [i];
165 >   }
166   }
167  
168  
# Line 758 | Line 764 | void initPhotonEmission (EmissionMap *emap, float numP
764           sizeof(EmissionSample) * emap -> numTheta * emap -> numPhi
765        );
766        if (!emap -> samples)
767 <         error(USER, "can't allocate emission PDF");    
767 >         error(USER, "can't allocate emission PDF");
768          
769        VCOPY(r.rorg, emap -> photonOrg);
770        VCOPY(r.rop, emap -> photonOrg);
# Line 887 | Line 893 | void emitPhoton (const EmissionMap* emap, RAY* ray)
893           if (sample -> cdf < du)
894              lo = i + 1;
895        }
896 <      
896 >
897 >      /* Finalise found sample */
898 >      i = (lo + hi) >> 1;
899 >      sample = emap -> samples + i - 1;
900 >
901        /* This is a uniform mapping, mon */
902        cosTheta = (1 -
903           (sample -> theta + pmapRandom(emitState)) *

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines