1 |
< |
/* Copyright (c) 1992 Regents of the University of California */ |
1 |
> |
/* Copyright (c) 1994 Regents of the University of California */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ LBL"; |
133 |
|
setmode(fileno(fp), O_BINARY); |
134 |
|
#endif |
135 |
|
/* set up output */ |
136 |
< |
if (imm_irrad) |
137 |
< |
outvals = "v"; |
138 |
< |
else |
139 |
< |
setoutput(outvals); |
136 |
> |
setoutput(outvals); |
137 |
|
switch (outform) { |
138 |
|
case 'a': putreal = puta; break; |
139 |
|
case 'f': putreal = putf; break; |
163 |
|
if (imm_irrad) |
164 |
|
irrad(orig, direc); |
165 |
|
else |
166 |
< |
traceray(orig, direc); |
166 |
> |
rad(orig, direc); |
167 |
|
/* flush if time */ |
168 |
|
if (--nextflush == 0) { |
169 |
|
fflush(stdout); |
238 |
|
} |
239 |
|
|
240 |
|
|
241 |
< |
traceray(org, dir) /* compute and print ray value(s) */ |
241 |
> |
rad(org, dir) /* compute and print ray value(s) */ |
242 |
|
FVECT org, dir; |
243 |
|
{ |
247 |
– |
register int (**tp)(); |
248 |
– |
|
244 |
|
VCOPY(thisray.rorg, org); |
245 |
|
VCOPY(thisray.rdir, dir); |
246 |
+ |
thisray.rmax = 0.0; |
247 |
|
rayorigin(&thisray, NULL, PRIMARY, 1.0); |
248 |
|
if (castonly) |
249 |
|
localhit(&thisray, &thescene) || sourcehit(&thisray); |
250 |
|
else |
251 |
|
rayvalue(&thisray); |
252 |
< |
|
257 |
< |
if (ray_out[0] == NULL) |
258 |
< |
return; |
259 |
< |
for (tp = ray_out; *tp != NULL; tp++) |
260 |
< |
(**tp)(&thisray); |
261 |
< |
if (outform == 'a') |
262 |
< |
putchar('\n'); |
252 |
> |
printvals(&thisray); |
253 |
|
} |
254 |
|
|
255 |
|
|
264 |
|
} |
265 |
|
rayorigin(&thisray, NULL, PRIMARY, 1.0); |
266 |
|
/* pretend we hit surface */ |
267 |
< |
thisray.rot = 1.0; |
267 |
> |
thisray.rot = 1.0-1e-4; |
268 |
|
thisray.rod = 1.0; |
269 |
|
VCOPY(thisray.ron, dir); |
270 |
|
for (i = 0; i < 3; i++) /* fudge factor */ |
271 |
|
thisray.rop[i] = org[i] + 1e-4*dir[i]; |
272 |
|
/* compute and print */ |
273 |
|
(*ofun[Lamb.otype].funp)(&Lamb, &thisray); |
274 |
< |
oputv(&thisray); |
274 |
> |
printvals(&thisray); |
275 |
> |
} |
276 |
> |
|
277 |
> |
|
278 |
> |
printvals(r) /* print requested ray values */ |
279 |
> |
RAY *r; |
280 |
> |
{ |
281 |
> |
register int (**tp)(); |
282 |
> |
|
283 |
> |
if (ray_out[0] == NULL) |
284 |
> |
return; |
285 |
> |
for (tp = ray_out; *tp != NULL; tp++) |
286 |
> |
(**tp)(r); |
287 |
|
if (outform == 'a') |
288 |
|
putchar('\n'); |
289 |
|
} |
356 |
|
|
357 |
|
if (every_out[0] == NULL) |
358 |
|
return; |
359 |
< |
if (traincl == 1 && r->ro == NULL) |
360 |
< |
return; |
361 |
< |
if (traincl != -1 && traincl != inset(traset, r->ro->omod)) |
359 |
> |
if (r->ro == NULL) { |
360 |
> |
if (traincl == 1) |
361 |
> |
return; |
362 |
> |
} else if (traincl != -1 && traincl != inset(traset, r->ro->omod)) |
363 |
|
return; |
364 |
|
tabin(r); |
365 |
|
for (tp = every_out; *tp != NULL; tp++) |