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

Comparing ray/src/common/bsdf_t.c (file contents):
Revision 3.21 by greg, Mon Aug 22 05:48:39 2011 UTC vs.
Revision 3.23 by greg, Mon Aug 22 18:21:05 2011 UTC

# Line 26 | Line 26 | typedef int    SDtreCallback(float val, const double *cmi
26  
27                                          /* reference width maximum (1.0) */
28   static const unsigned   iwbits = sizeof(unsigned)*4;
29 < static const unsigned   iwmax = (1<<(sizeof(unsigned)*4))-1;
29 > static const unsigned   iwmax = 1<<(sizeof(unsigned)*4);
30                                          /* maximum cumulative value */
31   static const unsigned   cumlmax = ~0;
32                                          /* constant z-vector */
33   static const FVECT      zvec = {.0, .0, 1.};
34 +                                        /* quantization value */
35 + static double           quantum = 1./256.;
36  
37   /* Struct used for our distribution-building callback */
38   typedef struct {
# Line 607 | Line 609 | const SDCDst *
609   SDgetTreCDist(const FVECT inVec, SDComponent *sdc)
610   {
611          const SDTre     *sdt;
612 <        double          inCoord[2], quantum;
612 >        double          inCoord[2];
613          int             i;
614          SDTreCDst       *cd, *cdlast;
615                                          /* check arguments */
# Line 621 | Line 623 | SDgetTreCDist(const FVECT inVec, SDComponent *sdc)
623          } else
624                  return NULL;            /* should be internal error */
625                                          /* quantize to avoid f.p. errors */
624        quantum = SDsmallestLeaf(sdt->st);
626          for (i = sdt->st->ndim - 2; i--; )
627                  inCoord[i] = floor(inCoord[i]/quantum)*quantum + .5*quantum;
628          cdlast = NULL;                  /* check for direction in cache list */
# Line 845 | Line 846 | get_extrema(SDSpectralDF *df)
846          double  stepWidth, dhemi, bmin[4], bmax[4];
847  
848          stepWidth = SDsmallestLeaf(st);
849 +        if (quantum > stepWidth)        /* adjust quantization factor */
850 +                quantum = stepWidth;
851          df->minProjSA = M_PI*stepWidth*stepWidth;
852          if (stepWidth < .03125)
853                  stepWidth = .03125;     /* 1/32 resolution good enough */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines