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.4 by greg, Wed Jan 12 16:46:39 1994 UTC vs.
Revision 2.9 by greg, Tue Feb 25 02:47:22 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1991 Regents of the University of California */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ LBL";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * Routines for light-redirecting materials and
6   *   their associated virtual light sources
7   */
8  
9 + #include "copyright.h"
10 +
11   #include  "ray.h"
12  
13   #include  "otypes.h"
# Line 32 | Line 31 | static char SCCSid[] = "$SunId$ LBL";
31   */
32  
33  
34 < int  dir_proj();
34 > static int  dir_proj();
35 >
36   VSMATERIAL  direct1_vs = {dir_proj, 1};
37   VSMATERIAL  direct2_vs = {dir_proj, 2};
38  
# Line 41 | Line 41 | VSMATERIAL  direct2_vs = {dir_proj, 2};
41                                  getfunc(m, 8, 0xff, 1) )
42  
43  
44 + int
45   m_direct(m, r)                  /* shade redirected ray */
46   register OBJREC  *m;
47   register RAY  *r;
# Line 60 | Line 61 | register RAY  *r;
61   }
62  
63  
64 + int
65   redirect(m, r, n)               /* compute n'th ray redirection */
66   OBJREC  *m;
67   RAY  *r;
# Line 85 | Line 87 | int  n;
87                                  nsdir[j] = sp->sloc[j] - r->rop[j];
88                          normalize(nsdir);
89                  }
90 <                if (r->rox != NULL)
91 <                        multv3(nsdir, nsdir, r->rox->b.xfm);
92 <                if (mf->b != &unitxf)
93 <                        multv3(nsdir, nsdir, mf->b->xfm);
94 <        } else
95 <                nsdir[0] = nsdir[1] = nsdir[2] = 0.0;
96 <        varset("DxA", '=', nsdir[0]);
97 <        varset("DyA", '=', nsdir[1]);
98 <        varset("DzA", '=', nsdir[2]);
90 >                multv3(nsdir, nsdir, funcxf.xfm);
91 >                varset("DxA", '=', nsdir[0]/funcxf.sca);
92 >                varset("DyA", '=', nsdir[1]/funcxf.sca);
93 >                varset("DzA", '=', nsdir[2]/funcxf.sca);
94 >        } else {
95 >                varset("DxA", '=', 0.0);
96 >                varset("DyA", '=', 0.0);
97 >                varset("DzA", '=', 0.0);
98 >        }
99                                          /* compute coefficient */
100          errno = 0;
101          va = mf->ep + 4*n;
# Line 120 | Line 122 | int  n;
122          rayvalue(&nr);
123          scalecolor(nr.rcol, coef);
124          addcolor(r->rcol, nr.rcol);
125 +        if (r->ro != NULL && isflat(r->ro->otype))
126 +                r->rt = r->rot + nr.rt;
127          return(1);
128   computerr:
129          objerror(m, WARNING, "compute error");
# Line 127 | Line 131 | computerr:
131   }
132  
133  
134 + static int
135   dir_proj(pm, o, s, n)           /* compute a director's projection */
136   MAT4  pm;
137   OBJREC  *o;
# Line 159 | Line 164 | int  n;
164          olddot = DOT(tr.rdir, nv);
165          if (olddot <= FTINY && olddot >= -FTINY)
166                  return(0);              /* old dir parallels plane */
167 +        tr.rmax = 0.0;
168          rayorigin(&tr, NULL, PRIMARY, 1.0);
169          if (!(*ofun[o->otype].funp)(o, &tr))
170                  return(0);              /* no intersection! */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines