--- ray/src/rt/rtrace.c 1992/07/10 14:56:24 2.6 +++ ray/src/rt/rtrace.c 1992/11/06 16:48:32 2.9 @@ -73,7 +73,7 @@ extern OBJREC Lamb; /* a Lambertian surface */ static RAY thisray; /* for our convenience */ static int oputo(), oputd(), oputv(), oputl(), oputL(), - oputp(), oputn(), oputs(), oputw(), oputm(); + oputp(), oputn(), oputN(), oputs(), oputw(), oputm(); static int (*ray_out[10])(), (*every_out[10])(); static int castonly; @@ -118,6 +118,10 @@ char *fname; sprintf(errmsg, "cannot open input file \"%s\"", fname); error(SYSTEM, errmsg); } +#ifdef MSDOS + if (inform != 'a') + setmode(fileno(fp), O_BINARY); +#endif /* set up output */ setoutput(outvals); switch (outform) { @@ -131,8 +135,6 @@ char *fname; default: error(CONSISTENCY, "botched output format"); } - fputformat(formstr(outform), stdout); - putchar('\n'); if (hresolu > 0 && vresolu > 0) fprtresolu(hresolu, vresolu, stdout); /* process file */ @@ -200,9 +202,13 @@ register char *vs; case 'p': /* point */ *table++ = oputp; break; - case 'n': /* normal */ + case 'n': /* perturbed normal */ *table++ = oputn; + castonly = 0; break; + case 'N': /* unperturbed normal */ + *table++ = oputN; + break; case 's': /* surface */ *table++ = oputs; break; @@ -398,7 +404,7 @@ register RAY *r; static -oputn(r) /* print normal */ +oputN(r) /* print unperturbed normal */ register RAY *r; { if (r->rot < FHUGE) { @@ -410,6 +416,25 @@ register RAY *r; (*putreal)(0.0); (*putreal)(0.0); } +} + + +static +oputn(r) /* print perturbed normal */ +RAY *r; +{ + FVECT pnorm; + + if (r->rot >= FHUGE) { + (*putreal)(0.0); + (*putreal)(0.0); + (*putreal)(0.0); + return; + } + raynormal(pnorm, r); + (*putreal)(pnorm[0]); + (*putreal)(pnorm[1]); + (*putreal)(pnorm[2]); }