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

Comparing ray/src/rt/mx_data.c (file contents):
Revision 2.4 by gwlarson, Mon Aug 10 18:35:14 1998 UTC vs.
Revision 2.5 by gwlarson, Wed Jan 20 14:10:06 1999 UTC

# Line 17 | Line 17 | static char SCCSid[] = "$SunId$ SGI";
17   #include  "func.h"
18  
19   /*
20 < *      A stored mixture is specified:
20 > *  A stored mixture is specified:
21   *
22   *      modifier mixdata name
23   *      6+ foremod backmod func dfname vfname v0 v1 .. xf
24   *      0
25   *      n A1 A2 ..
26   *
27 + *  A picture mixture is specified as:
28 + *
29 + *      modifier mixpict name
30 + *      7+ foremod backmod func pfname vfname vx vy xf
31 + *      0
32 + *      n A1 A2 ..
33 + *
34 + *
35   *  Vfname is the name of the file where the variable definitions
36   *  can be found.  The list of real arguments can be accessed by
37   *  definitions in the file.  Dfname is the data file.
38 + *  (Pfname is a picture file.)
39   *  The dimensions of the data files and the number
40   *  of variables must match.  The func is a single argument
41 < *  function which returns the corrected data value given the
41 > *  function in the case of mixdata (three argument in the case
42 > *  of mixpict), which returns the corrected data value given the
43   *  interpolated value from the file.  The xf is a transformation
44   *  to get from the original coordinates to the current coordinates.
45   */
# Line 71 | Line 81 | RAY  *r;
81          coef = datavalue(dp, pt);
82          errno = 0;
83          coef = funvalue(m->oargs.sarg[2], 1, &coef);
84 +        if (errno)
85 +                goto computerr;
86 +        if (raymixture(r, mod[0], mod[1], coef)) {
87 +                if (m->omod != OVOID)
88 +                        objerror(m, USER, "inappropriate modifier");
89 +                return(1);
90 +        }
91 +        return(0);
92 + computerr:
93 +        objerror(m, WARNING, "compute error");
94 +        return(0);
95 + }
96 +
97 +
98 + mx_pdata(m, r)                  /* interpolate mixture picture */
99 + register OBJREC  *m;
100 + RAY  *r;
101 + {
102 +        OBJECT  obj;
103 +        double  col[3], coef;
104 +        double  pt[MAXDIM];
105 +        DATARRAY  *dp;
106 +        OBJECT  mod[2];
107 +        register MFUNC  *mf;
108 +        register int  i;
109 +
110 +        if (m->oargs.nsargs < 7)
111 +                objerror(m, USER, "bad # arguments");
112 +        obj = objndx(m);
113 +        for (i = 0; i < 2; i++)
114 +                if (!strcmp(m->oargs.sarg[i], VOIDID))
115 +                        mod[i] = OVOID;
116 +                else if ((mod[i] = lastmod(obj, m->oargs.sarg[i])) == OVOID) {
117 +                        sprintf(errmsg, "undefined modifier \"%s\"",
118 +                                        m->oargs.sarg[i]);
119 +                        objerror(m, USER, errmsg);
120 +                }
121 +        dp = getpict(m->oargs.sarg[3]);
122 +        mf = getfunc(m, 4, 0x3<<5, 0);
123 +        setfunc(m, r);
124 +        errno = 0;
125 +        pt[1] = evalue(mf->ep[0]);      /* y major ordering */
126 +        pt[0] = evalue(mf->ep[1]);
127 +        if (errno)
128 +                goto computerr;
129 +        for (i = 0; i < 3; i++)         /* get pixel from picture */
130 +                col[i] = datavalue(dp+i, pt);
131 +        errno = 0;                      /* evaluate function on pixel */
132 +        coef = funvalue(m->oargs.sarg[2], 3, col);
133          if (errno)
134                  goto computerr;
135          if (raymixture(r, mod[0], mod[1], coef)) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines