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.81 by greg, Sun Mar 29 18:21:57 2020 UTC vs.
Revision 2.85 by greg, Wed Jun 9 18:21:10 2021 UTC

# Line 147 | Line 147 | rayclear(                      /* clear a ray for (re)evaluation */
147          r->rox = NULL;
148          r->rxt = r->rmt = r->rot = FHUGE;
149          VCOPY(r->rop, r->rorg);
150 +        r->ron[0] = -r->rdir[0]; r->ron[1] = -r->rdir[1]; r->ron[2] = -r->rdir[2];
151 +        r->rod = 1.0;
152          r->pert[0] = r->pert[1] = r->pert[2] = 0.0;
153          r->rflips = 0;
154          r->uv[0] = r->uv[1] = 0.0;
# Line 514 | Line 516 | flipsurface(                   /* reverse surface orientation */
516          r->rflips++;
517   }
518  
519 +
520 + int
521 + rayreject(              /* check if candidate hit is worse than current */
522 +        OBJREC *o,
523 +        RAY *r,
524 +        double t
525 + )
526 + {
527 +        OBJREC  *mnew, *mray;
528 +
529 +        if ((t <= FTINY) | (t > r->rot + FTINY))
530 +                return(1);
531 +        if (t < r->rot - FTINY)         /* is new hit significantly closer? */
532 +                return(0);
533 +                                        /* coincident point, so decide... */
534 +        if (o == r->ro)
535 +                return(1);              /* shouldn't happen */
536 +        if (r->ro == NULL)
537 +                return(0);              /* ditto */
538 +        mnew = findmaterial(o);
539 +        mray = findmaterial(r->ro);     /* check material transparencies */
540 +        if (mnew == NULL) {
541 +                if (mray != NULL)
542 +                        return(1);      /* new has no material */
543 +        } else if (mray == NULL) {
544 +                return(0);              /* old has no material(!) */
545 +        } else if (istransp(mnew->otype)) {
546 +                if (!istransp(mray->otype))
547 +                        return(1);      /* new is transparent */
548 +        } else if (istransp(mray->otype)) {
549 +                return(0);              /* old is transparent */
550 +        }
551 +                        /* weakest priority to later modifier definition */
552 +        return (r->ro->omod >= o->omod);
553 + }
554  
555   void
556   rayhit(                 /* standard ray hit test */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines