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

Comparing ray/src/rt/ambcomp.c (file contents):
Revision 1.11 by greg, Tue Aug 13 12:16:41 1991 UTC vs.
Revision 1.12 by greg, Tue Aug 20 13:32:51 1991 UTC

# Line 67 | Line 67 | RAY  *r;
67          double  phi;
68          register int  i;
69  
70 <        if (rayorigin(&ar, r, AMBIENT, 0.5) < 0)
70 >        if (rayorigin(&ar, r, AMBIENT, AVGREFL) < 0)
71                  return(-1);
72          hlist[0] = r->rno;
73          hlist[1] = dp->t;
# Line 100 | Line 100 | RAY  *r;
100  
101  
102   double
103 < doambient(acol, r, pg, dg)              /* compute ambient component */
103 > doambient(acol, r, wt, pg, dg)          /* compute ambient component */
104   COLOR  acol;
105   RAY  *r;
106 + double  wt;
107   FVECT  pg, dg;
108   {
109          double  b, d;
# Line 116 | Line 117 | FVECT  pg, dg;
117                                          /* initialize color */
118          setcolor(acol, 0.0, 0.0, 0.0);
119                                          /* initialize hemisphere */
120 <        inithemi(&hemi, r);
120 >        inithemi(&hemi, r, wt);
121          ndivs = hemi.nt * hemi.np;
122          if (ndivs == 0)
123                  return(0.0);
124                                          /* set number of super-samples */
125 <        ns = ambssamp * r->rweight + 0.5;
125 >        ns = ambssamp * wt + 0.5;
126          if (ns > 0 || pg != NULL || dg != NULL) {
127                  div = (AMBSAMP *)malloc(ndivs*sizeof(AMBSAMP));
128                  if (div == NULL)
# Line 212 | Line 213 | FVECT  pg, dg;
213                  arad = maxarad;
214          else if (arad < minarad)
215                  arad = minarad;
216 <        arad /= sqrt(r->rweight);
216 >        arad /= sqrt(wt);
217          if (pg != NULL) {               /* clip pos. gradient if too large */
218                  d = 4.0*DOT(pg,pg)*arad*arad;
219                  if (d > 1.0) {
# Line 229 | Line 230 | oopsy:
230   }
231  
232  
233 < inithemi(hp, r)                 /* initialize sampling hemisphere */
233 > inithemi(hp, r, wt)             /* initialize sampling hemisphere */
234   register AMBHEMI  *hp;
235   RAY  *r;
236 + double  wt;
237   {
238          register int  i;
239                                          /* set number of divisions */
240 <        hp->nt = sqrt(ambdiv * r->rweight / PI) + 0.5;
240 >        hp->nt = sqrt(ambdiv * wt / PI) + 0.5;
241          hp->np = PI * hp->nt;
242                                          /* make axes */
243          VCOPY(hp->uz, r->ron);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines