--- ray/src/rt/m_direct.c 1992/05/15 09:29:09 2.3 +++ ray/src/rt/m_direct.c 1996/04/12 16:49:39 2.7 @@ -1,4 +1,4 @@ -/* Copyright (c) 1991 Regents of the University of California */ +/* Copyright (c) 1994 Regents of the University of California */ #ifndef lint static char SCCSid[] = "$SunId$ LBL"; @@ -47,7 +47,7 @@ register RAY *r; { /* check if source ray */ if (r->rsrc >= 0 && source[r->rsrc].so != r->ro) - return; /* got the wrong guy */ + return(1); /* got the wrong guy */ /* compute first projection */ if (m->otype == MAT_DIRECT1 || (r->rsrc < 0 || source[r->rsrc].sa.sv.pn == 0)) @@ -56,6 +56,7 @@ register RAY *r; if (m->otype == MAT_DIRECT2 && (r->rsrc < 0 || source[r->rsrc].sa.sv.pn == 1)) redirect(m, r, 1); + return(1); } @@ -84,15 +85,15 @@ int n; nsdir[j] = sp->sloc[j] - r->rop[j]; normalize(nsdir); } - if (r->rox != NULL) - multv3(nsdir, nsdir, r->rox->b.xfm); - if (mf->b != &unitxf) - multv3(nsdir, nsdir, mf->b->xfm); - } else - nsdir[0] = nsdir[1] = nsdir[2] = 0.0; - varset("DxA", '=', nsdir[0]); - varset("DyA", '=', nsdir[1]); - varset("DzA", '=', nsdir[2]); + multv3(nsdir, nsdir, funcxf.xfm); + varset("DxA", '=', nsdir[0]/funcxf.sca); + varset("DyA", '=', nsdir[1]/funcxf.sca); + varset("DzA", '=', nsdir[2]/funcxf.sca); + } else { + varset("DxA", '=', 0.0); + varset("DyA", '=', 0.0); + varset("DzA", '=', 0.0); + } /* compute coefficient */ errno = 0; va = mf->ep + 4*n; @@ -119,6 +120,8 @@ int n; rayvalue(&nr); scalecolor(nr.rcol, coef); addcolor(r->rcol, nr.rcol); + if (r->ro != NULL && isflat(r->ro->otype)) + r->rt = r->rot + nr.rt; return(1); computerr: objerror(m, WARNING, "compute error"); @@ -158,6 +161,7 @@ int n; olddot = DOT(tr.rdir, nv); if (olddot <= FTINY && olddot >= -FTINY) return(0); /* old dir parallels plane */ + tr.rmax = 0.0; rayorigin(&tr, NULL, PRIMARY, 1.0); if (!(*ofun[o->otype].funp)(o, &tr)) return(0); /* no intersection! */