ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/mx_func.c
Revision: 2.6
Committed: Tue Feb 25 02:47:22 2003 UTC (21 years, 2 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 2.5: +1 -56 lines
Log Message:
Replaced inline copyright notice with #include "copyright.h"

File Contents

# Content
1 #ifndef lint
2 static const char RCSid[] = "$Id$";
3 #endif
4 /*
5 * mx_func.c - routine for mixture functions.
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 *
17 * modifier mixfunc name
18 * 4+ foremod backmod varname vfname xf
19 * 0
20 * n A1 A2 ..
21 *
22 * Vfname is the name of the file where the variable definition
23 * can be found. The list of real arguments can be accessed by
24 * definitions in the file. The xf is a transformation
25 * to get from the original coordinates to the current coordinates.
26 */
27
28
29 mx_func(m, r) /* compute mixture function */
30 register OBJREC *m;
31 RAY *r;
32 {
33 OBJECT obj;
34 register int i;
35 double coef;
36 OBJECT mod[2];
37 register MFUNC *mf;
38
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(m->oargs.sarg[i], VOIDID))
44 mod[i] = OVOID;
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 mf = getfunc(m, 3, 0x4, 0);
51 setfunc(m, r);
52 errno = 0;
53 coef = evalue(mf->ep[0]);
54 if (errno) {
55 objerror(m, WARNING, "compute error");
56 return(0);
57 }
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 }