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.21 by gwlarson, Tue Oct 27 09:08:25 1998 UTC vs.
Revision 2.29 by schorsch, Mon Oct 27 10:24:51 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   *
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  
# 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 241 | Line 233 | char   *s;
233                          wrongformat = 0;
234                          strcpy(ourfmt, fmt);
235                  } else
236 <                        wrongformat = 1;
236 >                        wrongformat = globmatch(PICFMT, fmt) ? 1 : -1;
237                  return(0);      /* don't echo */
238          }
239          if (isexpos(s)) {                       /* exposure */
# 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 316 | Line 312 | double (*ourbright)() = rgb_bright;
312  
313   init()                                  /* perform final setup */
314   {
315 <        double  l_colin(), l_expos(), l_pixaspect(), l_ray(), l_psize();
315 >        double  l_colin(char *), l_expos(char *), l_pixaspect(char *),
316 >                        l_ray(char *), l_psize(char *);
317          register int    i;
318                                                  /* define constants */
319          varset("PI", ':', PI);
# Line 397 | Line 394 | combine()                      /* combine pictures */
394                      quit(1);
395              }
396          }
397 <        efree(scanout);
397 >        efree((char *)scanout);
398   }
399  
400  
# Line 450 | Line 447 | register char  *nam;
447  
448  
449   double
450 < l_pixaspect()                   /* return pixel aspect ratio */
450 > l_pixaspect(char *nm)           /* return pixel aspect ratio */
451   {
452          register int    fn;
453  
# Line 522 | Line 519 | register char  *nam;
519          static unsigned long    ltick[MAXINP];
520          static FVECT    lorg[MAXINP], ldir[MAXINP];
521          static double   ldist[MAXINP];
522 <        FLOAT   loc[2];
522 >        RREAL   loc[2];
523          int     fn;
524          register int    i;
525  
# Line 531 | Line 528 | register char  *nam;
528                  errno = EDOM;
529                  return(0.0);
530          }
531 <        if (ltick[fn] < eclock) {               /* need to compute? */
531 >        if (ltick[fn] != eclock) {              /* need to compute? */
532                  lorg[fn][0] = lorg[fn][1] = lorg[fn][2] = 0.0;
533                  ldir[fn][0] = ldir[fn][1] = ldir[fn][2] = 0.0;
534                  ldist[fn] = -1.0;
# Line 555 | Line 552 | register char  *nam;
552  
553  
554   double
555 < l_psize()                       /* compute pixel size in steradians */
555 > l_psize(char *nm)               /* compute pixel size in steradians */
556   {
557          static unsigned long    ltick[MAXINP];
558          static double   psize[MAXINP];
559          FVECT   dir0, org, dirx, diry;
560 <        FLOAT   locx[2], locy[2];
560 >        RREAL   locx[2], locy[2];
561          double  d;
562          int     fn;
563          register int    i;
# Line 571 | Line 568 | l_psize()                      /* compute pixel size in steradians */
568                  return(0.0);
569          }
570          fn = d - .5;
571 <        if (ltick[fn] < eclock) {               /* need to compute? */
571 >        if (ltick[fn] != eclock) {              /* need to compute? */
572                  psize[fn] = 0.0;
573                  if (input[fn].vw.type == 0)
574                          errno = EDOM;
# Line 591 | Line 588 | l_psize()                      /* compute pixel size in steradians */
588                                          diry[i] -= dir0[i];
589                                  }
590                                  fcross(dir0, dirx, diry);
591 <                                psize[fn] = 0.5 * sqrt(DOT(dir0,dir0));
591 >                                psize[fn] = sqrt(DOT(dir0,dir0));
592                          }
593                  }
594                  ltick[fn] = eclock;
# Line 600 | Line 597 | l_psize()                      /* compute pixel size in steradians */
597   }
598  
599  
600 < wputs(msg)
601 < char    *msg;
600 > extern void
601 > wputs(char      *msg)
602   {
603          if (!nowarn)
604                  eputs(msg);
605   }
606  
607  
608 < eputs(msg)
609 < char    *msg;
608 > extern void
609 > eputs(char *msg)
610   {
611          fputs(msg, stderr);
612   }
613  
614  
615 < quit(code)              /* exit gracefully */
616 < int  code;
615 > extern void
616 > quit(int code)          /* exit gracefully */
617   {
618          register int  i;
619                                  /* close input files */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines