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.2 by greg, Wed Jan 15 10:36:42 1992 UTC vs.
Revision 2.3 by greg, Wed Mar 4 16:52:13 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 + }
64 +
65 +
66   setambient(afile)                       /* initialize calculation */
67   char  *afile;
68   {
69          long  ftell();
70          AMBVAL  amb;
71 <
72 <        maxarad = thescene.cusize / 2.0;                /* maximum radius */
73 <                                                        /* minimum radius */
58 <        minarad = ambres > 0 ? thescene.cusize/ambres : 0.0;
59 <
60 <                                        /* open ambient file */
71 >                                                /* init ambient limits */
72 >        setambres(ambres);
73 >                                                /* open ambient file */
74          if (afile != NULL)
75                  if ((ambfp = fopen(afile, "r+")) != NULL) {
76                          while (fread((char *)&amb,sizeof(AMBVAL),1,ambfp) == 1)

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines