| 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 |
|
rayorigin(&thisray, NULL, PRIMARY, 1.0); |
| 248 |
|
localhit(&thisray, &thescene) || sourcehit(&thisray); |
| 249 |
|
else |
| 250 |
|
rayvalue(&thisray); |
| 251 |
< |
|
| 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'); |
| 251 |
> |
printvals(&thisray); |
| 252 |
|
} |
| 253 |
|
|
| 254 |
|
|
| 263 |
|
} |
| 264 |
|
rayorigin(&thisray, NULL, PRIMARY, 1.0); |
| 265 |
|
/* pretend we hit surface */ |
| 266 |
< |
thisray.rot = 1.0; |
| 266 |
> |
thisray.rot = 1.0-1e-4; |
| 267 |
|
thisray.rod = 1.0; |
| 268 |
|
VCOPY(thisray.ron, dir); |
| 269 |
|
for (i = 0; i < 3; i++) /* fudge factor */ |
| 270 |
|
thisray.rop[i] = org[i] + 1e-4*dir[i]; |
| 271 |
|
/* compute and print */ |
| 272 |
|
(*ofun[Lamb.otype].funp)(&Lamb, &thisray); |
| 273 |
< |
oputv(&thisray); |
| 273 |
> |
printvals(&thisray); |
| 274 |
> |
} |
| 275 |
> |
|
| 276 |
> |
|
| 277 |
> |
printvals(r) /* print requested ray values */ |
| 278 |
> |
RAY *r; |
| 279 |
> |
{ |
| 280 |
> |
register int (**tp)(); |
| 281 |
> |
|
| 282 |
> |
if (ray_out[0] == NULL) |
| 283 |
> |
return; |
| 284 |
> |
for (tp = ray_out; *tp != NULL; tp++) |
| 285 |
> |
(**tp)(r); |
| 286 |
|
if (outform == 'a') |
| 287 |
|
putchar('\n'); |
| 288 |
|
} |
| 355 |
|
|
| 356 |
|
if (every_out[0] == NULL) |
| 357 |
|
return; |
| 358 |
< |
if (traincl == 1 && r->ro == NULL) |
| 359 |
< |
return; |
| 360 |
< |
if (traincl != -1 && traincl != inset(traset, r->ro->omod)) |
| 358 |
> |
if (r->ro == NULL) { |
| 359 |
> |
if (traincl == 1) |
| 360 |
> |
return; |
| 361 |
> |
} else if (traincl != -1 && traincl != inset(traset, r->ro->omod)) |
| 362 |
|
return; |
| 363 |
|
tabin(r); |
| 364 |
|
for (tp = every_out; *tp != NULL; tp++) |