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

Comparing ray/src/rt/pmapmat.c (file contents):
Revision 2.12 by rschregle, Tue Feb 23 12:42:41 2016 UTC vs.
Revision 2.13 by rschregle, Tue May 17 17:39:47 2016 UTC

# Line 106 | Line 106 | void photonRay (const RAY *rayIn, RAY *rayOut,
106   {
107     rayorigin(rayOut, rayOutType, rayIn, NULL);
108    
109 <   /* Transfer flux */
110 <   copycolor(rayOut -> rcol, rayIn -> rcol);
111 <  
112 <   /* Copy caustic flag & direction for transferred rays */
113 <   if (rayOutType == PMAP_XFER) {
114 <      /* rayOut -> rtype |= rayIn -> rtype & SPECULAR; */
115 <      rayOut -> rtype |= rayIn -> rtype;
116 <      VCOPY(rayOut -> rdir, rayIn -> rdir);
117 <   }
118 <   else if (fluxAtten) {
119 <      /* Attenuate and normalise flux for scattered rays */
120 <      multcolor(rayOut -> rcol, fluxAtten);
121 <      colorNorm(rayOut -> rcol);
122 <   }
109 >   if (rayIn) {
110 >      /* Transfer flux */
111 >      copycolor(rayOut -> rcol, rayIn -> rcol);
112 >      
113 >      /* Copy caustic flag & direction for transferred rays */
114 >      if (rayOutType == PMAP_XFER) {
115 >         /* rayOut -> rtype |= rayIn -> rtype & SPECULAR; */
116 >         rayOut -> rtype |= rayIn -> rtype;
117 >         VCOPY(rayOut -> rdir, rayIn -> rdir);
118 >      }
119 >      else if (fluxAtten) {
120 >         /* Attenuate and normalise flux for scattered rays */
121 >         multcolor(rayOut -> rcol, fluxAtten);
122 >         colorNorm(rayOut -> rcol);
123 >      }
124  
125 <   /* Propagate index of emitting light source */
126 <   rayOut -> rsrc = rayIn -> rsrc;
125 >      /* Propagate index of emitting light source */
126 >      rayOut -> rsrc = rayIn -> rsrc;
127 >   }
128   }
129  
130  
# Line 132 | Line 134 | static void addPhotons (const RAY *r)
134   {
135     if (!r -> rlvl)
136        /* Add direct photon map at primary hitpoint */
137 <      addPhoton(directPmap, r);
137 >      newPhoton(directPmap, r);
138     else {
139        /* Add global or precomputed photon map at indirect hitpoint */
140 <      addPhoton(preCompPmap ? preCompPmap : globalPmap, r);
140 >      newPhoton(preCompPmap ? preCompPmap : globalPmap, r);
141  
142        /* Store caustic photon if specular flag set */
143        if (PMAP_CAUSTICRAY(r))
144 <         addPhoton(causticPmap, r);
144 >         newPhoton(causticPmap, r);
145          
146        /* Store in contribution photon map */
147 <      addPhoton(contribPmap, r);
147 >      newPhoton(contribPmap, r);
148     }
149   }
150  
# Line 979 | Line 981 | static int aliasPhotonScatter (OBJREC *mat, RAY *rayIn
981     /* Straight replacement? */
982     if (!mat -> oargs.nsargs) {
983        /* Skip void modifier! */
984 <      if (mat -> omod != OVOID) {
984 >      if (mat -> omod != OVOID) {  
985           mat = objptr(mat -> omod);
986           photonScatter [mat -> otype] (mat, rayIn);
987        }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines