--- ray/src/rt/rtrace.c 2003/02/25 02:47:23 2.28 +++ ray/src/rt/rtrace.c 2003/06/05 19:29:34 2.30 @@ -1,5 +1,5 @@ #ifndef lint -static const char RCSid[] = "$Id: rtrace.c,v 2.28 2003/02/25 02:47:23 greg Exp $"; +static const char RCSid[] = "$Id: rtrace.c,v 2.30 2003/06/05 19:29:34 schorsch Exp $"; #endif /* * rtrace.c - program and variables for individual ray tracing. @@ -21,10 +21,9 @@ static const char RCSid[] = "$Id: rtrace.c,v 2.28 2003 * irradiance values are desired. */ +#include "platform.h" #include "ray.h" - #include "otypes.h" - #include "resolu.h" CUBE thescene; /* our scene */ @@ -90,7 +89,7 @@ int ambincl = -1; /* include == 1, exclude == 0 */ static RAY thisray; /* for our convenience */ -static void oputo(), oputd(), oputv(), oputl(), oputL(), +static void oputo(), oputd(), oputv(), oputl(), oputL(), oputc(), oputp(), oputn(), oputN(), oputs(), oputw(), oputm(); static void ourtrace(), tabin(); @@ -146,9 +145,9 @@ char *fname; sprintf(errmsg, "cannot open input file \"%s\"", fname); error(SYSTEM, errmsg); } -#ifdef MSDOS +#ifdef _WIN32 if (inform != 'a') - setmode(fileno(fp), O_BINARY); + SET_FILE_BINARY(fp); #endif /* set up output */ setoutput(outvals); @@ -234,6 +233,9 @@ register char *vs; *table++ = oputl; castonly = 0; break; + case 'c': /* local coordinates */ + *table++ = oputc; + break; case 'L': /* single ray length */ *table++ = oputL; break; @@ -429,7 +431,7 @@ RAY *r; static void oputo(r) /* print origin */ -register RAY *r; +RAY *r; { (*putreal)(r->rorg[0]); (*putreal)(r->rorg[1]); @@ -439,7 +441,7 @@ register RAY *r; static void oputd(r) /* print direction */ -register RAY *r; +RAY *r; { (*putreal)(r->rdir[0]); (*putreal)(r->rdir[1]); @@ -449,7 +451,7 @@ register RAY *r; static void oputv(r) /* print value */ -register RAY *r; +RAY *r; { COLR cout; @@ -468,7 +470,7 @@ register RAY *r; static void oputl(r) /* print effective distance */ -register RAY *r; +RAY *r; { (*putreal)(r->rt); } @@ -476,15 +478,24 @@ register RAY *r; static void oputL(r) /* print single ray length */ -register RAY *r; +RAY *r; { (*putreal)(r->rot); } static void +oputc(r) /* print local coordinates */ +RAY *r; +{ + (*putreal)(r->uv[0]); + (*putreal)(r->uv[1]); +} + + +static void oputp(r) /* print point */ -register RAY *r; +RAY *r; { if (r->rot < FHUGE) { (*putreal)(r->rop[0]); @@ -500,7 +511,7 @@ register RAY *r; static void oputN(r) /* print unperturbed normal */ -register RAY *r; +RAY *r; { if (r->rot < FHUGE) { (*putreal)(r->ron[0]); @@ -535,7 +546,7 @@ RAY *r; static void oputs(r) /* print name */ -register RAY *r; +RAY *r; { if (r->ro != NULL) fputs(r->ro->oname, stdout); @@ -547,7 +558,7 @@ register RAY *r; static void oputw(r) /* print weight */ -register RAY *r; +RAY *r; { (*putreal)(r->rweight); } @@ -555,7 +566,7 @@ register RAY *r; static void oputm(r) /* print modifier */ -register RAY *r; +RAY *r; { if (r->ro != NULL) if (r->ro->omod != OVOID)