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.2 by greg, Thu Aug 8 11:29:58 1991 UTC vs.
Revision 2.7 by schorsch, Tue Mar 30 16:13:01 2004 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 + #include  "func.h"
12 + #include  "rtotypes.h"
13  
14   /*
15   *      A procedural pattern can either be a brightness or a
# Line 35 | Line 34 | static char SCCSid[] = "$SunId$ LBL";
34   */
35  
36  
37 < p_bfunc(m, r)                   /* compute brightness pattern */
38 < register OBJREC  *m;
39 < RAY  *r;
37 > extern int
38 > p_bfunc(                        /* compute brightness pattern */
39 >        OBJREC  *m,
40 >        RAY  *r
41 > )
42   {
42        extern double  varvalue();
43        extern int  errno;
43          double  bval;
44 <        register char  **sa;
44 >        register MFUNC  *mf;
45  
47        setfunc(m, r);
48
49        sa = m->oargs.sarg;
50
46          if (m->oargs.nsargs < 2)
47                  objerror(m, USER, "bad # arguments");
48 <        funcfile(sa[1]);
48 >        mf = getfunc(m, 1, 0x1, 0);
49 >        setfunc(m, r);
50          errno = 0;
51 <        bval = varvalue(sa[0]);
52 <        if (errno) {
51 >        bval = evalue(mf->ep[0]);
52 >        if (errno == EDOM || errno == ERANGE) {
53                  objerror(m, WARNING, "compute error");
54 <                return;
54 >                return(0);
55          }
56          scalecolor(r->pcol, bval);
57 +        return(0);
58   }
59  
60  
61 < p_cfunc(m, r)                   /* compute color pattern */
62 < register OBJREC  *m;
63 < RAY  *r;
61 > extern int
62 > p_cfunc(                        /* compute color pattern */
63 >        OBJREC  *m,
64 >        RAY  *r
65 > )
66   {
68        extern double  varvalue();
69        extern int  errno;
67          COLOR  cval;
68 <        register char  **sa;
68 >        register MFUNC  *mf;
69  
73        setfunc(m, r);
74
75        sa = m->oargs.sarg;
76
70          if (m->oargs.nsargs < 4)
71                  objerror(m, USER, "bad # arguments");
72 <        funcfile(sa[3]);
72 >        mf = getfunc(m, 3, 0x7, 0);
73 >        setfunc(m, r);
74          errno = 0;
75 <        setcolor(cval, varvalue(sa[0]),
76 <                        varvalue(sa[1]),
77 <                        varvalue(sa[2]));
78 <        if (errno) {
75 >        setcolor(cval, evalue(mf->ep[0]),
76 >                        evalue(mf->ep[1]),
77 >                        evalue(mf->ep[2]));
78 >        if (errno == EDOM || errno == ERANGE) {
79                  objerror(m, WARNING, "compute error");
80 <                return;
80 >                return(0);
81          }
82          multcolor(r->pcol, cval);
83 +        return(0);
84   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines