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 1.5 by greg, Thu Aug 8 11:30:05 1991 UTC vs.
Revision 1.6 by greg, Fri Nov 8 14:30:17 1991 UTC

# Line 36 | Line 36 | int  dir_proj();
36   VSMATERIAL  direct1_vs = {dir_proj, 1};
37   VSMATERIAL  direct2_vs = {dir_proj, 2};
38  
39 + #define fndx(m)         ((m)->otype == MAT_DIRECT1 ? 4 : 8)
40  
41 +
42 + static
43 + dir_check(m)                    /* check arguments and load function file */
44 + register OBJREC  *m;
45 + {
46 +        register FULLXF  *mxf;
47 +        register int  ff;
48 +
49 +        ff = fndx(m)+1;
50 +        if (ff > m->oargs.nsargs)
51 +                objerror(m, USER, "too few arguments");
52 +        if (m->os == NULL) {
53 +                mxf = (FULLXF *)malloc(sizeof(FULLXF));
54 +                if (mxf == NULL)
55 +                        error(SYSTEM, "out of memory in dir_check");
56 +                if (fullxf(mxf, m->oargs.nsargs-ff, m->oargs.sarg+ff) !=
57 +                                m->oargs.nsargs-ff)
58 +                        objerror(m, USER, "bad transform");
59 +                if (mxf->f.sca < 0.0)
60 +                        mxf->f.sca = -mxf->f.sca;
61 +                if (mxf->b.sca < 0.0)
62 +                        mxf->b.sca = -mxf->b.sca;
63 +                m->os = (char *)mxf;
64 +        }
65 + }
66 +
67 +
68   m_direct(m, r)                  /* shade redirected ray */
69   register OBJREC  *m;
70   register RAY  *r;
# Line 67 | Line 95 | int  n;
95          register int  j;
96                                          /* set up function */
97          setmap(m, r, &((FULLXF *)m->os)->b);
98 +        funcfile(m->oargs.sarg[fndx(m)]);
99          sa = m->oargs.sarg + 4*n;
100                                          /* compute coefficient */
101          errno = 0;
# Line 139 | Line 168 | int  n;
168                  return(0);              /* no intersection! */
169                                  /* compute redirection */
170          setmap(m, &tr, &((FULLXF *)m->os)->b);
171 +        funcfile(m->oargs.sarg[fndx(m)]);
172          errno = 0;
173          if (varvalue(sa[0]) <= FTINY)
174                  return(0);              /* insignificant */
# Line 172 | Line 202 | int  n;
202   computerr:
203          objerror(m, WARNING, "projection compute error");
204          return(0);
175 }
176
177
178 static
179 dir_check(m)                    /* check arguments and load function file */
180 register OBJREC  *m;
181 {
182        register FULLXF  *mxf;
183        register int  ff;
184
185        ff = m->otype == MAT_DIRECT1 ? 5 : 9;
186        if (ff > m->oargs.nsargs)
187                objerror(m, USER, "too few arguments");
188        funcfile(m->oargs.sarg[ff-1]);
189        if (m->os == NULL) {
190                mxf = (FULLXF *)malloc(sizeof(FULLXF));
191                if (mxf == NULL)
192                        error(SYSTEM, "out of memory in dir_check");
193                if (fullxf(mxf, m->oargs.nsargs-ff, m->oargs.sarg+ff) !=
194                                m->oargs.nsargs-ff)
195                        objerror(m, USER, "bad transform");
196                if (mxf->f.sca < 0.0)
197                        mxf->f.sca = -mxf->f.sca;
198                if (mxf->b.sca < 0.0)
199                        mxf->b.sca = -mxf->b.sca;
200                m->os = (char *)mxf;
201        }
205   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines