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 1.6 by greg, Tue Aug 8 17:31:23 1989 UTC vs.
Revision 1.7 by greg, Tue Sep 5 09:46:17 1989 UTC

# Line 21 | Line 21 | static char SCCSid[] = "$SunId$ LBL";
21  
22   #define  OCTSCALE       0.5     /* ceil((valid rad.)/(cube size)) */
23  
24 #define  WDONE          4       /* stop if wsum/wmin is at or above */
25
24   extern CUBE  thescene;          /* contains space boundaries */
25  
26   extern COLOR  ambval;           /* global ambient component */
# Line 166 | Line 164 | double  s;
164          int  i;
165          register int  j;
166          register AMBVAL  *av;
167 <
167 >                                        /* do this node */
168          wsum = 0.0;
171                                        /* check children first */
172        if (at->kid != NULL) {
173                s *= 0.5;
174                for (i = 0; i < 8; i++) {
175                        for (j = 0; j < 3; j++) {
176                                ck0[j] = c0[j];
177                                if (1<<j & i)
178                                        ck0[j] += s;
179                                if (r->rop[j] < ck0[j] - OCTSCALE*s)
180                                        break;
181                                if (r->rop[j] > ck0[j] + (1.0+OCTSCALE)*s)
182                                        break;
183                        }
184                        if (j == 3)
185                                wsum += sumambient(acol, r, at->kid+i, ck0, s);
186                }
187                if (wsum*ambacc >= WDONE)
188                        return(wsum);           /* close enough */
189        }
190                                        /* check this node */
169          for (av = at->alist; av != NULL; av = av->next) {
170                  /*
171                   *  Ray strength test.
# Line 225 | Line 203 | double  s;
203                   *  Jittering final test reduces image artifacts.
204                   */
205                  wt = sqrt(e1) + sqrt(e2);
206 <                wt *= 0.9 + 0.2*frandom();
206 >                wt *= .9 + .2*frandom();
207                  if (wt > ambacc)
208                          continue;
209                  if (wt <= 1e-3)
# Line 236 | Line 214 | double  s;
214                  copycolor(ct, av->val);
215                  scalecolor(ct, wt);
216                  addcolor(acol, ct);
217 +        }
218 +        if (at->kid == NULL)
219 +                return(wsum);
220 +                                        /* do children */
221 +        s *= 0.5;
222 +        for (i = 0; i < 8; i++) {
223 +                for (j = 0; j < 3; j++) {
224 +                        ck0[j] = c0[j];
225 +                        if (1<<j & i)
226 +                                ck0[j] += s;
227 +                        if (r->rop[j] < ck0[j] - OCTSCALE*s)
228 +                                break;
229 +                        if (r->rop[j] > ck0[j] + (1.0+OCTSCALE)*s)
230 +                                break;
231 +                }
232 +                if (j == 3)
233 +                        wsum += sumambient(acol, r, at->kid+i, ck0, s);
234          }
235          return(wsum);
236   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines