16 |
|
|
17 |
|
|
18 |
|
typedef struct { |
19 |
– |
double sca; /* scalefactor */ |
19 |
|
double xfm[4][4]; /* transform matrix */ |
20 |
+ |
double sca; /* scalefactor */ |
21 |
|
} XF; |
22 |
|
|
23 |
|
static OBJREC *fobj; /* current function object */ |
25 |
|
static XF fxf; /* current transformation */ |
26 |
|
|
27 |
|
|
28 |
< |
setmap(m, r, sca, xfm) /* set channels for function call */ |
28 |
> |
setmap(m, r, xfm, sca) /* set channels for function call */ |
29 |
|
OBJREC *m; |
30 |
|
register RAY *r; |
31 |
– |
double sca; |
31 |
|
double xfm[4][4]; |
32 |
+ |
double sca; |
33 |
|
{ |
34 |
|
extern double l_noise3(), l_noise3a(), l_noise3b(), l_noise3c(); |
35 |
|
extern double l_hermite(), l_fnoise3(), l_arg(); |
53 |
|
} |
54 |
|
fobj = m; |
55 |
|
fray = r; |
56 |
< |
fxf.sca = r->ros * sca; |
57 |
< |
multmat4(fxf.xfm, r->rox, xfm); |
56 |
> |
fxf.sca = r->robs * sca; |
57 |
> |
multmat4(fxf.xfm, r->robx, xfm); |
58 |
|
eclock++; /* notify expression evaluator */ |
59 |
|
} |
60 |
|
|
66 |
|
register XF *mxf; |
67 |
|
|
68 |
|
if ((mxf = (XF *)m->os) == NULL) { |
69 |
< |
register int n = m->oargs.nsargs; |
70 |
< |
register char **sa = m->oargs.sarg; |
69 |
> |
register int n; |
70 |
> |
register char **sa; |
71 |
|
|
72 |
< |
while (n > 0 && **sa != '-') { |
73 |
< |
n--; |
74 |
< |
sa++; |
75 |
< |
} |
72 |
> |
for (n = m->oargs.nsargs, sa = m->oargs.sarg; |
73 |
> |
n > 0 && **sa != '-'; n--, sa++) |
74 |
> |
; |
75 |
|
mxf = (XF *)malloc(sizeof(XF)); |
76 |
|
if (mxf == NULL) |
77 |
|
goto memerr; |
79 |
– |
mxf->sca = 1.0; |
80 |
– |
setident4(mxf->xfm); |
78 |
|
if (invxf(mxf->xfm, &mxf->sca, n, sa) != n) |
79 |
|
objerror(m, USER, "bad transform"); |
80 |
|
if (mxf->sca < 0.0) |
81 |
|
mxf->sca = -mxf->sca; |
82 |
|
m->os = (char *)mxf; |
83 |
|
} |
84 |
< |
setmap(m, r, mxf->sca, mxf->xfm); |
84 |
> |
setmap(m, r, mxf->xfm, mxf->sca); |
85 |
|
return; |
86 |
|
memerr: |
87 |
|
error(SYSTEM, "out of memory in setfunc"); |
95 |
|
extern char *libpath; /* library search path */ |
96 |
|
char *ffname; |
97 |
|
|
98 |
< |
if ((ffname = getpath(fname, libpath)) == NULL) { |
98 |
> |
if ((ffname = getpath(fname, libpath, R_OK)) == NULL) { |
99 |
|
sprintf(errmsg, "cannot find function file \"%s\"", fname); |
100 |
|
error(USER, errmsg); |
101 |
|
} |