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.16 by greg, Mon Oct 16 12:04:33 1995 UTC vs.
Revision 2.17 by greg, Fri Aug 30 17:39:39 1996 UTC

# Line 29 | Line 29 | struct {
29          FILE    *fp;            /* stream pointer */
30          VIEW    vw;             /* view for picture */
31          RESOLU  rs;             /* image resolution and orientation */
32 +        float   pa;             /* pixel aspect ratio */
33          COLOR   *scan[WINSIZ];  /* input scanline window */
34          COLOR   coef;           /* coefficient */
35          COLOR   expos;          /* recorded exposure */
# Line 48 | Line 49 | char   vbrtexp[] = "le";
49  
50   char    vray[6][4] = {"Ox", "Oy", "Oz", "Dx", "Dy", "Dz"};
51  
52 + char    vpsize[] = "S";
53 +
54   char    vnfiles[] = "nfiles";
55   char    vxmax[] = "xmax";
56   char    vymax[] = "ymax";
# Line 114 | Line 117 | char   *argv[];
117                  setcolor(input[nfiles].coef, 1.0, 1.0, 1.0);
118                  setcolor(input[nfiles].expos, 1.0, 1.0, 1.0);
119                  copystruct(&input[nfiles].vw, &stdview);
120 +                input[nfiles].pa = 1.0;
121          }
122          nfiles = 0;
123          original = 0;
# Line 244 | Line 248 | char   *s;
248          } else if (iscolcor(s)) {               /* color correction */
249                  colcorval(ctmp, s);
250                  multcolor(input[nfiles].expos, ctmp);
251 +        } else if (isaspect(s)) {
252 +                input[nfiles].pa *= aspectval(s);
253          } else if (isview(s) && sscanview(&input[nfiles].vw, s) > 0)
254                  gotview++;
255                                                  /* echo line */
# Line 308 | Line 314 | double (*ourbright)() = rgb_bright;
314  
315   init()                                  /* perform final setup */
316   {
317 <        double  l_colin(), l_expos(), l_ray();
317 >        double  l_colin(), l_expos(), l_ray(), l_psize();
318          register int    i;
319                                                  /* define constants */
320          varset(vnfiles, ':', (double)nfiles);
# Line 323 | Line 329 | init()                                 /* perform final setup */
329          funset(vbrtin, 1, '=', l_colin);
330          for (i = 0; i < 6; i++)
331                  funset(vray[i], 1, '=', l_ray);
332 +        funset(vpsize, 1, '=', l_psize);
333                                                  /* set brightness function */
334          if (!strcmp(ourfmt, CIEFMT))
335                  ourbright = xyz_bright;
# Line 521 | Line 528 | register char  *nam;
528                          if (viewray(lorg[fn], ldir[fn],
529                                          &input[fn].vw, loc[0], loc[1]) < 0)
530                                  errno = ERANGE;
531 +                        ltick[fn] = eclock;
532                  }
525                ltick[fn] = eclock;
533          }
534          i = 6;
535          while (i--)
# Line 530 | Line 537 | register char  *nam;
537                          return(i < 3 ? lorg[fn][i] : ldir[fn][i-3]);
538          eputs("Bad call to l_ray()!\n");
539          quit(1);
540 + }
541 +
542 +
543 + double
544 + l_psize()                       /* compute pixel size in steradians */
545 + {
546 +        static unsigned long    ltick[MAXINP];
547 +        static double   psize[MAXINP];
548 +        FVECT   dir0, org1, dir1;
549 +        FLOAT   loc[2];
550 +        double  d;
551 +        int     fn;
552 +
553 +        d = argument(1);
554 +        if (d > -.5 && d < .5)
555 +                return((double)nfiles);
556 +        fn = d - .5;
557 +        if (fn < 0 || fn >= nfiles) {
558 +                errno = EDOM;
559 +                return(0.0);
560 +        }
561 +        if (ltick[fn] < eclock)                 /* need to compute? */
562 +                if (input[fn].vw.type == 0 || input[fn].vw.type == VT_PAR)
563 +                        errno = EDOM;
564 +                else {
565 +                        errno = 0;
566 +                        dir0[0] = funvalue(vray[3], 1, &d);
567 +                        if (errno)
568 +                                return(0.0);
569 +                        dir0[1] = funvalue(vray[4], 1, &d);
570 +                        if (errno)
571 +                                return(0.0);
572 +                        dir0[2] = funvalue(vray[5], 1, &d);
573 +                        if (errno)
574 +                                return(0.0);
575 +                        pix2loc(loc, &input[fn].rs, xscan+1, ymax-yscan);
576 +                        psize[fn] = 0.0;
577 +                        if (viewray(org1, dir1,
578 +                                        &input[fn].vw, loc[0], loc[1]) < 0)
579 +                                errno = ERANGE;
580 +                        else {
581 +                                                /* approximate solid angle */
582 +                                psize[fn] = dist2(dir0, dir1) * input[fn].pa /
583 +                                        (1.0 + input[fn].pa*input[fn].pa);
584 +                                ltick[fn] = eclock;
585 +                        }
586 +                }
587 +        return(psize[fn]);
588   }
589  
590  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines