ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/px/pcomb.c
(Generate patch)

Comparing ray/src/px/pcomb.c (file contents):
Revision 2.20 by greg, Thu Sep 19 12:10:46 1996 UTC vs.
Revision 2.26 by schorsch, Mon Jul 21 22:30:18 2003 UTC

# Line 1 | Line 1
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   *
# Line 11 | Line 8 | static char SCCSid[] = "$SunId$ LBL";
8   */
9  
10   #include "standard.h"
11 <
11 > #include "platform.h"
12   #include "color.h"
16
17 #include "resolu.h"
18
13   #include "calcomp.h"
20
14   #include "view.h"
15  
16   #define MAXINP          32              /* maximum number of input files */
17 < #define WINSIZ          17              /* scanline window size */
17 > #define WINSIZ          64              /* scanline window size */
18   #define MIDSCN          ((WINSIZ-1)/2+1)
19  
20   struct {
# Line 88 | Line 81 | char   *argv[];
81          int     original;
82          double  f;
83          int     a, i;
84 < #ifdef MSDOS
85 <        extern int  _fmode;
86 <        _fmode = O_BINARY;
94 <        setmode(fileno(stdin), O_BINARY);
95 <        setmode(fileno(stdout), O_BINARY);
96 < #endif
84 >        SET_DEFAULT_BINARY();
85 >        SET_FILE_BINARY(stdin);
86 >        SET_FILE_BINARY(stdout);
87          progname = argv[0];
88                                                  /* scan options */
89          for (a = 1; a < argc; a++) {
# Line 114 | Line 104 | char   *argv[];
104                  break;
105          }
106          newheader("RADIANCE", stdout);  /* start header */
107 +        fputnow(stdout);
108                                          /* process files */
109          for (nfiles = 0; nfiles < MAXINP; nfiles++) {
110                  setcolor(input[nfiles].coef, 1.0, 1.0, 1.0);
111                  setcolor(input[nfiles].expos, 1.0, 1.0, 1.0);
112 <                copystruct(&input[nfiles].vw, &stdview);
112 >                input[nfiles].vw = stdview;
113                  input[nfiles].pa = 1.0;
114          }
115          nfiles = 0;
# Line 171 | Line 162 | char   *argv[];
162                                          colval(input[nfiles].expos,GRN);
163                          colval(input[nfiles].coef,BLU) /=
164                                          colval(input[nfiles].expos,BLU);
165 +                        setcolor(input[nfiles].expos, 1.0, 1.0, 1.0);
166                  }
167                  nfiles++;
168                  original = 0;
# Line 227 | Line 219 | usage:
219   }
220  
221  
222 < tputs(s)                        /* put out string preceded by a tab */
222 > tabputs(s)                      /* put out string preceded by a tab */
223   char    *s;
224   {
225          char    fmt[32];
# Line 235 | Line 227 | char   *s;
227          COLOR   ctmp;
228  
229          if (isheadid(s))                        /* header id */
230 <                return;         /* don't echo */
230 >                return(0);      /* don't echo */
231          if (formatval(fmt, s)) {                /* check format */
232                  if (globmatch(ourfmt, fmt)) {
233                          wrongformat = 0;
234                          strcpy(ourfmt, fmt);
235                  } else
236 <                        wrongformat = 1;
237 <                return;         /* don't echo */
236 >                        wrongformat = globmatch(PICFMT, fmt) ? 1 : -1;
237 >                return(0);      /* don't echo */
238          }
239          if (isexpos(s)) {                       /* exposure */
240                  d = exposval(s);
# Line 256 | Line 248 | char   *s;
248                  gotview++;
249                                                  /* echo line */
250          putchar('\t');
251 <        fputs(s, stdout);
251 >        return(fputs(s, stdout));
252   }
253  
254  
# Line 267 | Line 259 | checkfile()                    /* ready a file */
259          gotview = 0;
260          fputs(input[nfiles].name, stdout);
261          fputs(":\n", stdout);
262 <        getheader(input[nfiles].fp, tputs, NULL);
263 <        if (wrongformat) {
262 >        getheader(input[nfiles].fp, tabputs, NULL);
263 >        if (wrongformat < 0) {
264                  eputs(input[nfiles].name);
265 <                eputs(": not in Radiance picture format\n");
265 >                eputs(": not a Radiance picture\n");
266                  quit(1);
267          }
268 +        if (wrongformat > 0) {
269 +                wputs(input[nfiles].name);
270 +                wputs(": warning -- incompatible picture format\n");
271 +        }
272          if (!gotview || setview(&input[nfiles].vw) != NULL)
273                  input[nfiles].vw.type = 0;
274          if (!fgetsresolu(&input[nfiles].rs, input[nfiles].fp)) {
# Line 397 | Line 393 | combine()                      /* combine pictures */
393                      quit(1);
394              }
395          }
396 <        efree(scanout);
396 >        efree((char *)scanout);
397   }
398  
399  
# Line 522 | Line 518 | register char  *nam;
518          static unsigned long    ltick[MAXINP];
519          static FVECT    lorg[MAXINP], ldir[MAXINP];
520          static double   ldist[MAXINP];
521 <        FLOAT   loc[2];
521 >        RREAL   loc[2];
522          int     fn;
523          register int    i;
524  
# Line 531 | Line 527 | register char  *nam;
527                  errno = EDOM;
528                  return(0.0);
529          }
530 <        if (ltick[fn] < eclock) {               /* need to compute? */
530 >        if (ltick[fn] != eclock) {              /* need to compute? */
531                  lorg[fn][0] = lorg[fn][1] = lorg[fn][2] = 0.0;
532                  ldir[fn][0] = ldir[fn][1] = ldir[fn][2] = 0.0;
533                  ldist[fn] = -1.0;
# Line 560 | Line 556 | l_psize()                      /* compute pixel size in steradians */
556          static unsigned long    ltick[MAXINP];
557          static double   psize[MAXINP];
558          FVECT   dir0, org, dirx, diry;
559 <        FLOAT   locx[2], locy[2];
559 >        RREAL   locx[2], locy[2];
560          double  d;
561          int     fn;
562          register int    i;
# Line 571 | Line 567 | l_psize()                      /* compute pixel size in steradians */
567                  return(0.0);
568          }
569          fn = d - .5;
570 <        if (ltick[fn] < eclock) {               /* need to compute? */
570 >        if (ltick[fn] != eclock) {              /* need to compute? */
571                  psize[fn] = 0.0;
572                  if (input[fn].vw.type == 0)
573                          errno = EDOM;
# Line 591 | Line 587 | l_psize()                      /* compute pixel size in steradians */
587                                          diry[i] -= dir0[i];
588                                  }
589                                  fcross(dir0, dirx, diry);
590 <                                psize[fn] = 0.5 * sqrt(DOT(dir0,dir0));
590 >                                psize[fn] = sqrt(DOT(dir0,dir0));
591                          }
592                  }
593                  ltick[fn] = eclock;
# Line 600 | Line 596 | l_psize()                      /* compute pixel size in steradians */
596   }
597  
598  
599 + void
600   wputs(msg)
601   char    *msg;
602   {
# Line 608 | Line 605 | char   *msg;
605   }
606  
607  
608 + void
609   eputs(msg)
610   char    *msg;
611   {
# Line 615 | Line 613 | char   *msg;
613   }
614  
615  
616 + void
617   quit(code)              /* exit gracefully */
618   int  code;
619   {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines