| 59 |
|
r->pert[0] = r->pert[1] = r->pert[2] = 0.0; |
| 60 |
|
setcolor(r->pcol, 1.0, 1.0, 1.0); |
| 61 |
|
setcolor(r->rcol, 0.0, 0.0, 0.0); |
| 62 |
+ |
r->rt = 0.0; |
| 63 |
|
return(r->rlvl <= maxdepth && r->rweight >= minweight ? 0 : -1); |
| 64 |
|
} |
| 65 |
|
|
| 66 |
|
|
| 67 |
|
rayvalue(r) /* compute a ray's value */ |
| 68 |
< |
register RAY *r; |
| 68 |
> |
RAY *r; |
| 69 |
|
{ |
| 70 |
|
extern int (*trace)(); |
| 71 |
|
|
| 72 |
|
if (localhit(r, &thescene) || sourcehit(r)) |
| 73 |
< |
/* check for clipped object */ |
| 73 |
< |
if (r->clipset != NULL && inset(r->clipset, r->ro->omod)) |
| 74 |
< |
raytrans(r); |
| 75 |
< |
else |
| 76 |
< |
rayshade(r, r->ro->omod); |
| 73 |
> |
raycont(r); |
| 74 |
|
|
| 75 |
|
if (trace != NULL) |
| 76 |
|
(*trace)(r); /* trace execution */ |
| 77 |
|
} |
| 78 |
|
|
| 79 |
|
|
| 80 |
+ |
raycont(r) /* check for clipped object and continue */ |
| 81 |
+ |
register RAY *r; |
| 82 |
+ |
{ |
| 83 |
+ |
if (r->clipset != NULL && inset(r->clipset, r->ro->omod)) |
| 84 |
+ |
raytrans(r); |
| 85 |
+ |
else |
| 86 |
+ |
rayshade(r, r->ro->omod); |
| 87 |
+ |
} |
| 88 |
+ |
|
| 89 |
+ |
|
| 90 |
|
raytrans(r) /* transmit ray as is */ |
| 91 |
< |
RAY *r; |
| 91 |
> |
register RAY *r; |
| 92 |
|
{ |
| 93 |
|
RAY tr; |
| 94 |
|
|
| 96 |
|
VCOPY(tr.rdir, r->rdir); |
| 97 |
|
rayvalue(&tr); |
| 98 |
|
copycolor(r->rcol, tr.rcol); |
| 99 |
+ |
r->rt = r->rot + tr.rt; |
| 100 |
|
} |
| 101 |
|
} |
| 102 |
|
|
| 212 |
|
* still fraught with problems since reflected rays and similar |
| 213 |
|
* directions calculated from the surface normal may spawn rays behind |
| 214 |
|
* the surface. The only solution is to curb textures at high |
| 215 |
< |
* incidence (Rdot << 1). |
| 215 |
> |
* incidence (namely, keep DOT(rdir,pert) < Rdot). |
| 216 |
|
*/ |
| 217 |
|
|
| 218 |
|
for (i = 0; i < 3; i++) |