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.10 by greg, Thu Apr 29 14:32:07 1993 UTC vs.
Revision 2.16 by greg, Mon Oct 16 12:04:33 1995 UTC

# Line 21 | Line 21 | static char SCCSid[] = "$SunId$ LBL";
21   #include "view.h"
22  
23   #define MAXINP          32              /* maximum number of input files */
24 < #define WINSIZ          9               /* scanline window size */
25 < #define MIDSCN          4               /* current scan position */
24 > #define WINSIZ          17              /* scanline window size */
25 > #define MIDSCN          ((WINSIZ-1)/2+1)
26  
27   struct {
28          char    *name;          /* file or command name */
# Line 36 | Line 36 | struct {
36  
37   int     nfiles;                         /* number of input files */
38  
39 + char    ourfmt[LPICFMT+1] = PICFMT;     /* input picture format */
40 +
41   char    Command[] = "<Command>";
42   char    vcolin[3][4] = {"ri", "gi", "bi"};
43   char    vcolout[3][4] = {"ro", "go", "bo"};
# Line 106 | Line 108 | char   *argv[];
108                          }
109                  break;
110          }
111 +        newheader("RADIANCE", stdout);  /* start header */
112                                          /* process files */
113          for (nfiles = 0; nfiles < MAXINP; nfiles++) {
114                  setcolor(input[nfiles].coef, 1.0, 1.0, 1.0);
# Line 202 | Line 205 | char   *argv[];
205          }
206                                                  /* complete header */
207          printargs(argc, argv, stdout);
208 <        fputformat(COLRFMT, stdout);
208 >        if (strcmp(ourfmt, PICFMT))
209 >                fputformat(ourfmt, stdout);     /* print format if known */
210          putchar('\n');
211          fprtresolu(xres, yres, stdout);
212                                                  /* combine pictures */
# Line 224 | Line 228 | char   *s;
228          double  d;
229          COLOR   ctmp;
230  
231 <        if (isformat(s)) {                      /* check format */
228 <                formatval(fmt, s);
229 <                wrongformat = strcmp(fmt, COLRFMT);
231 >        if (isheadid(s))                        /* header id */
232                  return;         /* don't echo */
233 +        if (formatval(fmt, s)) {                /* check format */
234 +                if (globmatch(ourfmt, fmt)) {
235 +                        wrongformat = 0;
236 +                        strcpy(ourfmt, fmt);
237 +                } else
238 +                        wrongformat = 1;
239 +                return;         /* don't echo */
240          }
241          if (isexpos(s)) {                       /* exposure */
242                  d = exposval(s);
# Line 278 | Line 287 | checkfile()                    /* ready a file */
287   }
288  
289  
290 + double
291 + rgb_bright(clr)
292 + COLOR  clr;
293 + {
294 +        return(bright(clr));
295 + }
296 +
297 +
298 + double
299 + xyz_bright(clr)
300 + COLOR  clr;
301 + {
302 +        return(clr[CIEY]);
303 + }
304 +
305 +
306 + double  (*ourbright)() = rgb_bright;
307 +
308 +
309   init()                                  /* perform final setup */
310   {
311          double  l_colin(), l_expos(), l_ray();
# Line 295 | Line 323 | init()                                 /* perform final setup */
323          funset(vbrtin, 1, '=', l_colin);
324          for (i = 0; i < 6; i++)
325                  funset(vray[i], 1, '=', l_ray);
326 +                                                /* set brightness function */
327 +        if (!strcmp(ourfmt, CIEFMT))
328 +                ourbright = xyz_bright;
329   }
330  
331  
# Line 394 | Line 425 | register char  *nam;
425          if (fn < 0 || fn >= nfiles)
426                  return(1.0);
427          if (nam == vbrtexp)
428 <                return(bright(input[fn].expos));
428 >                return((*ourbright)(input[fn].expos));
429          n = 3;
430          while (n--)
431                  if (nam == vcolexp[n])
# Line 451 | Line 482 | register char  *nam;
482                  }
483          }
484          if (nam == vbrtin)
485 <                return(bright(input[fn].scan[MIDSCN+yoff][xscan+xoff]));
485 >                return((*ourbright)(input[fn].scan[MIDSCN+yoff][xscan+xoff]));
486          n = 3;
487          while (n--)
488              if (nam == vcolin[n])
# Line 465 | Line 496 | double
496   l_ray(nam)              /* return ray origin or direction */
497   register char   *nam;
498   {
499 <        static long     ltick[MAXINP];
499 >        static unsigned long    ltick[MAXINP];
500          static FVECT    lorg[MAXINP], ldir[MAXINP];
501          FLOAT   loc[2];
502          double  d;
# Line 484 | Line 515 | register char  *nam;
515                  lorg[fn][0] = lorg[fn][1] = lorg[fn][2] = 0.0;
516                  ldir[fn][0] = ldir[fn][1] = ldir[fn][2] = 0.0;
517                  if (input[fn].vw.type == 0)
518 <                        errno = ERANGE;
518 >                        errno = EDOM;
519                  else {
520 <                        pix2loc(loc, &input[fn].rs, xpos, ypos);
520 >                        pix2loc(loc, &input[fn].rs, xscan, ymax-1-yscan);
521                          if (viewray(lorg[fn], ldir[fn],
522                                          &input[fn].vw, loc[0], loc[1]) < 0)
523                                  errno = ERANGE;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines