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.8 by greg, Tue May 7 17:45:49 1991 UTC vs.
Revision 1.12 by greg, Mon Aug 12 08:20:55 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 154 | Line 155 | register RAY  *r;
155          raytexture(r, m->omod);
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 */
158 >        transtest = 0;
159                                                  /* get specular component */
160          nd.rspec = m->oargs.farg[3];
161  
# Line 195 | Line 196 | register RAY  *r;
196          if (nd.tspec > FTINY && nd.alpha2 <= FTINY) {
197                  RAY  lr;
198                  if (rayorigin(&lr, r, TRANS, nd.tspec) == 0) {
199 <                        for (i = 0; i < 3; i++)         /* perturb direction */
200 <                                lr.rdir[i] = r->rdir[i] - .75*r->pert[i];
201 <                        normalize(lr.rdir);
199 >                        if (!(r->crtype & SHADOW) &&
200 >                                        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 236 | 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