ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/radiance/ray/src/common/image.c
(Generate patch)

Comparing ray/src/common/image.c (file contents):
Revision 1.5 by greg, Mon Jan 8 14:45:52 1990 UTC vs.
Revision 1.10 by greg, Thu Sep 13 08:34:15 1990 UTC

# Line 65 | Line 65 | register VIEW  *v;
65   }
66  
67  
68 + normaspect(va, ap, xp, yp)              /* fix pixel aspect or resolution */
69 + double  va;                     /* view aspect ratio */
70 + double  *ap;                    /* pixel aspect in (or out if 0) */
71 + int  *xp, *yp;                  /* x and y resolution in (or out if *ap!=0) */
72 + {
73 +        if (*ap <= FTINY)
74 +                *ap = va * *xp / *yp;           /* compute pixel aspect */
75 +        else if (va * *xp > *ap * *yp)
76 +                *xp = *yp / va * *ap + .5;      /* reduce x resolution */
77 +        else
78 +                *yp = *xp * va / *ap + .5;      /* reduce y resolution */
79 + }
80 +
81 +
82   viewray(orig, direc, v, x, y)           /* compute ray origin and direction */
83   FVECT  orig, direc;
84   register VIEW  *v;
# Line 129 | Line 143 | register char  *av[];
143   #define check(c,n)      if ((av[0][c]&&av[0][c]!=' ') || n>=ac) return(-1)
144          extern double  atof();
145  
146 <        if (av[0][0] != '-' || av[0][1] != 'v')
146 >        if (ac <= 0 || av[0][0] != '-' || av[0][1] != 'v')
147                  return(-1);
148          switch (av[0][2]) {
149          case 't':                       /* type */
# Line 191 | Line 205 | register char  *s;
205  
206          while (*s == ' ')
207                  s++;
208 <        do {
208 >        while (*s) {
209                  ac = 0;
210                  do {
211                          av[ac++] = s;
# Line 204 | Line 218 | register char  *s;
218                          if (na+1 < ac)
219                                  s = av[na+1];
220                          nvopts++;
221 <                }
222 <        } while (*s);
221 >                } else if (ac > 1)
222 >                        s = av[1];
223 >        }
224          return(nvopts);
225   }
226  
# Line 219 | Line 234 | FILE  *fp;
234          fprintf(fp, " -vd %.6g %.6g %.6g", vp->vdir[0], vp->vdir[1], vp->vdir[2]);
235          fprintf(fp, " -vu %.6g %.6g %.6g", vp->vup[0], vp->vup[1], vp->vup[2]);
236          fprintf(fp, " -vh %.6g -vv %.6g", vp->horiz, vp->vert);
237 <        fprintf(fp, " -vs %d -vl %d", vp->hoff, vp->voff);
237 >        fprintf(fp, " -vs %.6g -vl %.6g", vp->hoff, vp->voff);
238   }
239  
240  
# Line 244 | Line 259 | char  *s;
259  
260  
261   int
262 < viewfile(fname, vp)                     /* get view from file */
262 > viewfile(fname, vp, xp, yp)             /* get view from file */
263   char  *fname;
264   VIEW  *vp;
265 + int  *xp, *yp;
266   {
267          extern char  *progname;
268          FILE  *fp;
# Line 259 | Line 275 | VIEW  *vp;
275          gothview = 0;
276  
277          getheader(fp, gethview);
278 +
279 +        if (xp != NULL && yp != NULL
280 +                        && fgetresolu(xp, yp, fp) == -1)
281 +                gothview = 0;
282  
283          fclose(fp);
284  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines