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.30 by schorsch, Fri Jan 2 12:47:01 2004 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   *
7   *      1/4/89
8   */
9  
10 < #include "standard.h"
11 <
10 > #include "platform.h"
11 > #include "rtprocess.h"
12 > #include "rterror.h"
13   #include "color.h"
16
17 #include "resolu.h"
18
14   #include "calcomp.h"
20
15   #include "view.h"
16  
17   #define MAXINP          32              /* maximum number of input files */
18 < #define WINSIZ          17              /* scanline window size */
18 > #define WINSIZ          64              /* scanline window size */
19   #define MIDSCN          ((WINSIZ-1)/2+1)
20  
21   struct {
# Line 76 | Line 70 | char   *progname;                      /* global argv[0] */
70   int     wrongformat = 0;
71   int     gotview;
72  
79 FILE    *popen();
73  
74   extern char     *emalloc();
75  
76 + static gethfunc tabputs;
77  
78   main(argc, argv)
79   int     argc;
# Line 88 | Line 82 | char   *argv[];
82          int     original;
83          double  f;
84          int     a, i;
85 < #ifdef MSDOS
86 <        extern int  _fmode;
87 <        _fmode = O_BINARY;
94 <        setmode(fileno(stdin), O_BINARY);
95 <        setmode(fileno(stdout), O_BINARY);
96 < #endif
85 >        SET_DEFAULT_BINARY();
86 >        SET_FILE_BINARY(stdin);
87 >        SET_FILE_BINARY(stdout);
88          progname = argv[0];
89                                                  /* scan options */
90          for (a = 1; a < argc; a++) {
# Line 114 | Line 105 | char   *argv[];
105                  break;
106          }
107          newheader("RADIANCE", stdout);  /* start header */
108 +        fputnow(stdout);
109                                          /* process files */
110          for (nfiles = 0; nfiles < MAXINP; nfiles++) {
111                  setcolor(input[nfiles].coef, 1.0, 1.0, 1.0);
112                  setcolor(input[nfiles].expos, 1.0, 1.0, 1.0);
113 <                copystruct(&input[nfiles].vw, &stdview);
113 >                input[nfiles].vw = stdview;
114                  input[nfiles].pa = 1.0;
115          }
116          nfiles = 0;
# Line 171 | Line 163 | char   *argv[];
163                                          colval(input[nfiles].expos,GRN);
164                          colval(input[nfiles].coef,BLU) /=
165                                          colval(input[nfiles].expos,BLU);
166 +                        setcolor(input[nfiles].expos, 1.0, 1.0, 1.0);
167                  }
168                  nfiles++;
169                  original = 0;
# Line 227 | Line 220 | usage:
220   }
221  
222  
223 < tputs(s)                        /* put out string preceded by a tab */
224 < char    *s;
223 > static int
224 > tabputs(                        /* put out string preceded by a tab */
225 >        char    *s,
226 >        void    *p
227 > )
228   {
229          char    fmt[32];
230          double  d;
231          COLOR   ctmp;
232  
233          if (isheadid(s))                        /* header id */
234 <                return;         /* don't echo */
234 >                return(0);      /* don't echo */
235          if (formatval(fmt, s)) {                /* check format */
236                  if (globmatch(ourfmt, fmt)) {
237                          wrongformat = 0;
238                          strcpy(ourfmt, fmt);
239                  } else
240 <                        wrongformat = 1;
241 <                return;         /* don't echo */
240 >                        wrongformat = globmatch(PICFMT, fmt) ? 1 : -1;
241 >                return(0);      /* don't echo */
242          }
243          if (isexpos(s)) {                       /* exposure */
244                  d = exposval(s);
# Line 256 | Line 252 | char   *s;
252                  gotview++;
253                                                  /* echo line */
254          putchar('\t');
255 <        fputs(s, stdout);
255 >        return(fputs(s, stdout));
256   }
257  
258  
# Line 267 | Line 263 | checkfile()                    /* ready a file */
263          gotview = 0;
264          fputs(input[nfiles].name, stdout);
265          fputs(":\n", stdout);
266 <        getheader(input[nfiles].fp, tputs, NULL);
267 <        if (wrongformat) {
266 >        getheader(input[nfiles].fp, tabputs, NULL);
267 >        if (wrongformat < 0) {
268                  eputs(input[nfiles].name);
269 <                eputs(": not in Radiance picture format\n");
269 >                eputs(": not a Radiance picture\n");
270                  quit(1);
271          }
272 +        if (wrongformat > 0) {
273 +                wputs(input[nfiles].name);
274 +                wputs(": warning -- incompatible picture format\n");
275 +        }
276          if (!gotview || setview(&input[nfiles].vw) != NULL)
277                  input[nfiles].vw.type = 0;
278          if (!fgetsresolu(&input[nfiles].rs, input[nfiles].fp)) {
# Line 316 | Line 316 | double (*ourbright)() = rgb_bright;
316  
317   init()                                  /* perform final setup */
318   {
319 <        double  l_colin(), l_expos(), l_pixaspect(), l_ray(), l_psize();
319 >        double  l_colin(char *), l_expos(char *), l_pixaspect(char *),
320 >                        l_ray(char *), l_psize(char *);
321          register int    i;
322                                                  /* define constants */
323          varset("PI", ':', PI);
# Line 397 | Line 398 | combine()                      /* combine pictures */
398                      quit(1);
399              }
400          }
401 <        efree(scanout);
401 >        efree((char *)scanout);
402   }
403  
404  
# Line 450 | Line 451 | register char  *nam;
451  
452  
453   double
454 < l_pixaspect()                   /* return pixel aspect ratio */
454 > l_pixaspect(char *nm)           /* return pixel aspect ratio */
455   {
456          register int    fn;
457  
# Line 522 | Line 523 | register char  *nam;
523          static unsigned long    ltick[MAXINP];
524          static FVECT    lorg[MAXINP], ldir[MAXINP];
525          static double   ldist[MAXINP];
526 <        FLOAT   loc[2];
526 >        RREAL   loc[2];
527          int     fn;
528          register int    i;
529  
# Line 531 | Line 532 | register char  *nam;
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;
# Line 555 | Line 556 | register char  *nam;
556  
557  
558   double
559 < l_psize()                       /* compute pixel size in steradians */
559 > l_psize(char *nm)               /* compute pixel size in steradians */
560   {
561          static unsigned long    ltick[MAXINP];
562          static double   psize[MAXINP];
563          FVECT   dir0, org, dirx, diry;
564 <        FLOAT   locx[2], locy[2];
564 >        RREAL   locx[2], locy[2];
565          double  d;
566          int     fn;
567          register int    i;
# Line 571 | Line 572 | l_psize()                      /* compute pixel size in steradians */
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;
# Line 591 | Line 592 | l_psize()                      /* compute pixel size in steradians */
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;
# Line 600 | Line 601 | l_psize()                      /* compute pixel size in steradians */
601   }
602  
603  
604 < wputs(msg)
605 < char    *msg;
604 > extern void
605 > wputs(char      *msg)
606   {
607          if (!nowarn)
608                  eputs(msg);
609   }
610  
611  
612 < eputs(msg)
613 < char    *msg;
612 > extern void
613 > eputs(char *msg)
614   {
615          fputs(msg, stderr);
616   }
617  
618  
619 < quit(code)              /* exit gracefully */
620 < int  code;
619 > extern void
620 > quit(int code)          /* exit gracefully */
621   {
622          register int  i;
623                                  /* close input files */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines