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.7 by rschregle, Wed May 27 17:54:19 2015 UTC vs.
Revision 2.12 by rschregle, Tue Feb 23 12:42:41 2016 UTC

# Line 1 | Line 1
1 + #ifndef lint
2 + static const char RCSid[] = "$Id$";
3 + #endif
4   /*
5     ==================================================================
6     Photon map support routines for scattering by materials.
# Line 8 | Line 11
11     supported by the Swiss National Science Foundation (SNSF, #147053)
12     ==================================================================
13    
11   $Id$
14   */
15  
16  
# Line 976 | Line 978 | static int aliasPhotonScatter (OBJREC *mat, RAY *rayIn
978    
979     /* Straight replacement? */
980     if (!mat -> oargs.nsargs) {
981 <      mat = objptr(mat -> omod);
982 <      photonScatter [mat -> otype] (mat, rayIn);
981 >      /* Skip void modifier! */
982 >      if (mat -> omod != OVOID) {
983 >         mat = objptr(mat -> omod);
984 >         photonScatter [mat -> otype] (mat, rayIn);
985 >      }
986        
987        return 0;
988     }
# Line 1248 | Line 1253 | static int mx_dataPhotonScatter (OBJREC *mat, RAY *ray
1253     if (errno)
1254        objerror(mat, WARNING, "compute error");
1255     else {
1256 <      mat = objptr(mod [pmapRandom(rouletteState) < coef ? 0 : 1]);
1257 <      photonScatter [mat -> otype] (mat, rayIn);
1256 >      OBJECT mxMod = mod [pmapRandom(rouletteState) < coef ? 0 : 1];
1257 >      
1258 >      if (mxMod != OVOID) {
1259 >         mat = objptr(mxMod);
1260 >         photonScatter [mat -> otype] (mat, rayIn);
1261 >      }
1262 >      else {
1263 >         /* Transfer ray if no modifier */
1264 >         RAY rayOut;
1265 >        
1266 >         photonRay(rayIn, &rayOut, PMAP_XFER, NULL);
1267 >         tracePhoton(&rayOut);      
1268 >      }            
1269     }
1270    
1271     return 0;
# Line 1301 | Line 1317 | static int mx_pdataPhotonScatter (OBJREC *mat, RAY *ra
1317     if (errno)
1318        objerror(mat, WARNING, "compute error");
1319     else {
1320 <      mat = objptr(mod [pmapRandom(rouletteState) < coef ? 0 : 1]);
1321 <      photonScatter [mat -> otype] (mat, rayIn);
1320 >      OBJECT mxMod = mod [pmapRandom(rouletteState) < coef ? 0 : 1];
1321 >      
1322 >      if (mxMod != OVOID) {
1323 >         mat = objptr(mxMod);
1324 >         photonScatter [mat -> otype] (mat, rayIn);
1325 >      }
1326 >      else {
1327 >         /* Transfer ray if no modifier */
1328 >         RAY rayOut;
1329 >        
1330 >         photonRay(rayIn, &rayOut, PMAP_XFER, NULL);
1331 >         tracePhoton(&rayOut);      
1332 >      }      
1333     }  
1334    
1335     return 0;
# Line 1341 | Line 1368 | static int mx_funcPhotonScatter (OBJREC *mat, RAY *ray
1368     if (errno)
1369        objerror(mat, WARNING, "compute error");
1370     else {        
1371 <      mat = objptr(mod [pmapRandom(rouletteState) < coef ? 0 : 1]);
1372 <      photonScatter [mat -> otype] (mat, rayIn);
1371 >      OBJECT mxMod = mod [pmapRandom(rouletteState) < coef ? 0 : 1];
1372 >      
1373 >      if (mxMod != OVOID) {
1374 >         mat = objptr(mxMod);
1375 >         photonScatter [mat -> otype] (mat, rayIn);
1376 >      }
1377 >      else {
1378 >         /* Transfer ray if no modifier */
1379 >         RAY rayOut;
1380 >        
1381 >         photonRay(rayIn, &rayOut, PMAP_XFER, NULL);
1382 >         tracePhoton(&rayOut);      
1383 >      }
1384     }
1385    
1386     return 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines