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.11 by schorsch, Sun Jul 27 22:12:03 2003 UTC vs.
Revision 2.13 by greg, Tue Apr 19 01:15:06 2005 UTC

# Line 9 | Line 9 | static const char      RCSid[] = "$Id$";
9   #include "copyright.h"
10  
11   #include  "ray.h"
12
12   #include  "otypes.h"
13 <
13 > #include  "rtotypes.h"
14   #include  "source.h"
16
15   #include  "func.h"
16  
17   /*
# Line 30 | Line 28 | static const char      RCSid[] = "$Id$";
28   *      n A1 A2 .. An
29   */
30  
31 + static int redirect(OBJREC  *m, RAY  *r, int  n);
32 + static int dir_proj(MAT4  pm, OBJREC  *o, SRCREC  *s, int  n);
33  
34 static int  dir_proj();
35
34   VSMATERIAL  direct1_vs = {dir_proj, 1};
35   VSMATERIAL  direct2_vs = {dir_proj, 2};
36  
# Line 41 | Line 39 | VSMATERIAL  direct2_vs = {dir_proj, 2};
39                                  getfunc(m, 8, 0xff, 1) )
40  
41  
42 < int
43 < m_direct(m, r)                  /* shade redirected ray */
44 < register OBJREC  *m;
45 < register RAY  *r;
42 > extern int
43 > m_direct(                       /* shade redirected ray */
44 >        register OBJREC  *m,
45 >        register RAY  *r
46 > )
47   {
48                                          /* check if source ray */
49          if (r->rsrc >= 0 && source[r->rsrc].so != r->ro)
# Line 61 | Line 60 | register RAY  *r;
60   }
61  
62  
63 < int
64 < redirect(m, r, n)               /* compute n'th ray redirection */
65 < OBJREC  *m;
66 < RAY  *r;
67 < int  n;
63 > static int
64 > redirect(               /* compute n'th ray redirection */
65 >        OBJREC  *m,
66 >        RAY  *r,
67 >        int  n
68 > )
69   {
70          MFUNC  *mf;
71          register EPNODE  **va;
# Line 100 | Line 100 | int  n;
100          errno = 0;
101          va = mf->ep + 4*n;
102          coef = evalue(va[0]);
103 <        if (errno == EDOM || errno == ERANGE)
103 >        if ((errno == EDOM) | (errno == ERANGE))
104                  goto computerr;
105 <        if (coef <= FTINY || rayorigin(&nr, r, TRANS, coef) < 0)
105 >        setcolor(nr.rcoef, coef, coef, coef);
106 >        if (rayorigin(&nr, TRANS, r, nr.rcoef) < 0)
107                  return(0);
108          va++;                           /* compute direction */
109          for (j = 0; j < 3; j++) {
# Line 120 | Line 121 | int  n;
121          if (r->rsrc >= 0)
122                  nr.rsrc = source[r->rsrc].sa.sv.sn;
123          rayvalue(&nr);
124 <        scalecolor(nr.rcol, coef);
124 >        multcolor(nr.rcol, nr.rcoef);
125          addcolor(r->rcol, nr.rcol);
126          if (r->ro != NULL && isflat(r->ro->otype))
127                  r->rt = r->rot + nr.rt;
# Line 132 | Line 133 | computerr:
133  
134  
135   static int
136 < dir_proj(pm, o, s, n)           /* compute a director's projection */
137 < MAT4  pm;
138 < OBJREC  *o;
139 < SRCREC  *s;
140 < int  n;
136 > dir_proj(               /* compute a director's projection */
137 >        MAT4  pm,
138 >        OBJREC  *o,
139 >        SRCREC  *s,
140 >        int  n
141 > )
142   {
143          RAY  tr;
144          OBJREC  *m;
# Line 165 | Line 167 | int  n;
167          if (olddot <= FTINY && olddot >= -FTINY)
168                  return(0);              /* old dir parallels plane */
169          tr.rmax = 0.0;
170 <        rayorigin(&tr, NULL, PRIMARY, 1.0);
170 >        rayorigin(&tr, PRIMARY, NULL, NULL);
171          if (!(*ofun[o->otype].funp)(o, &tr))
172                  return(0);              /* no intersection! */
173                                  /* compute redirection */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines