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.17 by greg, Sat Feb 19 23:42:09 2011 UTC vs.
Revision 2.20 by greg, Mon Apr 11 03:47:46 2011 UTC

# Line 269 | Line 269 | SDclipName(char *res, const char *fname)
269  
270   /* Initialize an unused BSDF struct (simply clears to zeroes) */
271   void
272 < SDclearBSDF(SDData *sd)
272 > SDclearBSDF(SDData *sd, const char *fname)
273   {
274 <        if (sd != NULL)
275 <                memset(sd, 0, sizeof(SDData));
274 >        if (sd == NULL)
275 >                return;
276 >        memset(sd, 0, sizeof(SDData));
277 >        if (fname == NULL)
278 >                return;
279 >        SDclipName(sd->name, fname);
280   }
281  
282   /* Free data associated with BSDF struct */
# Line 451 | Line 455 | SDmultiSamp(double t[], int n, double randX)
455          bitmask_t       ndx, coord[MS_MAXDIM];
456          
457          while (n > MS_MAXDIM)           /* punt for higher dimensions */
458 <                t[--n] = drand48();
458 >                t[--n] = rand()*(1./(RAND_MAX+.5));
459          nBits = (8*sizeof(bitmask_t) - 1) / n;
460          ndx = randX * (double)((bitmask_t)1 << (nBits*n));
461                                          /* get coordinate on Hilbert curve */
# Line 459 | Line 463 | SDmultiSamp(double t[], int n, double randX)
463                                          /* convert back to [0,1) range */
464          scale = 1. / (double)((bitmask_t)1 << nBits);
465          while (n--)
466 <                t[n] = scale * ((double)coord[n] + drand48());
466 >                t[n] = scale * ((double)coord[n] + rand()*(1./(RAND_MAX+.5)));
467   }
468  
469   #undef MS_MAXDIM

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines