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

Comparing ray/src/rt/ambient.c (file contents):
Revision 2.1 by greg, Tue Nov 12 17:09:42 1991 UTC vs.
Revision 2.4 by greg, Fri Apr 10 16:14:34 1992 UTC

# Line 47 | Line 47 | static FILE  *ambfp = NULL;    /* ambient file pointer */
47   #define  newambtree()   (AMBTREE *)calloc(8, sizeof(AMBTREE))
48  
49  
50 + setambres(ar)                           /* set ambient resolution */
51 + int  ar;
52 + {
53 +                                                /* set min & max radii */
54 +        if (ar <= 0) {
55 +                minarad = 0.0;
56 +                maxarad = thescene.cusize / 2.0;
57 +        } else {
58 +                minarad = thescene.cusize / ar;
59 +                maxarad = 16.0 * minarad;               /* heuristic */
60 +                if (maxarad > thescene.cusize / 2.0)
61 +                        maxarad = thescene.cusize / 2.0;
62 +        }
63 +        if (maxarad <= FTINY)
64 +                maxarad = .001;
65 + }
66 +
67 +
68   setambient(afile)                       /* initialize calculation */
69   char  *afile;
70   {
71          long  ftell();
72          AMBVAL  amb;
73 <
74 <        maxarad = thescene.cusize / 2.0;                /* maximum radius */
75 <                                                        /* minimum radius */
58 <        minarad = ambres > 0 ? thescene.cusize/ambres : 0.0;
59 <
60 <                                        /* open ambient file */
73 >                                                /* init ambient limits */
74 >        setambres(ambres);
75 >                                                /* open ambient file */
76          if (afile != NULL)
77                  if ((ambfp = fopen(afile, "r+")) != NULL) {
78                          while (fread((char *)&amb,sizeof(AMBVAL),1,ambfp) == 1)
# Line 192 | Line 207 | double  s;
207                   *  Jittering final test reduces image artifacts.
208                   */
209                  wt = sqrt(e1) + sqrt(e2);
210 <                wt *= .9 + .2*frandom();
210 >                wt *= .9 + .2*urand(9015+samplendx);
211                  if (wt > ambacc)
212                          continue;
213                  if (wt <= 1e-3)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines