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.22 by greg, Mon Oct 25 22:57:45 2010 UTC vs.
Revision 2.26 by rschregle, Wed May 20 13:12:06 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   #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  
54 <
55 < static double
54 > static
55 > double
56   mylog(          /* special log for extinction coefficients */
57          double  x
58   )
# Line 64 | Line 65 | mylog(         /* special log for extinction coefficients */
65   }
66  
67  
68 < extern int
68 > int
69   m_dielectric(   /* color a ray which hit a dielectric interface */
70          OBJREC  *m,
71 <        register RAY  *r
71 >        RAY  *r
72   )
73   {
74          double  cos1, cos2, nratio;
75          COLOR  ctrans;
76          COLOR  talb;
77          int  hastexture;
78 <        double  transdist, transtest=0;
79 <        double  mirdist, mirtest=0;
78 >        double  transdist=0, transtest=0;
79 >        double  mirdist=0, mirtest=0;
80          int     flatsurface;
81          double  refl, trans;
82          FVECT  dnorm;
83          double  d1, d2;
84          RAY  p;
85 <        register int  i;
85 >        int  i;
86  
87 +        /* PMAP: skip refracted shadow or ambient ray if accounted for in
88 +           photon map */
89 +        if (shadowRayInPmap(r) || ambRayInPmap(r))
90 +                return(1);
91 +        
92          if (m->oargs.nfargs != (m->otype==MAT_DIELECTRIC ? 5 : 8))
93                  objerror(m, USER, "bad arguments");
94  
# Line 94 | Line 100 | m_dielectric(  /* color a ray which hit a dielectric in
100                  VCOPY(dnorm, r->ron);
101                  cos1 = r->rod;
102          }
103 <        flatsurface = !hastexture && r->ro != NULL && isflat(r->ro->otype);
103 >        flatsurface = r->ro != NULL && isflat(r->ro->otype) &&
104 >                        !hastexture | (r->crtype & AMBIENT);
105  
106                                                  /* index of refraction */
107          if (m->otype == MAT_DIELECTRIC)
# Line 199 | Line 206 | m_dielectric(  /* color a ray which hit a dielectric in
206                                  addcolor(r->rcol, p.rcol);
207                                                  /* virtual distance */
208                                  if (flatsurface ||
209 <                                        (1.-FTINY <= nratio &&
210 <                                                nratio <= 1.+FTINY)) {
209 >                                        (1.-FTINY <= nratio) &
210 >                                                (nratio <= 1.+FTINY)) {
211                                          transtest = 2*bright(p.rcol);
212                                          transdist = r->rot + p.rt;
213                                  }
# Line 380 | Line 387 | disperse(  /* check light sources for dispersion */
387  
388   static int
389   lambda(                 /* compute lambda for material */
390 <        register OBJREC  *m,
390 >        OBJREC  *m,
391          FVECT  v2,
392          FVECT  dv,
393          FVECT  lr

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines