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

Comparing ray/src/common/bsdf.c (file contents):
Revision 2.38 by greg, Sun Mar 4 23:28:34 2012 UTC vs.
Revision 2.41 by greg, Sat Jun 23 16:47:39 2012 UTC

# Line 92 | Line 92 | SDloadGeometry(SDData *sd, ezxml_t wdb)
92  
93          if (wdb == NULL)                /* no geometry section? */
94                  return SDEnone;
95 +        if ((geom = ezxml_child(wdb, "Name")) != NULL) {
96 +                strncpy(sd->matn, ezxml_txt(geom), SDnameLn);
97 +                if (sd->matn[SDnameLn-1])
98 +                        strcpy(sd->matn+(SDnameLn-4), "...");
99 +        }
100 +        if ((geom = ezxml_child(wdb, "Manufacturer")) != NULL) {
101 +                strncpy(sd->makr, ezxml_txt(geom), SDnameLn);
102 +                if (sd->makr[SDnameLn-1])
103 +                        strcpy(sd->makr+(SDnameLn-4), "...");
104 +        }
105          sd->dim[0] = sd->dim[1] = sd->dim[2] = .0;
106          SDerrorDetail[0] = '\0';
107          if ((geom = ezxml_child(wdb, "Width")) != NULL)
# Line 490 | Line 500 | SDmultiSamp(double t[], int n, double randX)
500          unsigned        nBits;
501          double          scale;
502          bitmask_t       ndx, coord[MS_MAXDIM];
503 <        
503 >
504 >        if (n <= 0)                     /* check corner cases */
505 >                return;
506 >        if (randX < 0) randX = 0;
507 >        else if (randX >= 1.) randX = 0.999999999999999;
508 >        if (n == 1) {
509 >                t[0] = randX;
510 >                return;
511 >        }
512          while (n > MS_MAXDIM)           /* punt for higher dimensions */
513                  t[--n] = rand()*(1./(RAND_MAX+.5));
514          nBits = (8*sizeof(bitmask_t) - 1) / n;
# Line 1419 | Line 1437 | r_BSDF_incvec(         /* compute random input vector at give
1437          if (!getBSDF_incvec(v, b, i))
1438                  return(0);
1439          rad = sqrt(getBSDF_incohm(b, i) / PI);
1440 <        multisamp(pert, 3, rv);
1440 >        SDmultiSamp(pert, 3, rv);
1441          for (j = 0; j < 3; j++)
1442                  v[j] += rad*(2.*pert[j] - 1.);
1443          if (xm != NULL)
# Line 1444 | Line 1462 | r_BSDF_outvec(         /* compute random output vector at giv
1462          if (!getBSDF_outvec(v, b, o))
1463                  return(0);
1464          rad = sqrt(getBSDF_outohm(b, o) / PI);
1465 <        multisamp(pert, 3, rv);
1465 >        SDmultiSamp(pert, 3, rv);
1466          for (j = 0; j < 3; j++)
1467                  v[j] += rad*(2.*pert[j] - 1.);
1468          if (xm != NULL)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines