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

Comparing ray/src/rt/glass.c (file contents):
Revision 2.21 by greg, Sat Jan 25 18:27:39 2014 UTC vs.
Revision 2.23 by greg, Tue Feb 24 19:39:26 2015 UTC

# Line 10 | Line 10 | static const char RCSid[] = "$Id$";
10   #include  "ray.h"
11   #include  "otypes.h"
12   #include  "rtotypes.h"
13 + #include  "pmapmat.h"
14  
15   /*
16   *  This definition of glass provides for a quick calculation
# Line 41 | Line 42 | static const char RCSid[] = "$Id$";
42   #define  RINDEX         1.52            /* refractive index of glass */
43  
44  
45 < extern int
45 > int
46   m_glass(                /* color a ray which hit a thin glass surface */
47          OBJREC  *m,
48 <        register RAY  *r
48 >        RAY  *r
49   )
50   {
51          COLOR  mcolor;
# Line 57 | Line 58 | m_glass(               /* color a ray which hit a thin glass surfac
58          double  transtest, transdist;
59          double  mirtest, mirdist;
60          RAY  p;
61 <        register int  i;
61 >        int  i;
62 >
63 >        /* PMAP: skip refracted shadow ray if accounted for in photon map */
64 >   if (shadowRayInPmap(r))
65 >                return(1);
66                                                  /* check arguments */
67          if (m->oargs.nfargs == 3)
68                  rindex = RINDEX;                /* default value of n */
# Line 116 | Line 121 | m_glass(               /* color a ray which hit a thin glass surfac
121                  multcolor(trans, r->pcol);      /* modify by pattern */
122                                                  /* transmitted ray */
123                  if (rayorigin(&p, TRANS, r, trans) == 0) {
124 <                        if (!(r->crtype & SHADOW) && hastexture) {
124 >                        if (!(r->crtype & (SHADOW|AMBIENT)) && hastexture) {
125                                  VSUM(p.rdir, r->rdir, r->pert, 2.*(1.-rindex));
126                                  if (normalize(p.rdir) == 0.0) {
127                                          objerror(m, WARNING, "bad perturbation");
# Line 151 | Line 156 | m_glass(               /* color a ray which hit a thin glass surfac
156                  rayvalue(&p);
157                  multcolor(p.rcol, p.rcoef);
158                  addcolor(r->rcol, p.rcol);
159 <                if (!hastexture && r->ro != NULL && isflat(r->ro->otype)) {
159 >                if (r->ro != NULL && isflat(r->ro->otype) &&
160 >                                !hastexture | (r->crtype & AMBIENT)) {
161                          mirtest = 2.0*bright(p.rcol);
162                          mirdist = r->rot + p.rt;
163                  }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines