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

Comparing ray/src/rt/rv3.c (file contents):
Revision 1.8 by greg, Wed Nov 1 16:12:20 1989 UTC vs.
Revision 1.9 by greg, Mon Jan 8 13:38:09 1990 UTC

# Line 27 | Line 27 | register RECT  *r;
27  
28          if (*s && !strncmp(s, "all", strlen(s))) {
29                  r->l = r->d = 0;
30 <                r->r = ourview.hresolu;
31 <                r->u = ourview.vresolu;
30 >                r->r = hresolu;
31 >                r->u = vresolu;
32                  return(0);
33          }
34          if (sscanf(s, "%d %d %d %d", &x0, &y0, &x1, &y1) != 4) {
# Line 57 | Line 57 | register RECT  *r;
57          }
58          if (r->l < 0) r->l = 0;
59          if (r->d < 0) r->d = 0;
60 <        if (r->r > ourview.hresolu) r->r = ourview.hresolu;
61 <        if (r->u > ourview.vresolu) r->u = ourview.vresolu;
60 >        if (r->r > hresolu) r->r = hresolu;
61 >        if (r->u > vresolu) r->u = vresolu;
62          if (r->l > r->r) r->l = r->r;
63          if (r->d > r->u) r->d = r->u;
64          return(0);
# Line 89 | Line 89 | double  *mp;
89                  (*dev->comout)("Pick view center\n");
90                  if ((*dev->getcur)(&x, &y) == ABORT)
91                          return(-1);
92 <                rayview(thisray.rorg, thisray.rdir, &ourview, x+.5, y+.5);
92 >                viewray(thisray.rorg, thisray.rdir, &ourview,
93 >                                (x+.5)/hresolu, (y+.5)/vresolu);
94                  if (!direc || ourview.type == VT_PAR) {
95                          rayorigin(&thisray, NULL, PRIMARY, 1.0);
96                          if (!localhit(&thisray, &thescene)) {
# Line 141 | Line 142 | int  xmin, ymin, xmax, ymax;
142          }
143                                                  /* jitter ray direction */
144          p->x = h = xmin + (xmax-xmin)*frandom();
145 +        h /= hresolu;
146          p->y = v = ymin + (ymax-ymin)*frandom();
147 +        v /= vresolu;
148          
149 <        rayview(thisray.rorg, thisray.rdir, &ourview, h, v);
149 >        viewray(thisray.rorg, thisray.rdir, &ourview, h, v);
150  
151          rayorigin(&thisray, NULL, PRIMARY, 1.0);
152          
# Line 161 | Line 164 | newimage()                             /* start a new image */
164   {
165                                                  /* free old image */
166          freepkids(&ptrunk);
167 <                                                /* set up frame */
168 <        if (ourview.hresolu > dev->xsiz || ourview.vresolu > dev->ysiz)
169 <                newview(&ourview);              /* beware recursive loop! */
167 >                                                /* compute resolution */
168 >        if (viewaspect(&ourview)*dev->xsiz > dev->pixaspect*dev->ysiz) {
169 >                vresolu = dev->ysiz;
170 >                hresolu = vresolu/viewaspect(&ourview)*dev->pixaspect;
171 >        } else {
172 >                hresolu = dev->xsiz;
173 >                vresolu = hresolu*viewaspect(&ourview)/dev->pixaspect;
174 >        }
175          pframe.l = pframe.d = 0;
176 <        pframe.r = ourview.hresolu; pframe.u = ourview.vresolu;
176 >        pframe.r = hresolu; pframe.u = vresolu;
177          pdepth = 0;
178                                                  /* clear device */
179 <        (*dev->clear)(ourview.hresolu, ourview.vresolu);
179 >        (*dev->clear)(hresolu, vresolu);
180                                                  /* get first value */
181 <        paint(&ptrunk, 0, 0, ourview.hresolu, ourview.vresolu);
181 >        paint(&ptrunk, 0, 0, hresolu, vresolu);
182   }
183  
184  
185   redraw()                                /* redraw the image */
186   {
187 <        (*dev->clear)(ourview.hresolu, ourview.vresolu);
187 >        (*dev->clear)(hresolu, vresolu);
188          (*dev->comout)("redrawing...\n");
189 <        repaint(0, 0, ourview.hresolu, ourview.vresolu);
189 >        repaint(0, 0, hresolu, vresolu);
190          (*dev->comout)("\n");
191   }
192  
# Line 191 | Line 199 | int  xmin, ymin, xmax, ymax;
199          reg.l = xmin; reg.r = xmax;
200          reg.d = ymin; reg.u = ymax;
201  
202 <        paintrect(&ptrunk, 0, 0, ourview.hresolu, ourview.vresolu, &reg);
202 >        paintrect(&ptrunk, 0, 0, hresolu, vresolu, &reg);
203   }
204  
205  
# Line 339 | Line 347 | register VIEW  *vp;
347   {
348          char  *err;
349  
342        if (vp->hresolu > dev->xsiz || vp->vresolu > dev->ysiz) /* shrink */
343                if (vp->vresolu * dev->xsiz < vp->hresolu * dev->ysiz) {
344                        vp->vresolu = dev->xsiz * vp->vresolu / vp->hresolu;
345                        vp->hresolu = dev->xsiz;
346                } else {
347                        vp->hresolu = dev->ysiz * vp->hresolu / vp->vresolu;
348                        vp->vresolu = dev->ysiz;
349                }
350          if ((err = setview(vp)) != NULL) {
351                  sprintf(errmsg, "view not set - %s", err);
352                  error(COMMAND, errmsg);
353          } else if (bcmp(vp, &ourview, sizeof(VIEW))) {
354 <                bcopy(&ourview, &oldview, sizeof(VIEW));
355 <                bcopy(vp, &ourview, sizeof(VIEW));
354 >                copyview(&oldview, &ourview);
355 >                copyview(&ourview, vp);
356                  newimage();             /* newimage() calls with vp=&ourview! */
357          }
358   }
# Line 369 | Line 369 | FVECT  vc;
369          register int  i;
370  
371          VCOPY(nv.vup, ourview.vup);
372 <        nv.hresolu = ourview.hresolu; nv.vresolu = ourview.vresolu;
372 >        nv.hoff = ourview.hoff; nv.voff = ourview.voff;
373          spinvector(nv.vdir, ourview.vdir, ourview.vup, angle*(PI/180.));
374          if (elev != 0.0) {
375                  fcross(v1, ourview.vup, nv.vdir);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines