57 |
|
if (i >= nroots) |
58 |
|
return(0); /* no positive root */ |
59 |
|
|
60 |
< |
if (t < r->rot) { /* found closer intersection */ |
61 |
< |
r->ro = so; |
62 |
< |
r->rot = t; |
63 |
< |
/* compute normal */ |
64 |
< |
a = ap[3]; |
65 |
< |
if (so->otype == OBJ_BUBBLE) |
66 |
< |
a = -a; /* reverse */ |
67 |
< |
for (i = 0; i < 3; i++) { |
68 |
< |
r->rop[i] = r->rorg[i] + r->rdir[i]*t; |
69 |
< |
r->ron[i] = (r->rop[i] - ap[i]) / a; |
70 |
< |
} |
71 |
< |
r->rod = -DOT(r->rdir, r->ron); |
60 |
> |
if (t >= r->rot) |
61 |
> |
return(0); /* other is closer */ |
62 |
> |
|
63 |
> |
r->ro = so; |
64 |
> |
r->rot = t; |
65 |
> |
/* compute normal */ |
66 |
> |
a = ap[3]; |
67 |
> |
if (so->otype == OBJ_BUBBLE) |
68 |
> |
a = -a; /* reverse */ |
69 |
> |
for (i = 0; i < 3; i++) { |
70 |
> |
r->rop[i] = r->rorg[i] + r->rdir[i]*t; |
71 |
> |
r->ron[i] = (r->rop[i] - ap[i]) / a; |
72 |
|
} |
73 |
< |
return(1); |
73 |
> |
r->rod = -DOT(r->rdir, r->ron); |
74 |
> |
r->rofs = 1.0; setident4(r->rofx); |
75 |
> |
r->robs = 1.0; setident4(r->robx); |
76 |
> |
|
77 |
> |
return(1); /* hit */ |
78 |
|
} |