62 |
|
} |
63 |
|
|
64 |
|
|
65 |
+ |
/* Set parameters for current evaluation */ |
66 |
+ |
void |
67 |
+ |
set_eparams(char *prms) |
68 |
+ |
{ |
69 |
+ |
static char *last_params = NULL; |
70 |
+ |
char vname[RMAXWORD]; |
71 |
+ |
double value; |
72 |
+ |
char *cpd; |
73 |
+ |
/* check if already set */ |
74 |
+ |
if ((prms == NULL) | (prms == last_params)) |
75 |
+ |
return; |
76 |
+ |
if (last_params != NULL && !strcmp(prms, last_params)) |
77 |
+ |
return; |
78 |
+ |
last_params = prms; /* assign each variable */ |
79 |
+ |
while (*prms) { |
80 |
+ |
if (isspace(*prms)) { |
81 |
+ |
++prms; continue; |
82 |
+ |
} |
83 |
+ |
if (!isalpha(*prms)) |
84 |
+ |
goto bad_params; |
85 |
+ |
cpd = vname; |
86 |
+ |
while (*prms && (*prms != '=') & !isspace(*prms)) { |
87 |
+ |
if (!isid(*prms)) |
88 |
+ |
goto bad_params; |
89 |
+ |
*cpd++ = *prms++; |
90 |
+ |
} |
91 |
+ |
if (cpd == vname) |
92 |
+ |
goto bad_params; |
93 |
+ |
*cpd = '\0'; |
94 |
+ |
while (isspace(*prms)) prms++; |
95 |
+ |
if (*prms++ != '=') |
96 |
+ |
goto bad_params; |
97 |
+ |
value = atof(prms); |
98 |
+ |
if ((prms = fskip(prms)) == NULL) |
99 |
+ |
goto bad_params; |
100 |
+ |
while (isspace(*prms)) prms++; |
101 |
+ |
prms += (*prms == ',') | (*prms == ';'); |
102 |
+ |
varset(vname, '=', value); |
103 |
+ |
} |
104 |
+ |
return; |
105 |
+ |
bad_params: |
106 |
+ |
sprintf(errmsg, "bad parameter list '%s'", last_params); |
107 |
+ |
error(USER, errmsg); |
108 |
+ |
} |
109 |
+ |
|
110 |
+ |
|
111 |
|
MFUNC * |
112 |
|
getfunc( /* get function for this modifier */ |
113 |
|
OBJREC *m, |
259 |
|
) |
260 |
|
{ |
261 |
|
static RNUMBER lastrno = ~0; |
262 |
+ |
|
263 |
+ |
if (rayinitcal[0]) /* initialize on first call */ |
264 |
+ |
initfunc(); |
265 |
|
/* set evaluator context */ |
266 |
|
setcontext(ctx); |
267 |
|
/* check if ray already set */ |
351 |
|
fray->ron[2]*funcxf.xfm[2][n-3] ) |
352 |
|
/ funcxf.sca ); |
353 |
|
|
354 |
< |
if (n <= 8) /* intersection */ |
354 |
> |
if (n <= 8) { /* intersection point */ |
355 |
> |
if (fray->rot >= FHUGE) |
356 |
> |
return(0.0); /* XXX should be runtime error? */ |
357 |
|
|
358 |
|
return( fray->rop[0]*funcxf.xfm[0][n-6] + |
359 |
|
fray->rop[1]*funcxf.xfm[1][n-6] + |
360 |
|
fray->rop[2]*funcxf.xfm[2][n-6] + |
361 |
|
funcxf.xfm[3][n-6] ); |
362 |
+ |
} |
363 |
|
|
364 |
|
if (n == 9) /* total distance */ |
365 |
|
return(raydist(fray,PRIMARY) * funcxf.sca); |