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.14 by greg, Fri Jun 7 10:04:29 1991 UTC vs.
Revision 1.15 by greg, Thu Jun 13 09:41:15 1991 UTC

# Line 197 | Line 197 | double  s;
197                  else
198                          wt = 1.0 / wt;
199                  wsum += wt;
200 <                copycolor(ct, av->val);
200 >                extambient(ct, av, r->rop, r->ron);
201                  scalecolor(ct, wt);
202                  addcolor(acol, ct);
203          }
# Line 245 | Line 245 | register RAY  *r;
245          avinsert(&amb, &atrunk, thescene.cuorg, thescene.cusize);
246          avsave(&amb);                           /* write to file */
247          return(amb.rad);
248 + }
249 +
250 +
251 + extambient(cr, ap, pv, nv)              /* extrapolate value at pv, nv */
252 + COLOR  cr;
253 + register AMBVAL  *ap;
254 + FVECT  pv, nv;
255 + {
256 +        FVECT  v1, v2;
257 +        register int  i;
258 +        double  d;
259 +
260 +        d = 1.0;                        /* zeroeth order */
261 +                                        /* gradient due to translation */
262 +        for (i = 0; i < 3; i++)
263 +                d += ap->gpos[i]*(pv[i]-ap->pos[i]);
264 +                                        /* gradient due to rotation */
265 +        VCOPY(v1, ap->dir);
266 +        fcross(v2, v1, nv);
267 +        d += DOT(ap->gdir, v2);
268 +        if (d <= 0.0) {
269 +                setcolor(cr, 0.0, 0.0, 0.0);
270 +                return;
271 +        }
272 +        copycolor(cr, ap->val);
273 +        scalecolor(cr, d);
274   }
275  
276  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines