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

Comparing ray/src/rt/sphere.c (file contents):
Revision 2.10 by greg, Thu Mar 16 00:25:24 2023 UTC vs.
Revision 2.11 by greg, Sat Dec 20 02:09:11 2025 UTC

# Line 63 | Line 63 | o_sphere(                      /* compute intersection with sphere */
63                          break;
64          if (i >= nroots)
65                  return(0);                      /* no positive root */
66 <        if (rayreject(so, r, t, 0))
66 >        if (rayreject(so, r, t, 1 - 2*((i>0)^(so->otype==OBJ_BUBBLE))))
67                  return(0);                      /* previous hit better */
68  
69          r->ro = so;
70          r->rot = t;
71                                          /* compute normal */
72 <        a = ap[3];
73 <        if (so->otype == OBJ_BUBBLE)
74 <                a = -a;                 /* reverse */
72 >        a = ap[3] * (1 - 2*(so->otype==OBJ_BUBBLE));
73          for (i = 0; i < 3; i++) {
74                  r->rop[i] = r->rorg[i] + r->rdir[i]*t;
75                  r->ron[i] = (r->rop[i] - ap[i]) / a;

Diff Legend

Removed lines
+ Added lines
< Changed lines (old)
> Changed lines (new)