ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/m_direct.c
(Generate patch)

Comparing ray/src/rt/m_direct.c (file contents):
Revision 2.2 by greg, Mon Nov 25 09:51:06 1991 UTC vs.
Revision 2.7 by greg, Fri Apr 12 16:49:39 1996 UTC

# Line 1 | Line 1
1 < /* Copyright (c) 1991 Regents of the University of California */
1 > /* Copyright (c) 1994 Regents of the University of California */
2  
3   #ifndef lint
4   static char SCCSid[] = "$SunId$ LBL";
# Line 47 | Line 47 | register RAY  *r;
47   {
48                                          /* check if source ray */
49          if (r->rsrc >= 0 && source[r->rsrc].so != r->ro)
50 <                return;                         /* got the wrong guy */
50 >                return(1);                      /* got the wrong guy */
51                                          /* compute first projection */
52          if (m->otype == MAT_DIRECT1 ||
53                          (r->rsrc < 0 || source[r->rsrc].sa.sv.pn == 0))
# Line 56 | Line 56 | register RAY  *r;
56          if (m->otype == MAT_DIRECT2 &&
57                          (r->rsrc < 0 || source[r->rsrc].sa.sv.pn == 1))
58                  redirect(m, r, 1);
59 +        return(1);
60   }
61  
62  
# Line 66 | Line 67 | int  n;
67   {
68          MFUNC  *mf;
69          register EPNODE  **va;
70 +        FVECT  nsdir;
71          RAY  nr;
72          double  coef;
73          register int  j;
74                                          /* set up function */
75          mf = getdfunc(m);
76          setfunc(m, r);
77 +                                        /* assign direction variable */
78 +        if (r->rsrc >= 0) {
79 +                register SRCREC  *sp = source + source[r->rsrc].sa.sv.sn;
80 +
81 +                if (sp->sflags & SDISTANT)
82 +                        VCOPY(nsdir, sp->sloc);
83 +                else {
84 +                        for (j = 0; j < 3; j++)
85 +                                nsdir[j] = sp->sloc[j] - r->rop[j];
86 +                        normalize(nsdir);
87 +                }
88 +                multv3(nsdir, nsdir, funcxf.xfm);
89 +                varset("DxA", '=', nsdir[0]/funcxf.sca);
90 +                varset("DyA", '=', nsdir[1]/funcxf.sca);
91 +                varset("DzA", '=', nsdir[2]/funcxf.sca);
92 +        } else {
93 +                varset("DxA", '=', 0.0);
94 +                varset("DyA", '=', 0.0);
95 +                varset("DzA", '=', 0.0);
96 +        }
97                                          /* compute coefficient */
98          errno = 0;
99          va = mf->ep + 4*n;
# Line 98 | Line 120 | int  n;
120          rayvalue(&nr);
121          scalecolor(nr.rcol, coef);
122          addcolor(r->rcol, nr.rcol);
123 +        if (r->ro != NULL && isflat(r->ro->otype))
124 +                r->rt = r->rot + nr.rt;
125          return(1);
126   computerr:
127          objerror(m, WARNING, "compute error");
# Line 137 | Line 161 | int  n;
161          olddot = DOT(tr.rdir, nv);
162          if (olddot <= FTINY && olddot >= -FTINY)
163                  return(0);              /* old dir parallels plane */
164 +        tr.rmax = 0.0;
165          rayorigin(&tr, NULL, PRIMARY, 1.0);
166          if (!(*ofun[o->otype].funp)(o, &tr))
167                  return(0);              /* no intersection! */
# Line 144 | Line 169 | int  n;
169          m = vsmaterial(o);
170          mf = getdfunc(m);
171          setfunc(m, &tr);
172 +        varset("DxA", '=', 0.0);
173 +        varset("DyA", '=', 0.0);
174 +        varset("DzA", '=', 0.0);
175          errno = 0;
176          va = mf->ep + 4*n;
177          coef = evalue(va[0]);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines