ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/rt/p_func.c
Revision: 2.1
Committed: Tue Nov 12 17:08:40 1991 UTC (32 years, 5 months ago) by greg
Content type: text/plain
Branch: MAIN
Changes since 1.2: +0 -0 lines
Log Message:
updated revision number for release 2.0

File Contents

# User Rev Content
1 greg 1.1 /* Copyright (c) 1986 Regents of the University of California */
2    
3     #ifndef lint
4     static char SCCSid[] = "$SunId$ LBL";
5     #endif
6    
7     /*
8     * p_func.c - routine for procedural patterns.
9     *
10     * 4/8/86
11     */
12    
13     #include "ray.h"
14    
15     /*
16     * A procedural pattern can either be a brightness or a
17     * color function. A brightness function is given as:
18     *
19     * modifier brightfunc name
20     * 2+ bvarname filename xf
21     * 0
22     * n A1 A2 ..
23     *
24     * A color function is given as:
25     *
26     * modifier colorfunc name
27     * 4+ rvarname gvarname bvarname filename xf
28     * 0
29     * n A1 A2 ..
30     *
31     * Filename is the name of the file where the variable definitions
32     * can be found. The list of real arguments can be accessed by
33     * definitions in the file. The xf is a transformation
34     * to get from the original coordinates to the current coordinates.
35     */
36    
37    
38     p_bfunc(m, r) /* compute brightness pattern */
39     register OBJREC *m;
40     RAY *r;
41     {
42     extern double varvalue();
43     extern int errno;
44     double bval;
45     register char **sa;
46    
47     setfunc(m, r);
48    
49     sa = m->oargs.sarg;
50    
51     if (m->oargs.nsargs < 2)
52     objerror(m, USER, "bad # arguments");
53 greg 1.2 funcfile(sa[1]);
54 greg 1.1 errno = 0;
55     bval = varvalue(sa[0]);
56     if (errno) {
57     objerror(m, WARNING, "compute error");
58     return;
59     }
60     scalecolor(r->pcol, bval);
61     }
62    
63    
64     p_cfunc(m, r) /* compute color pattern */
65     register OBJREC *m;
66     RAY *r;
67     {
68     extern double varvalue();
69     extern int errno;
70     COLOR cval;
71     register char **sa;
72    
73     setfunc(m, r);
74    
75     sa = m->oargs.sarg;
76    
77     if (m->oargs.nsargs < 4)
78     objerror(m, USER, "bad # arguments");
79 greg 1.2 funcfile(sa[3]);
80 greg 1.1 errno = 0;
81     setcolor(cval, varvalue(sa[0]),
82     varvalue(sa[1]),
83     varvalue(sa[2]));
84     if (errno) {
85     objerror(m, WARNING, "compute error");
86     return;
87     }
88     multcolor(r->pcol, cval);
89     }