45 |
|
double shadcert = .5; /* shadow certainty */ |
46 |
|
int directrelay = 1; /* number of source relays */ |
47 |
|
int vspretest = 512; /* virtual source pretest density */ |
48 |
< |
int directinvis = 0; /* sources invisible? */ |
48 |
> |
int directvis = 1; /* sources visible? */ |
49 |
|
double srcsizerat = .25; /* maximum ratio source size/dist. */ |
50 |
|
|
51 |
|
double specthresh = .15; /* specular sampling threshold */ |
149 |
|
} |
150 |
|
|
151 |
|
|
152 |
– |
closeheader() /* done with header output */ |
153 |
– |
{ |
154 |
– |
if (hfname == NULL) |
155 |
– |
return; |
156 |
– |
if (fflush(stdout) == EOF || (hfp = fopen(hfname, "r")) == NULL) |
157 |
– |
error(SYSTEM, "error reopening header file"); |
158 |
– |
} |
159 |
– |
|
160 |
– |
|
152 |
|
dupheader() /* repeat header on standard output */ |
153 |
|
{ |
154 |
|
register int c; |
155 |
|
|
156 |
< |
if (fseek(hfp, 0L, 0) < 0) |
156 |
> |
if (hfp == NULL) { |
157 |
> |
if ((hfp = fopen(hfname, "r")) == NULL) |
158 |
> |
error(SYSTEM, "error reopening header file"); |
159 |
> |
#ifdef MSDOS |
160 |
> |
setmode(fileno(hfp), O_BINARY); |
161 |
> |
#endif |
162 |
> |
} else if (fseek(hfp, 0L, 0) < 0) |
163 |
|
error(SYSTEM, "seek error on header file"); |
164 |
|
while ((c = getc(hfp)) != EOF) |
165 |
|
putchar(c); |
186 |
|
register char *cp; |
187 |
|
RESOLU rs; |
188 |
|
double pa; |
192 |
– |
/* finished writing header */ |
193 |
– |
closeheader(); |
189 |
|
/* check sampling */ |
190 |
|
if (psample < 1) |
191 |
|
psample = 1; |
209 |
|
error(USER, "unexpected EOF on view input"); |
210 |
|
prvr = fbuf; /* mark for renaming */ |
211 |
|
} |
212 |
< |
if (pout != NULL) { |
212 |
> |
if (pout != NULL & prvr != NULL) { |
213 |
|
sprintf(fbuf, pout, seq); |
214 |
< |
if (prvr != NULL && !strcmp(prvr, fbuf)) { /* rename */ |
215 |
< |
fbuf2[0] = '\0'; |
216 |
< |
if ((cp = rindex(fbuf, '/')) != NULL) |
217 |
< |
strncpy(fbuf2, fbuf, cp-fbuf+1); |
218 |
< |
strcat(fbuf2, RFTEMPLATE); |
214 |
> |
if (!strcmp(prvr, fbuf)) { /* rename */ |
215 |
> |
strcpy(fbuf2, fbuf); |
216 |
> |
for (cp = fbuf2; *cp; cp++) |
217 |
> |
; |
218 |
> |
while (cp > fbuf2 && !ISDIRSEP(cp[-1])) |
219 |
> |
cp--; |
220 |
> |
strcpy(cp, RFTEMPLATE); |
221 |
|
prvr = mktemp(fbuf2); |
222 |
|
if (rename(fbuf, prvr) < 0 && errno != ENOENT) { |
223 |
|
sprintf(errmsg, |
238 |
|
"cannot open output file \"%s\"", fbuf); |
239 |
|
error(SYSTEM, errmsg); |
240 |
|
} |
241 |
+ |
#ifdef MSDOS |
242 |
+ |
setmode(fileno(stdout), O_BINARY); |
243 |
+ |
#endif |
244 |
|
dupheader(); |
245 |
|
} |
246 |
|
hres = hresolu; vres = vresolu; pa = pixaspect; |
332 |
|
sprintf(errmsg, "cannot open z file \"%s\"", zfile); |
333 |
|
error(SYSTEM, errmsg); |
334 |
|
} |
335 |
+ |
#ifdef MSDOS |
336 |
+ |
setmode(zfd, O_BINARY); |
337 |
+ |
#endif |
338 |
|
for (i = 0; i <= psample; i++) { |
339 |
|
zbar[i] = (float *)malloc(hres*sizeof(float)); |
340 |
|
if (zbar[i] == NULL) |
592 |
|
error(WARNING, errmsg); |
593 |
|
return(0); |
594 |
|
} |
595 |
+ |
#ifdef MSDOS |
596 |
+ |
setmode(fileno(fp), O_BINARY); |
597 |
+ |
#endif |
598 |
|
/* discard header */ |
599 |
< |
getheader(fp, NULL); |
599 |
> |
getheader(fp, NULL, NULL); |
600 |
|
/* get picture size */ |
601 |
|
if (!fscnresolu(&x, &y, fp)) { |
602 |
|
sprintf(errmsg, "bad recover file \"%s\"", oldfile); |