--- ray/src/rt/raytrace.c 1989/04/19 22:24:28 1.3 +++ ray/src/rt/raytrace.c 1989/10/16 18:57:02 1.6 @@ -22,7 +22,7 @@ extern double minweight; /* minimum ray weight */ long nrays = 0L; /* number of rays traced */ -#define MAXLOOP 32 /* modifier loop detection */ +#define MAXLOOP 128 /* modifier loop detection */ #define RAYHIT (-1) /* return value for intercepted ray */ @@ -68,12 +68,7 @@ register RAY *r; { extern int (*trace)(); - if (localhit(r, &thescene)) - if (r->clipset != NULL && inset(r->clipset, r->ro->omod)) - raytrans(r); /* object is clipped */ - else - rayshade(r, r->ro->omod); - else if (sourcehit(r)) + if (localhit(r, &thescene) || sourcehit(r)) rayshade(r, r->ro->omod); if (trace != NULL) @@ -100,15 +95,23 @@ int mod; { static int depth = 0; register OBJREC *m; + /* check for clipped surface */ + if (r->clipset != NULL && r->rot < FHUGE && + inset(r->clipset, mod)) { + raytrans(r); + return; + } /* check for infinite loop */ if (depth++ >= MAXLOOP) - objerror(r->ro, USER, "material loop"); + objerror(r->ro, USER, "possible modifier loop"); for ( ; mod != OVOID; mod = m->omod) { m = objptr(mod); + /****** unnecessary test since modifier() is always called if (!ismodifier(m->otype)) { sprintf(errmsg, "illegal modifier \"%s\"", m->oname); error(USER, errmsg); } + ******/ (*ofun[m->otype].funp)(m, r); /* execute function */ m->lastrno = r->rno; if (ismaterial(m->otype)) { /* materials call raytexture */