| 22 |
|
|
| 23 |
|
long nrays = 0L; /* number of rays traced */ |
| 24 |
|
|
| 25 |
< |
#define MAXLOOP 32 /* modifier loop detection */ |
| 25 |
> |
#define MAXLOOP 1024 /* modifier loop detection */ |
| 26 |
|
|
| 27 |
|
#define RAYHIT (-1) /* return value for intercepted ray */ |
| 28 |
|
|
| 56 |
|
r->newcset = r->clipset; |
| 57 |
|
r->ro = NULL; |
| 58 |
|
r->rot = FHUGE; |
| 59 |
– |
r->rofs = 1.0; setident4(r->rofx); |
| 60 |
– |
r->robs = 1.0; setident4(r->robx); |
| 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); |
| 68 |
|
{ |
| 69 |
|
extern int (*trace)(); |
| 70 |
|
|
| 71 |
< |
if (localhit(r, &thescene)) |
| 74 |
< |
if (r->clipset != NULL && inset(r->clipset, r->ro->omod)) |
| 75 |
< |
raytrans(r); /* object is clipped */ |
| 76 |
< |
else |
| 77 |
< |
rayshade(r, r->ro->omod); |
| 78 |
< |
else if (sourcehit(r)) |
| 71 |
> |
if (localhit(r, &thescene) || sourcehit(r)) |
| 72 |
|
rayshade(r, r->ro->omod); |
| 73 |
|
|
| 74 |
|
if (trace != NULL) |
| 95 |
|
{ |
| 96 |
|
static int depth = 0; |
| 97 |
|
register OBJREC *m; |
| 98 |
+ |
/* check for clipped surface */ |
| 99 |
+ |
if (r->clipset != NULL && r->rot < FHUGE && |
| 100 |
+ |
inset(r->clipset, mod)) { |
| 101 |
+ |
raytrans(r); |
| 102 |
+ |
return; |
| 103 |
+ |
} |
| 104 |
|
/* check for infinite loop */ |
| 105 |
|
if (depth++ >= MAXLOOP) |
| 106 |
< |
objerror(r->ro, USER, "material loop"); |
| 106 |
> |
objerror(r->ro, USER, "possible modifier loop"); |
| 107 |
|
for ( ; mod != OVOID; mod = m->omod) { |
| 108 |
|
m = objptr(mod); |
| 109 |
+ |
/****** unnecessary test since modifier() is always called |
| 110 |
|
if (!ismodifier(m->otype)) { |
| 111 |
|
sprintf(errmsg, "illegal modifier \"%s\"", m->oname); |
| 112 |
|
error(USER, errmsg); |
| 113 |
|
} |
| 114 |
+ |
******/ |
| 115 |
|
(*ofun[m->otype].funp)(m, r); /* execute function */ |
| 116 |
|
m->lastrno = r->rno; |
| 117 |
|
if (ismaterial(m->otype)) { /* materials call raytexture */ |