21 |
|
* irradiance values are desired. |
22 |
|
*/ |
23 |
|
|
24 |
+ |
#include "platform.h" |
25 |
|
#include "ray.h" |
25 |
– |
|
26 |
|
#include "otypes.h" |
27 |
– |
|
27 |
|
#include "resolu.h" |
28 |
|
|
29 |
|
CUBE thescene; /* our scene */ |
89 |
|
|
90 |
|
static RAY thisray; /* for our convenience */ |
91 |
|
|
92 |
< |
static void oputo(), oputd(), oputv(), oputl(), oputL(), |
92 |
> |
static void oputo(), oputd(), oputv(), oputl(), oputL(), oputc(), |
93 |
|
oputp(), oputn(), oputN(), oputs(), oputw(), oputm(); |
94 |
|
|
95 |
|
static void ourtrace(), tabin(); |
107 |
|
quit(code) /* quit program */ |
108 |
|
int code; |
109 |
|
{ |
110 |
< |
#ifndef NIX |
110 |
> |
#ifndef NON_POSIX /* XXX we don't clean up elsewhere? */ |
111 |
|
headclean(); /* delete header file */ |
112 |
|
pfclean(); /* clean up persist files */ |
113 |
|
#endif |
145 |
|
sprintf(errmsg, "cannot open input file \"%s\"", fname); |
146 |
|
error(SYSTEM, errmsg); |
147 |
|
} |
148 |
< |
#ifdef MSDOS |
148 |
> |
#ifdef _WIN32 |
149 |
|
if (inform != 'a') |
150 |
< |
setmode(fileno(fp), O_BINARY); |
150 |
> |
SET_FILE_BINARY(fp); |
151 |
|
#endif |
152 |
|
/* set up output */ |
153 |
|
setoutput(outvals); |
233 |
|
*table++ = oputl; |
234 |
|
castonly = 0; |
235 |
|
break; |
236 |
+ |
case 'c': /* local coordinates */ |
237 |
+ |
*table++ = oputc; |
238 |
+ |
break; |
239 |
|
case 'L': /* single ray length */ |
240 |
|
*table++ = oputL; |
241 |
|
break; |
431 |
|
|
432 |
|
static void |
433 |
|
oputo(r) /* print origin */ |
434 |
< |
register RAY *r; |
434 |
> |
RAY *r; |
435 |
|
{ |
436 |
|
(*putreal)(r->rorg[0]); |
437 |
|
(*putreal)(r->rorg[1]); |
441 |
|
|
442 |
|
static void |
443 |
|
oputd(r) /* print direction */ |
444 |
< |
register RAY *r; |
444 |
> |
RAY *r; |
445 |
|
{ |
446 |
|
(*putreal)(r->rdir[0]); |
447 |
|
(*putreal)(r->rdir[1]); |
451 |
|
|
452 |
|
static void |
453 |
|
oputv(r) /* print value */ |
454 |
< |
register RAY *r; |
454 |
> |
RAY *r; |
455 |
|
{ |
456 |
|
COLR cout; |
457 |
|
|
470 |
|
|
471 |
|
static void |
472 |
|
oputl(r) /* print effective distance */ |
473 |
< |
register RAY *r; |
473 |
> |
RAY *r; |
474 |
|
{ |
475 |
|
(*putreal)(r->rt); |
476 |
|
} |
478 |
|
|
479 |
|
static void |
480 |
|
oputL(r) /* print single ray length */ |
481 |
< |
register RAY *r; |
481 |
> |
RAY *r; |
482 |
|
{ |
483 |
|
(*putreal)(r->rot); |
484 |
|
} |
485 |
|
|
486 |
|
|
487 |
|
static void |
488 |
+ |
oputc(r) /* print local coordinates */ |
489 |
+ |
RAY *r; |
490 |
+ |
{ |
491 |
+ |
(*putreal)(r->uv[0]); |
492 |
+ |
(*putreal)(r->uv[1]); |
493 |
+ |
} |
494 |
+ |
|
495 |
+ |
|
496 |
+ |
static void |
497 |
|
oputp(r) /* print point */ |
498 |
< |
register RAY *r; |
498 |
> |
RAY *r; |
499 |
|
{ |
500 |
|
if (r->rot < FHUGE) { |
501 |
|
(*putreal)(r->rop[0]); |
511 |
|
|
512 |
|
static void |
513 |
|
oputN(r) /* print unperturbed normal */ |
514 |
< |
register RAY *r; |
514 |
> |
RAY *r; |
515 |
|
{ |
516 |
|
if (r->rot < FHUGE) { |
517 |
|
(*putreal)(r->ron[0]); |
546 |
|
|
547 |
|
static void |
548 |
|
oputs(r) /* print name */ |
549 |
< |
register RAY *r; |
549 |
> |
RAY *r; |
550 |
|
{ |
551 |
|
if (r->ro != NULL) |
552 |
|
fputs(r->ro->oname, stdout); |
558 |
|
|
559 |
|
static void |
560 |
|
oputw(r) /* print weight */ |
561 |
< |
register RAY *r; |
561 |
> |
RAY *r; |
562 |
|
{ |
563 |
|
(*putreal)(r->rweight); |
564 |
|
} |
566 |
|
|
567 |
|
static void |
568 |
|
oputm(r) /* print modifier */ |
569 |
< |
register RAY *r; |
569 |
> |
RAY *r; |
570 |
|
{ |
571 |
|
if (r->ro != NULL) |
572 |
|
if (r->ro->omod != OVOID) |