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.16 by rschregle, Mon Jun 11 12:46:51 2018 UTC vs.
Revision 2.17 by greg, Mon Jun 25 20:49:10 2018 UTC

# Line 1428 | Line 1428 | static int pattexPhotonScatter (OBJREC *mat, RAY *rayI
1428   static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
1429   /* Generate new photon ray for BSDF modifier and recurse. */
1430   {
1431 +   int      hasthick = (mat->otype == MAT_BSDF);
1432     int      hitFront;
1433     SDError  err;
1434     SDValue  bsdfVal;
# Line 1443 | Line 1444 | static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
1444    
1445     /* Following code adapted from m_bsdf() */
1446     /* Check arguments */
1447 <   if (mat -> oargs.nsargs < 6 || mat -> oargs.nfargs > 9 ||
1447 >   if (mat -> oargs.nsargs < hasthick+5 || mat -> oargs.nfargs > 9 ||
1448         mat -> oargs.nfargs % 3)
1449        objerror(mat, USER, "bad # arguments");
1450        
1451     hitFront = (rayIn -> rod > 0);
1452  
1453     /* Load cal file */
1454 <   mf = getfunc(mat, 5, 0x1d, 1);
1454 >   mf = hasthick ? getfunc(mat, 5, 0x1d, 1) : getfunc(mat, 4, 0xe, 1);
1455  
1456     /* Get thickness */
1457 <   nd.thick = evalue(mf -> ep [0]);
1458 <   if ((-FTINY <= nd.thick) & (nd.thick <= FTINY))
1459 <      nd.thick = .0;
1457 >   nd.thick = 0;
1458 >   if (hasthick) {
1459 >        nd.thick = evalue(mf -> ep [0]);
1460 >        if ((-FTINY <= nd.thick) & (nd.thick <= FTINY))
1461 >                nd.thick = .0;
1462 >   }
1463  
1464     /* Get BSDF data */
1465 <   nd.sd = loadBSDF(mat -> oargs.sarg [1]);
1465 >   nd.sd = loadBSDF(mat -> oargs.sarg [hasthick]);
1466    
1467     /* Extra diffuse reflectance from material def */
1468     if (hitFront) {
# Line 1496 | Line 1500 | static int bsdfPhotonScatter (OBJREC *mat, RAY *rayIn)
1500     multcolor(nd.tdiff, rayIn -> pcol);
1501  
1502     /* Get up vector & xform to world coords */
1503 <   upvec [0] = evalue(mf -> ep [1]);
1504 <   upvec [1] = evalue(mf -> ep [2]);
1505 <   upvec [2] = evalue(mf -> ep [3]);
1503 >   upvec [0] = evalue(mf -> ep [hasthick+0]);
1504 >   upvec [1] = evalue(mf -> ep [hasthick+1]);
1505 >   upvec [2] = evalue(mf -> ep [hasthick+2]);
1506    
1507     if (mf -> fxp != &unitxf) {
1508        multv3(upvec, upvec, mf -> fxp -> xfm);
# Line 1703 | Line 1707 | void initPhotonScatterFuncs ()
1707              photonScatter [TEX_DATA] = pattexPhotonScatter;
1708              
1709     photonScatter [MOD_ALIAS] = aliasPhotonScatter;
1710 <   photonScatter [MAT_BSDF] = bsdfPhotonScatter;
1710 >   photonScatter [MAT_BSDF] =
1711 >      photonScatter [MAT_SBSDF] = bsdfPhotonScatter;
1712   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines