--- ray/src/rt/raytrace.c 2003/06/26 00:58:10 2.40 +++ ray/src/rt/raytrace.c 2003/12/31 01:50:02 2.44 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: raytrace.c,v 2.40 2003/06/26 00:58:10 schorsch Exp $"; +static const char RCSid[] = "$Id: raytrace.c,v 2.44 2003/12/31 01:50:02 greg Exp $"; #endif /* * raytrace.c - routines for tracing and shading rays. @@ -31,10 +31,6 @@ OBJREC Aftplane; /* aft clipping plane object */ static int raymove(), checkhit(); static void checkset(); -#ifndef MAXLOOP -#define MAXLOOP 0 /* modifier loop detection */ -#endif - #define RAYHIT (-1) /* return value for intercepted ray */ @@ -158,12 +154,6 @@ int mod; { int gotmat; register OBJREC *m; -#if MAXLOOP - static int depth = 0; - /* check for infinite loop */ - if (depth++ >= MAXLOOP) - objerror(r->ro, USER, "possible modifier loop"); -#endif r->rt = r->rot; /* set effective ray length */ for (gotmat = 0; !gotmat && mod != OVOID; mod = m->omod) { m = objptr(mod); @@ -175,11 +165,9 @@ int mod; ******/ /* hack for irradiance calculation */ if (do_irrad && !(r->crtype & ~(PRIMARY|TRANS)) && + m->otype != MAT_CLIP && (ofun[m->otype].flags & (T_M|T_X))) { if (irr_ignore(m->otype)) { -#if MAXLOOP - depth--; -#endif raytrans(r); return(1); } @@ -189,9 +177,6 @@ int mod; /* materials call raytexture */ gotmat = (*ofun[m->otype].funp)(m, r); } -#if MAXLOOP - depth--; -#endif return(gotmat); } @@ -234,12 +219,6 @@ RAY *r; OBJECT mod; { register OBJREC *m; -#if MAXLOOP - static int depth = 0; - /* check for infinite loop */ - if (depth++ >= MAXLOOP) - objerror(r->ro, USER, "modifier loop"); -#endif /* execute textures and patterns */ for ( ; mod != OVOID; mod = m->omod) { m = objptr(mod); @@ -255,9 +234,6 @@ OBJECT mod; objerror(r->ro, USER, errmsg); } } -#if MAXLOOP - depth--; /* end here */ -#endif } @@ -278,19 +254,20 @@ double coef; /* compute foreground and background */ foremat = backmat = 0; /* foreground */ - copystruct(&fr, r); + fr = *r; if (coef > FTINY) foremat = rayshade(&fr, fore); /* background */ - copystruct(&br, r); + br = *r; if (coef < 1.0-FTINY) backmat = rayshade(&br, back); /* check for transparency */ - if (backmat ^ foremat) + if (backmat ^ foremat) { if (backmat && coef > FTINY) raytrans(&fr); else if (foremat && coef < 1.0-FTINY) raytrans(&br); + } /* mix perturbations */ for (i = 0; i < 3; i++) r->pert[i] = coef*fr.pert[i] + (1.0-coef)*br.pert[i]; @@ -487,7 +464,7 @@ register CUBE *scene; } cxset[0] = 0; raymove(curpos, cxset, sflags, r, scene); - return(r->ro != NULL & r->ro != &Aftplane); + return((r->ro != NULL) & (r->ro != &Aftplane)); }