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.6 by greg, Tue Jun 26 09:00:10 1990 UTC vs.
Revision 1.10 by greg, Fri May 10 08:51:04 1991 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1986 Regents of the University of California */
1 > /* Copyright (c) 1991 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 129 | Line 129 | register OBJREC  *m;
129   register RAY  *r;
130   {
131          NORMDAT  nd;
132 +        double  transtest, transdist;
133          double  dtmp;
134          COLOR  ctmp;
135          register int  i;
# Line 155 | Line 156 | register RAY  *r;
156          nd.pdot = raynormal(nd.pnorm, r);       /* perturb normal */
157          multcolor(nd.mcolor, r->pcol);          /* modify material color */
158          r->rt = r->rot;                         /* default ray length */
159 +        transtest = 0;
160                                                  /* get specular component */
161          nd.rspec = m->oargs.farg[3];
162  
# Line 181 | Line 183 | register RAY  *r;
183                                  rayvalue(&lr);
184                                  multcolor(lr.rcol, nd.scolor);
185                                  addcolor(r->rcol, lr.rcol);
184                                if (nd.rspec > 0.5 && m->omod == OVOID)
185                                        r->rt = r->rot + lr.rt;
186                          }
187                  }
188          }
# Line 197 | Line 197 | register RAY  *r;
197          if (nd.tspec > FTINY && nd.alpha2 <= FTINY) {
198                  RAY  lr;
199                  if (rayorigin(&lr, r, TRANS, nd.tspec) == 0) {
200 <                        VCOPY(lr.rdir, r->rdir);
200 >                        if (DOT(r->pert,r->pert) > FTINY*FTINY) {
201 >                                for (i = 0; i < 3; i++) /* perturb direction */
202 >                                        lr.rdir[i] = r->rdir[i] -
203 >                                                        .75*r->pert[i];
204 >                                normalize(lr.rdir);
205 >                        } else {
206 >                                VCOPY(lr.rdir, r->rdir);
207 >                                transtest = 2;
208 >                        }
209                          rayvalue(&lr);
210                          scalecolor(lr.rcol, nd.tspec);
211 +                        multcolor(lr.rcol, nd.mcolor);  /* modified by color */
212                          addcolor(r->rcol, lr.rcol);
213 <                        if (nd.tspec > .5)
214 <                                r->rt = r->rot + lr.rt;
213 >                        transtest *= bright(lr.rcol);
214 >                        transdist = r->rot + lr.rt;
215                  }
216          }
217          if (r->crtype & SHADOW)                 /* the rest is shadow */
# Line 235 | Line 244 | register RAY  *r;
244          }
245                                          /* add direct component */
246          direct(r, dirnorm, &nd);
247 +                                        /* check distance */
248 +        if (transtest > bright(r->rcol))
249 +                r->rt = transdist;
250   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines