18 |
|
/* |
19 |
|
* The arguments for MAT_DIRECT1 are: |
20 |
|
* |
21 |
< |
* 4+ coef1 dx1 dy1 dz1 transform.. |
21 |
> |
* 5+ coef1 dx1 dy1 dz1 funcfile transform.. |
22 |
|
* 0 |
23 |
|
* n A1 A2 .. An |
24 |
|
* |
25 |
|
* The arguments for MAT_DIRECT2 are: |
26 |
|
* |
27 |
< |
* 8+ coef1 dx1 dy1 dz1 coef2 dx2 dy2 dz2 transform.. |
27 |
> |
* 9+ coef1 dx1 dy1 dz1 coef2 dx2 dy2 dz2 funcfile transform.. |
28 |
|
* 0 |
29 |
|
* n A1 A2 .. An |
30 |
|
*/ |
44 |
|
/* check if source ray */ |
45 |
|
if (r->rsrc >= 0 && source[r->rsrc].so != r->ro) |
46 |
|
return; /* got the wrong guy */ |
47 |
+ |
dir_check(m); |
48 |
|
/* compute first projection */ |
49 |
|
if (m->otype == MAT_DIRECT1 || |
50 |
|
(r->rsrc < 0 || source[r->rsrc].sa.sv.pn == 0)) |
67 |
|
register int j; |
68 |
|
/* set up function */ |
69 |
|
setfunc(m, r); |
69 |
– |
if (m->oargs.nsargs < 4+4*n) |
70 |
– |
objerror(m, USER, "too few arguments"); |
70 |
|
sa = m->oargs.sarg + 4*n; |
71 |
|
/* compute coefficient */ |
72 |
|
errno = 0; |
108 |
|
register int i, j; |
109 |
|
/* get material arguments */ |
110 |
|
m = objptr(o->omod); |
111 |
< |
if (m->oargs.nsargs < 4+4*n) |
113 |
< |
objerror(m, USER, "too few arguments"); |
111 |
> |
dir_check(m); |
112 |
|
sa = m->oargs.sarg + 4*n; |
113 |
|
/* initialize test ray */ |
114 |
|
getmaxdisk(cent, o); |
120 |
|
else { |
121 |
|
for (i = 0; i < 3; i++) { |
122 |
|
tr.rdir[i] = cent[i] - s->sloc[i]; |
123 |
< |
tr.rorg[i] = cent[i] - .05*tr.rdir[i]; |
123 |
> |
tr.rorg[i] = s->sloc[i]; |
124 |
|
} |
125 |
|
if (normalize(tr.rdir) == 0.0) |
126 |
|
return(0); /* at source! */ |
165 |
|
computerr: |
166 |
|
objerror(m, WARNING, "projection compute error"); |
167 |
|
return(0); |
168 |
+ |
} |
169 |
+ |
|
170 |
+ |
|
171 |
+ |
static |
172 |
+ |
dir_check(m) /* check arguments and load function file */ |
173 |
+ |
register OBJREC *m; |
174 |
+ |
{ |
175 |
+ |
register int ff; |
176 |
+ |
|
177 |
+ |
ff = m->otype == MAT_DIRECT1 ? 4 : 8; |
178 |
+ |
if (ff >= m->oargs.nsargs) |
179 |
+ |
objerror(m, USER, "too few arguments"); |
180 |
+ |
if (!vardefined(m->oargs.sarg[0])) |
181 |
+ |
loadfunc(m->oargs.sarg[ff]); |
182 |
|
} |