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.27 by greg, Mon Aug 4 22:37:53 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 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 + void
601   wputs(msg)
602   char    *msg;
603   {
# Line 608 | Line 606 | char   *msg;
606   }
607  
608  
609 + void
610   eputs(msg)
611   char    *msg;
612   {
# Line 615 | Line 614 | char   *msg;
614   }
615  
616  
617 + void
618   quit(code)              /* exit gracefully */
619   int  code;
620   {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines