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

Comparing ray/src/rt/p_func.c (file contents):
Revision 1.1 by greg, Thu Feb 2 10:41:34 1989 UTC vs.
Revision 2.5 by greg, Tue Feb 25 02:47:23 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1986 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   *  p_func.c - routine for procedural patterns.
9 *
10 *     4/8/86
6   */
7  
8 + #include "copyright.h"
9 +
10   #include  "ray.h"
11  
12 + #include  "func.h"
13 +
14   /*
15   *      A procedural pattern can either be a brightness or a
16   *  color function.  A brightness function is given as:
# Line 36 | Line 35 | static char SCCSid[] = "$SunId$ LBL";
35  
36  
37   p_bfunc(m, r)                   /* compute brightness pattern */
38 < register OBJREC  *m;
38 > OBJREC  *m;
39   RAY  *r;
40   {
42        extern double  varvalue();
43        extern int  errno;
41          double  bval;
42 <        register char  **sa;
42 >        register MFUNC  *mf;
43  
47        setfunc(m, r);
48
49        sa = m->oargs.sarg;
50
44          if (m->oargs.nsargs < 2)
45                  objerror(m, USER, "bad # arguments");
46 <        if (!vardefined(sa[0]))
47 <                loadfunc(sa[1]);
46 >        mf = getfunc(m, 1, 0x1, 0);
47 >        setfunc(m, r);
48          errno = 0;
49 <        bval = varvalue(sa[0]);
49 >        bval = evalue(mf->ep[0]);
50          if (errno) {
51                  objerror(m, WARNING, "compute error");
52 <                return;
52 >                return(0);
53          }
54          scalecolor(r->pcol, bval);
55 +        return(0);
56   }
57  
58  
59   p_cfunc(m, r)                   /* compute color pattern */
60 < register OBJREC  *m;
60 > OBJREC  *m;
61   RAY  *r;
62   {
69        extern double  varvalue();
70        extern int  errno;
63          COLOR  cval;
64 <        register char  **sa;
64 >        register MFUNC  *mf;
65  
74        setfunc(m, r);
75
76        sa = m->oargs.sarg;
77
66          if (m->oargs.nsargs < 4)
67                  objerror(m, USER, "bad # arguments");
68 <        if (!vardefined(sa[0]))
69 <                loadfunc(sa[3]);
68 >        mf = getfunc(m, 3, 0x7, 0);
69 >        setfunc(m, r);
70          errno = 0;
71 <        setcolor(cval, varvalue(sa[0]),
72 <                        varvalue(sa[1]),
73 <                        varvalue(sa[2]));
71 >        setcolor(cval, evalue(mf->ep[0]),
72 >                        evalue(mf->ep[1]),
73 >                        evalue(mf->ep[2]));
74          if (errno) {
75                  objerror(m, WARNING, "compute error");
76 <                return;
76 >                return(0);
77          }
78          multcolor(r->pcol, cval);
79 +        return(0);
80   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines