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.102 by greg, Sun Apr 24 16:21:32 2016 UTC vs.
Revision 2.103 by greg, Tue Nov 1 20:39:39 2016 UTC

# Line 276 | Line 276 | multambient(           /* compute ambient component & multiply
276   {
277          static int  rdepth = 0;                 /* ambient recursion */
278          COLOR   acol, caustic;
279 <        int     ok;
279 >        int     i, ok;
280          double  d, l;
281  
282          /* PMAP: Factor in ambient from photon map, if enabled and ray is
# Line 302 | Line 302 | multambient(           /* compute ambient component & multiply
302                  goto dumbamb;
303  
304          if (ambacc <= FTINY) {                  /* no ambient storage */
305 +                FVECT   uvd[2];
306 +                float   dgrad[2], *dgp = NULL;
307 +
308 +                if (nrm != r->ron && DOT(nrm,r->ron) < 0.9999)
309 +                        dgp = dgrad;            /* compute rotational grad. */
310                  copycolor(acol, aval);
311                  rdepth++;
312                  ok = doambient(acol, r, r->rweight,
313 <                                NULL, NULL, NULL, NULL, NULL);
313 >                                uvd, NULL, NULL, dgp, NULL);
314                  rdepth--;
315                  if (!ok)
316                          goto dumbamb;
317 +                if ((ok > 0) & (dgp != NULL)) { /* apply texture */
318 +                        FVECT   v1;
319 +                        VCROSS(v1, r->ron, nrm);
320 +                        d = 1.0;
321 +                        for (i = 3; i--; )
322 +                                d += v1[i] * (dgp[0]*uvd[0][i] + dgp[1]*uvd[1][i]);
323 +                        if (d >= 0.05)
324 +                                scalecolor(acol, d);
325 +                }
326                  copycolor(aval, acol);
327  
328                  /* PMAP: add in caustic */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines