| 1 |
< |
/* Copyright (c) 1986 Regents of the University of California */ |
| 1 |
> |
/* Copyright (c) 1991 Regents of the University of California */ |
| 2 |
|
|
| 3 |
|
#ifndef lint |
| 4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
| 12 |
|
|
| 13 |
|
#include "ray.h" |
| 14 |
|
|
| 15 |
+ |
#include "func.h" |
| 16 |
+ |
|
| 17 |
|
/* |
| 18 |
|
* A procedural pattern can either be a brightness or a |
| 19 |
|
* color function. A brightness function is given as: |
| 38 |
|
|
| 39 |
|
|
| 40 |
|
p_bfunc(m, r) /* compute brightness pattern */ |
| 41 |
< |
register OBJREC *m; |
| 41 |
> |
OBJREC *m; |
| 42 |
|
RAY *r; |
| 43 |
|
{ |
| 42 |
– |
extern double varvalue(); |
| 43 |
– |
extern int errno; |
| 44 |
|
double bval; |
| 45 |
< |
register char **sa; |
| 45 |
> |
register MFUNC *mf; |
| 46 |
|
|
| 47 |
– |
setfunc(m, r); |
| 48 |
– |
|
| 49 |
– |
sa = m->oargs.sarg; |
| 50 |
– |
|
| 47 |
|
if (m->oargs.nsargs < 2) |
| 48 |
|
objerror(m, USER, "bad # arguments"); |
| 49 |
< |
funcfile(sa[1]); |
| 49 |
> |
mf = getfunc(m, 1, 0x1, 0); |
| 50 |
> |
setfunc(m, r); |
| 51 |
|
errno = 0; |
| 52 |
< |
bval = varvalue(sa[0]); |
| 52 |
> |
bval = evalue(mf->ep[0]); |
| 53 |
|
if (errno) { |
| 54 |
|
objerror(m, WARNING, "compute error"); |
| 55 |
< |
return; |
| 55 |
> |
return(0); |
| 56 |
|
} |
| 57 |
|
scalecolor(r->pcol, bval); |
| 58 |
+ |
return(0); |
| 59 |
|
} |
| 60 |
|
|
| 61 |
|
|
| 62 |
|
p_cfunc(m, r) /* compute color pattern */ |
| 63 |
< |
register OBJREC *m; |
| 63 |
> |
OBJREC *m; |
| 64 |
|
RAY *r; |
| 65 |
|
{ |
| 68 |
– |
extern double varvalue(); |
| 69 |
– |
extern int errno; |
| 66 |
|
COLOR cval; |
| 67 |
< |
register char **sa; |
| 67 |
> |
register MFUNC *mf; |
| 68 |
|
|
| 73 |
– |
setfunc(m, r); |
| 74 |
– |
|
| 75 |
– |
sa = m->oargs.sarg; |
| 76 |
– |
|
| 69 |
|
if (m->oargs.nsargs < 4) |
| 70 |
|
objerror(m, USER, "bad # arguments"); |
| 71 |
< |
funcfile(sa[3]); |
| 71 |
> |
mf = getfunc(m, 3, 0x7, 0); |
| 72 |
> |
setfunc(m, r); |
| 73 |
|
errno = 0; |
| 74 |
< |
setcolor(cval, varvalue(sa[0]), |
| 75 |
< |
varvalue(sa[1]), |
| 76 |
< |
varvalue(sa[2])); |
| 74 |
> |
setcolor(cval, evalue(mf->ep[0]), |
| 75 |
> |
evalue(mf->ep[1]), |
| 76 |
> |
evalue(mf->ep[2])); |
| 77 |
|
if (errno) { |
| 78 |
|
objerror(m, WARNING, "compute error"); |
| 79 |
< |
return; |
| 79 |
> |
return(0); |
| 80 |
|
} |
| 81 |
|
multcolor(r->pcol, cval); |
| 82 |
+ |
return(0); |
| 83 |
|
} |