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.9 by greg, Tue Sep 1 16:27:52 2015 UTC vs.
Revision 2.10 by rschregle, Tue Sep 29 18:16:34 2015 UTC

# Line 1250 | Line 1250 | static int mx_dataPhotonScatter (OBJREC *mat, RAY *ray
1250     if (errno)
1251        objerror(mat, WARNING, "compute error");
1252     else {
1253 <      mat = objptr(mod [pmapRandom(rouletteState) < coef ? 0 : 1]);
1254 <      photonScatter [mat -> otype] (mat, rayIn);
1253 >      OBJECT mxMod = mod [pmapRandom(rouletteState) < coef ? 0 : 1];
1254 >      
1255 >      if (mxMod != OVOID) {
1256 >         mat = objptr(mxMod);
1257 >         photonScatter [mat -> otype] (mat, rayIn);
1258 >      }
1259 >      else {
1260 >         /* Transfer ray if no modifier */
1261 >         RAY rayOut;
1262 >        
1263 >         photonRay(rayIn, &rayOut, PMAP_XFER, NULL);
1264 >         tracePhoton(&rayOut);      
1265 >      }            
1266     }
1267    
1268     return 0;
# Line 1303 | Line 1314 | static int mx_pdataPhotonScatter (OBJREC *mat, RAY *ra
1314     if (errno)
1315        objerror(mat, WARNING, "compute error");
1316     else {
1317 <      mat = objptr(mod [pmapRandom(rouletteState) < coef ? 0 : 1]);
1318 <      photonScatter [mat -> otype] (mat, rayIn);
1317 >      OBJECT mxMod = mod [pmapRandom(rouletteState) < coef ? 0 : 1];
1318 >      
1319 >      if (mxMod != OVOID) {
1320 >         mat = objptr(mxMod);
1321 >         photonScatter [mat -> otype] (mat, rayIn);
1322 >      }
1323 >      else {
1324 >         /* Transfer ray if no modifier */
1325 >         RAY rayOut;
1326 >        
1327 >         photonRay(rayIn, &rayOut, PMAP_XFER, NULL);
1328 >         tracePhoton(&rayOut);      
1329 >      }      
1330     }  
1331    
1332     return 0;
# Line 1343 | Line 1365 | static int mx_funcPhotonScatter (OBJREC *mat, RAY *ray
1365     if (errno)
1366        objerror(mat, WARNING, "compute error");
1367     else {        
1368 <      mat = objptr(mod [pmapRandom(rouletteState) < coef ? 0 : 1]);
1369 <      photonScatter [mat -> otype] (mat, rayIn);
1368 >      OBJECT mxMod = mod [pmapRandom(rouletteState) < coef ? 0 : 1];
1369 >      
1370 >      if (mxMod != OVOID) {
1371 >         mat = objptr(mxMod);
1372 >         photonScatter [mat -> otype] (mat, rayIn);
1373 >      }
1374 >      else {
1375 >         /* Transfer ray if no modifier */
1376 >         RAY rayOut;
1377 >        
1378 >         photonRay(rayIn, &rayOut, PMAP_XFER, NULL);
1379 >         tracePhoton(&rayOut);      
1380 >      }
1381     }
1382    
1383     return 0;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines