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

Comparing ray/src/rt/dielectric.c (file contents):
Revision 2.24 by greg, Sat May 10 17:43:01 2014 UTC vs.
Revision 2.29 by greg, Tue Nov 13 19:58:33 2018 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   #ifdef  DISPERSE
16   #include  "source.h"
# Line 50 | Line 51 | static double mylog(double  x);
51  
52   #define  MINCOS         0.997           /* minimum dot product for dispersion */
53  
53
54   static double
55   mylog(          /* special log for extinction coefficients */
56          double  x
# Line 74 | Line 74 | m_dielectric(  /* color a ray which hit a dielectric in
74          COLOR  ctrans;
75          COLOR  talb;
76          int  hastexture;
77        double  transdist=0, transtest=0;
78        double  mirdist=0, mirtest=0;
77          int     flatsurface;
78          double  refl, trans;
79          FVECT  dnorm;
# Line 83 | Line 81 | m_dielectric(  /* color a ray which hit a dielectric in
81          RAY  p;
82          int  i;
83  
84 +        /* PMAP: skip refracted shadow or ambient ray if accounted for in
85 +           photon map */
86 +        if (shadowRayInPmap(r) || ambRayInPmap(r))
87 +                return(1);
88 +        
89          if (m->oargs.nfargs != (m->otype==MAT_DIELECTRIC ? 5 : 8))
90                  objerror(m, USER, "bad arguments");
91  
# Line 201 | Line 204 | m_dielectric(  /* color a ray which hit a dielectric in
204                                                  /* virtual distance */
205                                  if (flatsurface ||
206                                          (1.-FTINY <= nratio) &
207 <                                                (nratio <= 1.+FTINY)) {
208 <                                        transtest = 2*bright(p.rcol);
206 <                                        transdist = r->rot + p.rt;
207 <                                }
207 >                                                (nratio <= 1.+FTINY))
208 >                                        r->rxt = r->rot + raydistance(&p);
209                          }
210                  }
211          }
# Line 222 | Line 223 | m_dielectric(  /* color a ray which hit a dielectric in
223                  rayvalue(&p);                   /* reflected ray value */
224  
225                  multcolor(p.rcol, p.rcoef);     /* color contribution */
226 +                copycolor(r->mcol, p.rcol);
227                  addcolor(r->rcol, p.rcol);
228                                                  /* virtual distance */
229 <                if (flatsurface) {
230 <                        mirtest = 2*bright(p.rcol);
229 <                        mirdist = r->rot + p.rt;
230 <                }
229 >                if (flatsurface)
230 >                        r->rmt = r->rot + raydistance(&p);
231          }
232                                /* check distance to return */
233        d1 = bright(r->rcol);
234        if (transtest > d1)
235                r->rt = transdist;
236        else if (mirtest > d1)
237                r->rt = mirdist;
232                                  /* rayvalue() computes absorption */
233          return(1);
234   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines