--- ray/src/rt/raytrace.c 1994/01/13 10:43:34 2.12 +++ ray/src/rt/raytrace.c 1994/02/28 08:54:02 2.15 @@ -98,7 +98,7 @@ RAY *r; else if (sourcehit(r)) gotmat = rayshade(r, r->ro->omod); - if (!gotmat) + if (r->ro != NULL && !gotmat) objerror(r->ro, USER, "material not found"); if (trace != NULL) @@ -156,7 +156,7 @@ int mod; if (irr_ignore(m->otype)) { depth--; raytrans(r); - return; + return(1); } if (!islight(m->otype)) m = &Lamb; @@ -207,19 +207,24 @@ double coef; coef = 1.0; else if (coef < 0.0) coef = 0.0; + /* compute foreground and background */ + foremat = backmat = -1; /* foreground */ copystruct(&fr, r); if (fore != OVOID && coef > FTINY) foremat = rayshade(&fr, fore); - else - foremat = 0; /* background */ copystruct(&br, r); if (back != OVOID && coef < 1.0-FTINY) backmat = rayshade(&br, back); - else - backmat = foremat; /* check */ + if (foremat < 0) + if (backmat < 0) + foremat = backmat = 0; + else + foremat = backmat; + else if (backmat < 0) + backmat = foremat; if ((foremat==0) != (backmat==0)) objerror(r->ro, USER, "mixing material with non-material"); /* mix perturbations */