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

Comparing ray/src/rt/normal.c (file contents):
Revision 1.13 by greg, Wed Oct 30 10:59:42 1991 UTC vs.
Revision 1.14 by greg, Wed Oct 30 14:53:55 1991 UTC

# Line 38 | Line 38 | extern double  exp();
38  
39   typedef struct {
40          OBJREC  *mp;            /* material pointer */
41        RAY  *pr;               /* intersected ray */
41          COLOR  mcolor;          /* color of this material */
42          COLOR  scolor;          /* color of specular component */
43          FVECT  vrefl;           /* vector in direction of reflected ray */
44 +        FVECT  prdir;           /* vector in transmitted direction */
45          double  alpha2;         /* roughness squared times 2 */
46          double  rdiff, rspec;   /* reflected specular, diffuse */
47          double  trans;          /* transmissivity */
# Line 113 | Line 113 | double  omega;                 /* light source size */
113                                                  /* roughness + source */
114                  dtmp = np->alpha2 + omega/(2.0*PI);
115                                                  /* gaussian */
116 <                dtmp = exp((DOT(np->pr->rdir,ldir)-1.)/dtmp)/(2.*PI)/dtmp;
116 >                dtmp = exp((DOT(np->prdir,ldir)-1.)/dtmp)/(2.*PI)/dtmp;
117                                                  /* worth using? */
118                  if (dtmp > FTINY) {
119                          copycolor(ctmp, np->mcolor);
# Line 141 | Line 141 | register RAY  *r;
141          if (r->crtype & SHADOW && m->otype != MAT_TRANS)
142                  return;
143          nd.mp = m;
144        nd.pr = r;
144                                                  /* get material color */
145          setcolor(nd.mcolor, m->oargs.farg[0],
146                             m->oargs.farg[1],
# Line 193 | Line 192 | register RAY  *r;
192                  nd.trans = m->oargs.farg[5]*(1.0 - nd.rspec);
193                  nd.tspec = nd.trans * m->oargs.farg[6];
194                  nd.tdiff = nd.trans - nd.tspec;
195 +                if (r->crtype & SHADOW || DOT(r->pert,r->pert) <= FTINY*FTINY) {
196 +                        VCOPY(nd.prdir, r->rdir);
197 +                        transtest = 2;
198 +                } else {
199 +                        for (i = 0; i < 3; i++)         /* perturb direction */
200 +                                nd.prdir[i] = r->rdir[i] - .75*r->pert[i];
201 +                        normalize(nd.prdir);
202 +                }
203          } else
204                  nd.tdiff = nd.tspec = nd.trans = 0.0;
205                                                  /* transmitted ray */
206          if (nd.tspec > FTINY && nd.alpha2 <= FTINY) {
207                  RAY  lr;
208                  if (rayorigin(&lr, r, TRANS, nd.tspec) == 0) {
209 <                        if (!(r->crtype & SHADOW) &&
203 <                                        DOT(r->pert,r->pert) > FTINY*FTINY) {
204 <                                for (i = 0; i < 3; i++) /* perturb direction */
205 <                                        lr.rdir[i] = r->rdir[i] -
206 <                                                        .75*r->pert[i];
207 <                                normalize(lr.rdir);
208 <                        } else {
209 <                                VCOPY(lr.rdir, r->rdir);
210 <                                transtest = 2;
211 <                        }
209 >                        VCOPY(lr.rdir, nd.prdir);
210                          rayvalue(&lr);
211                          scalecolor(lr.rcol, nd.tspec);
212                          multcolor(lr.rcol, nd.mcolor);  /* modified by color */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines