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

Comparing ray/src/rt/raytrace.c (file contents):
Revision 2.16 by greg, Tue Dec 20 20:18:22 1994 UTC vs.
Revision 2.17 by greg, Wed Dec 21 09:10:23 1994 UTC

# Line 34 | Line 34 | OBJREC  Lamb = {
34          {0, 5, NULL, Lambfa}, NULL,
35   };                                      /* a Lambertian surface */
36  
37 < static OBJREC  Aftplane;                /* aft clipping plane object */
37 > OBJREC  Aftplane;                       /* aft clipping plane object */
38  
39   static int  raymove(), checkset(), checkhit();
40  
# Line 81 | Line 81 | register RAY  *r;
81   {
82          r->rno = raynum++;
83          r->newcset = r->clipset;
84 <        if (r->rmax > FTINY) {
85 <                r->ro = &Aftplane;
86 <                r->rot = r->rmax;
87 <                r->rop[0] = r->rorg[0] + r->rot*r->rdir[0];
88 <                r->rop[1] = r->rorg[1] + r->rot*r->rdir[1];
89 <                r->rop[2] = r->rorg[2] + r->rot*r->rdir[2];
90 <        } else {
91 <                r->ro = NULL;
92 <                r->rot = FHUGE;
93 <        }
84 >        r->ro = NULL;
85 >        r->rot = FHUGE;
86          r->pert[0] = r->pert[1] = r->pert[2] = 0.0;
87          setcolor(r->pcol, 1.0, 1.0, 1.0);
88          setcolor(r->rcol, 0.0, 0.0, 0.0);
# Line 139 | Line 131 | register RAY  *r;
131  
132          if (rayorigin(&tr, r, TRANS, 1.0) == 0) {
133                  VCOPY(tr.rdir, r->rdir);
134 +                if (r->rmax > FTINY)
135 +                        tr.rmax = r->rmax - r->rot;
136                  rayvalue(&tr);
137                  copycolor(r->rcol, tr.rcol);
138                  r->rt = r->rot + tr.rt;
# Line 367 | Line 361 | register CUBE  *scene;
361          }
362          if (sflags == 0)
363                  error(CONSISTENCY, "zero ray direction in localhit");
364 +                                        /* start off assuming nothing hit */
365 +        if (r->rmax > FTINY) {          /* except aft plane if one */
366 +                r->ro = &Aftplane;
367 +                r->rot = r->rmax;
368 +                for (i = 0; i < 3; i++)
369 +                        r->rop[i] = r->rorg[i] + r->rot*r->rdir[i];
370 +        }
371 +                                        /* find global cube entrance point */
372          t = 0.0;
373          if (!incube(scene, curpos)) {
374                                          /* find distance to entry */
# Line 384 | Line 386 | register CUBE  *scene;
386                                  t = dt; /* farthest face is the one */
387                  }
388                  t += FTINY;             /* fudge to get inside cube */
389 +                if (t >= r->rot)        /* clipped already */
390 +                        return(0);
391                                          /* advance position */
392                  for (i = 0; i < 3; i++)
393                          curpos[i] += r->rdir[i]*t;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines