--- ray/src/rt/rpict.c 1992/09/21 12:07:52 2.14 +++ ray/src/rt/rpict.c 1992/11/19 20:25:57 2.20 @@ -45,7 +45,7 @@ double shadthresh = .05; /* shadow threshold */ double shadcert = .5; /* shadow certainty */ int directrelay = 1; /* number of source relays */ int vspretest = 512; /* virtual source pretest density */ -int directinvis = 0; /* sources invisible? */ +int directvis = 1; /* sources visible? */ double srcsizerat = .25; /* maximum ratio source size/dist. */ double specthresh = .15; /* specular sampling threshold */ @@ -63,7 +63,11 @@ int ambounce = 0; /* ambient bounces */ char *amblist[128]; /* ambient include/exclude list */ int ambincl = -1; /* include == 1, exclude == 0 */ +#ifdef MSDOS +int ralrm = 60; /* seconds between reports */ +#else int ralrm = 0; /* seconds between reports */ +#endif double pctdone = 0.0; /* percentage done */ @@ -145,20 +149,17 @@ openheader() /* save standard output to header file } -closeheader() /* done with header output */ -{ - if (hfname == NULL) - return; - if (fflush(stdout) == EOF || (hfp = fopen(hfname, "r")) == NULL) - error(SYSTEM, "error reopening header file"); -} - - dupheader() /* repeat header on standard output */ { register int c; - if (fseek(hfp, 0L, 0) < 0) + if (hfp == NULL) { + if ((hfp = fopen(hfname, "r")) == NULL) + error(SYSTEM, "error reopening header file"); +#ifdef MSDOS + setmode(fileno(hfp), O_BINARY); +#endif + } else if (fseek(hfp, 0L, 0) < 0) error(SYSTEM, "seek error on header file"); while ((c = getc(hfp)) != EOF) putchar(c); @@ -185,8 +186,6 @@ char *pout, *zout, *prvr; register char *cp; RESOLU rs; double pa; - /* finished writing header */ - closeheader(); /* check sampling */ if (psample < 1) psample = 1; @@ -210,13 +209,15 @@ char *pout, *zout, *prvr; error(USER, "unexpected EOF on view input"); prvr = fbuf; /* mark for renaming */ } - if (pout != NULL) { + if (pout != NULL & prvr != NULL) { sprintf(fbuf, pout, seq); - if (prvr != NULL && !strcmp(prvr, fbuf)) { /* rename */ - fbuf2[0] = '\0'; - if ((cp = rindex(fbuf, '/')) != NULL) - strncpy(fbuf2, fbuf, cp-fbuf+1); - strcat(fbuf2, RFTEMPLATE); + if (!strcmp(prvr, fbuf)) { /* rename */ + strcpy(fbuf2, fbuf); + for (cp = fbuf2; *cp; cp++) + ; + while (cp > fbuf2 && !ISDIRSEP(cp[-1])) + cp--; + strcpy(cp, RFTEMPLATE); prvr = mktemp(fbuf2); if (rename(fbuf, prvr) < 0 && errno != ENOENT) { sprintf(errmsg, @@ -237,6 +238,9 @@ char *pout, *zout, *prvr; "cannot open output file \"%s\"", fbuf); error(SYSTEM, errmsg); } +#ifdef MSDOS + setmode(fileno(stdout), O_BINARY); +#endif dupheader(); } hres = hresolu; vres = vresolu; pa = pixaspect; @@ -328,6 +332,9 @@ char *zfile, *oldfile; sprintf(errmsg, "cannot open z file \"%s\"", zfile); error(SYSTEM, errmsg); } +#ifdef MSDOS + setmode(zfd, O_BINARY); +#endif for (i = 0; i <= psample; i++) { zbar[i] = (float *)malloc(hres*sizeof(float)); if (zbar[i] == NULL) @@ -498,7 +505,6 @@ int x, y; int xlen, ylen; int b; { - extern double fabs(); double ratio; double z; COLOR ctmp; @@ -586,8 +592,11 @@ char *oldfile; error(WARNING, errmsg); return(0); } +#ifdef MSDOS + setmode(fileno(fp), O_BINARY); +#endif /* discard header */ - getheader(fp, NULL); + getheader(fp, NULL, NULL); /* get picture size */ if (!fscnresolu(&x, &y, fp)) { sprintf(errmsg, "bad recover file \"%s\"", oldfile);