1 |
– |
/* Copyright (c) 1992 Regents of the University of California */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ LBL"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* Combine picture files according to calcomp functions. |
6 |
|
* |
11 |
|
|
12 |
|
#include "color.h" |
13 |
|
|
17 |
– |
#include "resolu.h" |
18 |
– |
|
14 |
|
#include "calcomp.h" |
15 |
|
|
16 |
|
#include "view.h" |
17 |
|
|
18 |
|
#define MAXINP 32 /* maximum number of input files */ |
19 |
< |
#define WINSIZ 17 /* scanline window size */ |
19 |
> |
#define WINSIZ 64 /* scanline window size */ |
20 |
|
#define MIDSCN ((WINSIZ-1)/2+1) |
21 |
|
|
22 |
|
struct { |
109 |
|
break; |
110 |
|
} |
111 |
|
newheader("RADIANCE", stdout); /* start header */ |
112 |
+ |
fputnow(stdout); |
113 |
|
/* process files */ |
114 |
|
for (nfiles = 0; nfiles < MAXINP; nfiles++) { |
115 |
|
setcolor(input[nfiles].coef, 1.0, 1.0, 1.0); |
167 |
|
colval(input[nfiles].expos,GRN); |
168 |
|
colval(input[nfiles].coef,BLU) /= |
169 |
|
colval(input[nfiles].expos,BLU); |
170 |
+ |
setcolor(input[nfiles].expos, 1.0, 1.0, 1.0); |
171 |
|
} |
172 |
|
nfiles++; |
173 |
|
original = 0; |
224 |
|
} |
225 |
|
|
226 |
|
|
227 |
< |
tputs(s) /* put out string preceded by a tab */ |
227 |
> |
tabputs(s) /* put out string preceded by a tab */ |
228 |
|
char *s; |
229 |
|
{ |
230 |
|
char fmt[32]; |
232 |
|
COLOR ctmp; |
233 |
|
|
234 |
|
if (isheadid(s)) /* header id */ |
235 |
< |
return; /* don't echo */ |
235 |
> |
return(0); /* don't echo */ |
236 |
|
if (formatval(fmt, s)) { /* check format */ |
237 |
|
if (globmatch(ourfmt, fmt)) { |
238 |
|
wrongformat = 0; |
239 |
|
strcpy(ourfmt, fmt); |
240 |
|
} else |
241 |
< |
wrongformat = 1; |
242 |
< |
return; /* don't echo */ |
241 |
> |
wrongformat = globmatch(PICFMT, fmt) ? 1 : -1; |
242 |
> |
return(0); /* don't echo */ |
243 |
|
} |
244 |
|
if (isexpos(s)) { /* exposure */ |
245 |
|
d = exposval(s); |
253 |
|
gotview++; |
254 |
|
/* echo line */ |
255 |
|
putchar('\t'); |
256 |
< |
fputs(s, stdout); |
256 |
> |
return(fputs(s, stdout)); |
257 |
|
} |
258 |
|
|
259 |
|
|
264 |
|
gotview = 0; |
265 |
|
fputs(input[nfiles].name, stdout); |
266 |
|
fputs(":\n", stdout); |
267 |
< |
getheader(input[nfiles].fp, tputs, NULL); |
268 |
< |
if (wrongformat) { |
267 |
> |
getheader(input[nfiles].fp, tabputs, NULL); |
268 |
> |
if (wrongformat < 0) { |
269 |
|
eputs(input[nfiles].name); |
270 |
< |
eputs(": not in Radiance picture format\n"); |
270 |
> |
eputs(": not a Radiance picture\n"); |
271 |
|
quit(1); |
272 |
|
} |
273 |
+ |
if (wrongformat > 0) { |
274 |
+ |
wputs(input[nfiles].name); |
275 |
+ |
wputs(": warning -- incompatible picture format\n"); |
276 |
+ |
} |
277 |
|
if (!gotview || setview(&input[nfiles].vw) != NULL) |
278 |
|
input[nfiles].vw.type = 0; |
279 |
|
if (!fgetsresolu(&input[nfiles].rs, input[nfiles].fp)) { |
398 |
|
quit(1); |
399 |
|
} |
400 |
|
} |
401 |
< |
efree(scanout); |
401 |
> |
efree((char *)scanout); |
402 |
|
} |
403 |
|
|
404 |
|
|
532 |
|
errno = EDOM; |
533 |
|
return(0.0); |
534 |
|
} |
535 |
< |
if (ltick[fn] < eclock) { /* need to compute? */ |
535 |
> |
if (ltick[fn] != eclock) { /* need to compute? */ |
536 |
|
lorg[fn][0] = lorg[fn][1] = lorg[fn][2] = 0.0; |
537 |
|
ldir[fn][0] = ldir[fn][1] = ldir[fn][2] = 0.0; |
538 |
+ |
ldist[fn] = -1.0; |
539 |
|
if (input[fn].vw.type == 0) |
540 |
|
errno = EDOM; |
541 |
|
else { |
572 |
|
return(0.0); |
573 |
|
} |
574 |
|
fn = d - .5; |
575 |
< |
if (ltick[fn] < eclock) { /* need to compute? */ |
575 |
> |
if (ltick[fn] != eclock) { /* need to compute? */ |
576 |
|
psize[fn] = 0.0; |
577 |
|
if (input[fn].vw.type == 0) |
578 |
|
errno = EDOM; |
592 |
|
diry[i] -= dir0[i]; |
593 |
|
} |
594 |
|
fcross(dir0, dirx, diry); |
595 |
< |
psize[fn] = 0.5 * sqrt(DOT(dir0,dir0)); |
595 |
> |
psize[fn] = sqrt(DOT(dir0,dir0)); |
596 |
|
} |
597 |
|
} |
598 |
|
ltick[fn] = eclock; |
601 |
|
} |
602 |
|
|
603 |
|
|
604 |
+ |
void |
605 |
|
wputs(msg) |
606 |
|
char *msg; |
607 |
|
{ |
610 |
|
} |
611 |
|
|
612 |
|
|
613 |
+ |
void |
614 |
|
eputs(msg) |
615 |
|
char *msg; |
616 |
|
{ |
618 |
|
} |
619 |
|
|
620 |
|
|
621 |
+ |
void |
622 |
|
quit(code) /* exit gracefully */ |
623 |
|
int code; |
624 |
|
{ |