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.4 by greg, Wed Oct 18 09:01:36 1989 UTC vs.
Revision 1.11 by greg, Thu Jun 13 13:58:18 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  ldot;
133 <        double  omega;
132 >        double  transtest, transdist;
133          double  dtmp;
134          COLOR  ctmp;
135          register int  i;
# Line 156 | 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 +        transtest = 0;
159                                                  /* get specular component */
160          nd.rspec = m->oargs.farg[3];
161  
# Line 196 | 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 <                        VCOPY(lr.rdir, r->rdir);
199 >                        if (DOT(r->pert,r->pert) > FTINY*FTINY) {
200 >                                for (i = 0; i < 3; i++) /* perturb direction */
201 >                                        lr.rdir[i] = r->rdir[i] -
202 >                                                        .75*r->pert[i];
203 >                                normalize(lr.rdir);
204 >                        } else {
205 >                                VCOPY(lr.rdir, r->rdir);
206 >                                transtest = 2;
207 >                        }
208                          rayvalue(&lr);
209                          scalecolor(lr.rcol, nd.tspec);
210 +                        multcolor(lr.rcol, nd.mcolor);  /* modified by color */
211                          addcolor(r->rcol, lr.rcol);
212 +                        transtest *= bright(lr.rcol);
213 +                        transdist = r->rot + lr.rt;
214                  }
215          }
216          if (r->crtype & SHADOW)                 /* the rest is shadow */
# Line 232 | Line 243 | register RAY  *r;
243          }
244                                          /* add direct component */
245          direct(r, dirnorm, &nd);
246 +                                        /* check distance */
247 +        if (transtest > bright(r->rcol))
248 +                r->rt = transdist;
249   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines