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.36 by greg, Wed Feb 16 03:26:33 2005 UTC vs.
Revision 2.41 by greg, Mon Nov 5 23:40:26 2007 UTC

# Line 14 | Line 14 | static const char      RCSid[] = "$Id$";
14   #include "calcomp.h"
15   #include "view.h"
16  
17 < #define MAXINP          32              /* maximum number of input files */
17 > #define MAXINP          512             /* maximum number of input files */
18   #define WINSIZ          64              /* scanline window size */
19   #define MIDSCN          ((WINSIZ-1)/2+1)
20  
# Line 68 | Line 68 | int    xpos, ypos;                     /* output position */
68  
69   char    *progname;                      /* global argv[0] */
70  
71 + int     echoheader = 1;
72   int     wrongformat = 0;
73   int     gotview;
74  
75  
76 < static gethfunc tabputs;
76 > static gethfunc headline;
77   static void checkfile(void);
78   static double rgb_bright(COLOR  clr);
79   static double xyz_bright(COLOR  clr);
# Line 110 | Line 111 | main(
111                          case 'w':
112                                  nowarn = !nowarn;
113                                  continue;
114 +                        case 'h':
115 +                                echoheader = !echoheader;
116 +                                continue;
117                          case 'f':
118                          case 'e':
119                                  a++;
# Line 194 | Line 198 | main(
198                                  continue;
199                          case 'w':
200                                  continue;
201 +                        case 'h':
202 +                                continue;
203                          case 'f':
204                                  fcompile(argv[++a]);
205                                  continue;
# Line 228 | Line 234 | usage:
234          eputs("Usage: ");
235          eputs(argv[0]);
236          eputs(
237 < " [-w][-x xr][-y yr][-e expr][-f file] [ [-o][-s f][-c r g b] pic ..]\n");
237 > " [-w][-h][-x xr][-y yr][-e expr][-f file] [ [-o][-s f][-c r g b] pic ..]\n");
238          quit(1);
239          return 1; /* pro forma return */
240   }
241  
242  
243   static int
244 < tabputs(                        /* put out string preceded by a tab */
244 > headline(                       /* check header line & echo if requested */
245          char    *s,
246          void    *p
247   )
# Line 264 | Line 270 | tabputs(                       /* put out string preceded by a tab */
270                  input[nfiles].pa *= aspectval(s);
271          else if (isview(s) && sscanview(&input[nfiles].vw, s) > 0)
272                  gotview++;
273 <                                                /* echo line */
274 <        putchar('\t');
275 <        return(fputs(s, stdout));
273 >
274 >        if (echoheader) {                       /* echo line */
275 >                putchar('\t');
276 >                return(fputs(s, stdout));
277 >        }
278 >        return(0);
279   }
280  
281  
# Line 276 | Line 285 | checkfile(void)                        /* ready a file */
285          register int    i;
286                                          /* process header */
287          gotview = 0;
288 <        fputs(input[nfiles].name, stdout);
289 <        fputs(":\n", stdout);
290 <        getheader(input[nfiles].fp, tabputs, NULL);
288 >        if (echoheader) {
289 >                fputs(input[nfiles].name, stdout);
290 >                fputs(":\n", stdout);
291 >        }
292 >        getheader(input[nfiles].fp, headline, NULL);
293          if (wrongformat < 0) {
294                  eputs(input[nfiles].name);
295                  eputs(": not a Radiance picture\n");
# Line 387 | Line 398 | combine(void)                  /* combine pictures */
398              advance();
399              varset(vypos, '=', (double)ypos);
400              for (xpos = 0; xpos < xres; xpos++) {
401 <                xscan = (long)xpos*xmax/xres;
401 >                xscan = (xpos+.5)*xmax/xres - .4999;
402                  varset(vxpos, '=', (double)xpos);
403                  eclock++;
404                  if (brtdef != NULL) {
# Line 426 | Line 437 | advance(void)                  /* read in data for next scanline */
437          register COLOR  *st;
438          register int    i, j;
439  
440 <        for (ytarget = (long)ypos*ymax/yres; yscan > ytarget; yscan--)
440 >        for (ytarget = (ypos+.5)*ymax/yres - .4999; yscan > ytarget; yscan--)
441                  for (i = 0; i < nfiles; i++) {
442                          st = input[i].scan[WINSIZ-1];
443                          for (j = WINSIZ-1; j > 0; j--)  /* rotate window */
# Line 439 | Line 450 | advance(void)                  /* read in data for next scanline */
450                                  eputs(": read error\n");
451                                  quit(1);
452                          }
453 <                        if (fabs(colval(input[i].coef,RED)-1.0) > 1e-3 ||
454 <                                fabs(colval(input[i].coef,GRN)-1.0) > 1e-3 ||
444 <                                fabs(colval(input[i].coef,BLU)-1.0) > 1e-3)
445 <                                for (j = 0; j < xmax; j++)  /* adjust color */
446 <                                        multcolor(st[j], input[i].coef);
453 >                        for (j = 0; j < xmax; j++)      /* adjust color */
454 >                                multcolor(st[j], input[i].coef);
455                  }
456   }
457  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines