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.35 by greg, Tue Feb 25 02:47:23 2003 UTC vs.
Revision 2.38 by greg, Tue Mar 11 19:29:05 2003 UTC

# Line 1 | Line 1
1   #ifndef lint
2 < static const char       RCSid[] = "$Id$";
2 > static const char RCSid[] = "$Id$";
3   #endif
4   /*
5   *  raytrace.c - routines for tracing and shading rays.
# Line 95 | Line 95 | register RAY  *r;
95   {
96          r->rno = raynum++;
97          r->newcset = r->clipset;
98 +        r->hitf = rayhit;
99          r->robj = OVOID;
100          r->ro = NULL;
101          r->rox = NULL;
102          r->rt = r->rot = FHUGE;
103          r->pert[0] = r->pert[1] = r->pert[2] = 0.0;
104 +        r->uv[0] = r->uv[1] = 0.0;
105          setcolor(r->pcol, 1.0, 1.0, 1.0);
106          setcolor(r->rcol, 0.0, 0.0, 0.0);
107   }
# Line 172 | Line 174 | int  mod;
174                  }
175                  ******/
176                                          /* hack for irradiance calculation */
177 <                if (do_irrad && !(r->crtype & ~(PRIMARY|TRANS))) {
177 >                if (do_irrad && !(r->crtype & ~(PRIMARY|TRANS)) &&
178 >                                (ofun[m->otype].flags & (T_M|T_X))) {
179                          if (irr_ignore(m->otype)) {
180   #if  MAXLOOP
181                                  depth--;
# Line 409 | Line 412 | register RAY  *r;
412   }
413  
414  
415 + void
416 + rayhit(oset, r)                 /* standard ray hit test */
417 + OBJECT  *oset;
418 + RAY  *r;
419 + {
420 +        OBJREC  *o;
421 +        int     i;
422 +
423 +        for (i = oset[0]; i > 0; i--) {
424 +                o = objptr(oset[i]);
425 +                if ((*ofun[o->otype].funp)(o, r))
426 +                        r->robj = oset[i];
427 +        }
428 + }
429 +
430 +
431   int
432   localhit(r, scene)              /* check for hit in the octree */
433   register RAY  *r;
# Line 564 | Line 583 | CUBE  *cu;
583   OBJECT  *cxs;
584   {
585          OBJECT  oset[MAXSET+1];
567        register OBJREC  *o;
568        register int  i;
586  
587          objset(oset, cu->cutree);
588 <        checkset(oset, cxs);                    /* eliminate double-checking */
589 <        for (i = oset[0]; i > 0; i--) {
590 <                o = objptr(oset[i]);
591 <                if ((*ofun[o->otype].funp)(o, r))
592 <                        r->robj = oset[i];
576 <        }
577 <        if (r->ro == NULL)
588 >        checkset(oset, cxs);                    /* avoid double-checking */
589 >
590 >        (*r->hitf)(oset, r);                    /* test for hit in set */
591 >
592 >        if (r->robj == OVOID)
593                  return(0);                      /* no scores yet */
594  
595          return(incube(cu, r->rop));             /* hit OK if in current cube */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines