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

Comparing ray/src/rt/mx_func.c (file contents):
Revision 2.1 by greg, Tue Nov 12 17:08:33 1991 UTC vs.
Revision 2.6 by greg, Tue Feb 25 02:47:22 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1988 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   *  mx_func.c - routine for mixture functions.
9 *
10 *     11/2/88
6   */
7  
8 + #include "copyright.h"
9 +
10   #include  "ray.h"
11  
12 + #include  "func.h"
13 +
14   /*
15   *      A mixture function is specified:
16   *
# Line 31 | Line 30 | mx_func(m, r)                  /* compute mixture function */
30   register OBJREC  *m;
31   RAY  *r;
32   {
33 <        extern double  varvalue();
35 <        extern int  errno;
33 >        OBJECT  obj;
34          register int  i;
35          double  coef;
36          OBJECT  mod[2];
37 <        register char  **sa;
37 >        register MFUNC  *mf;
38  
41        setfunc(m, r);
42
43        sa = m->oargs.sarg;
44
39          if (m->oargs.nsargs < 4)
40                  objerror(m, USER, "bad # arguments");
41 +        obj = objndx(m);
42          for (i = 0; i < 2; i++)
43 <                if (!strcmp(sa[i], VOIDID))
43 >                if (!strcmp(m->oargs.sarg[i], VOIDID))
44                          mod[i] = OVOID;
45 <                else if ((mod[i] = modifier(sa[i])) == OVOID) {
46 <                        sprintf(errmsg, "undefined modifier \"%s\"", sa[i]);
45 >                else if ((mod[i] = lastmod(obj, m->oargs.sarg[i])) == OVOID) {
46 >                        sprintf(errmsg, "undefined modifier \"%s\"",
47 >                                        m->oargs.sarg[i]);
48                          objerror(m, USER, errmsg);
49                  }
50 <        funcfile(sa[3]);
50 >        mf = getfunc(m, 3, 0x4, 0);
51 >        setfunc(m, r);
52          errno = 0;
53 <        coef = varvalue(sa[2]);
53 >        coef = evalue(mf->ep[0]);
54          if (errno) {
55                  objerror(m, WARNING, "compute error");
56 <                return;
56 >                return(0);
57          }
58 <        raymixture(r, mod[0], mod[1], coef);
58 >        if (raymixture(r, mod[0], mod[1], coef)) {
59 >                if (m->omod != OVOID)
60 >                        objerror(m, USER, "inappropriate modifier");
61 >                return(1);
62 >        }
63 >        return(0);
64   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines