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.20 by greg, Wed Aug 7 05:10:09 2013 UTC vs.
Revision 2.25 by greg, Thu May 21 13:54:59 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 or ambient ray if accounted for in
64 >           photon map */
65 >        if (shadowRayInPmap(r))
66 >                return(1);
67                                                  /* check arguments */
68          if (m->oargs.nfargs == 3)
69                  rindex = RINDEX;                /* default value of n */
# Line 65 | Line 71 | m_glass(               /* color a ray which hit a thin glass surfac
71                  rindex = m->oargs.farg[3];      /* use their value */
72          else
73                  objerror(m, USER, "bad arguments");
74 +                                                /* check back face visibility */
75 +        if (!backvis && r->rod <= 0.0) {
76 +                raytrans(r);
77 +                return(1);
78 +        }
79                                                  /* check transmission */
80          setcolor(mcolor, m->oargs.farg[0], m->oargs.farg[1], m->oargs.farg[2]);
81          if ((hastrans = (intens(mcolor) > 1e-15))) {
# Line 111 | Line 122 | m_glass(               /* color a ray which hit a thin glass surfac
122                  multcolor(trans, r->pcol);      /* modify by pattern */
123                                                  /* transmitted ray */
124                  if (rayorigin(&p, TRANS, r, trans) == 0) {
125 <                        if (!(r->crtype & SHADOW) && hastexture) {
125 >                        if (!(r->crtype & (SHADOW|AMBIENT)) && hastexture) {
126                                  VSUM(p.rdir, r->rdir, r->pert, 2.*(1.-rindex));
127                                  if (normalize(p.rdir) == 0.0) {
128                                          objerror(m, WARNING, "bad perturbation");
# Line 146 | Line 157 | m_glass(               /* color a ray which hit a thin glass surfac
157                  rayvalue(&p);
158                  multcolor(p.rcol, p.rcoef);
159                  addcolor(r->rcol, p.rcol);
160 <                if (!hastexture && r->ro != NULL && isflat(r->ro->otype)) {
160 >                if (r->ro != NULL && isflat(r->ro->otype) &&
161 >                                !hastexture | (r->crtype & AMBIENT)) {
162                          mirtest = 2.0*bright(p.rcol);
163                          mirdist = r->rot + p.rt;
164                  }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines