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

Comparing ray/src/hd/rhd_x11.c (file contents):
Revision 3.10 by gregl, Fri Dec 5 09:38:55 1997 UTC vs.
Revision 3.11 by gregl, Mon Dec 8 19:03:18 1997 UTC

# Line 18 | Line 18 | static char SCCSid[] = "$SunId$ SGI";
18  
19   #include  "x11icon.h"
20  
21 + #ifndef FEQ
22 + #define FEQ(a,b)        ((a)-(b) <= FTINY && (a)-(b) >= -FTINY)
23 + #endif
24 +
25   #define CTRL(c)         ((c)-'@')
26  
27   #define GAMMA           2.2             /* default gamma correction */
# Line 197 | Line 201 | dev_close()                    /* close our display */
201   dev_view(nv)                    /* assign new driver view */
202   VIEW    *nv;
203   {
204 <        if (nv != &odev.v)
204 >        if (nv != &odev.v) {
205 >                if (!FEQ(nv->horiz,odev.v.horiz) ||     /* resize window? */
206 >                                !FEQ(nv->vert,odev.v.vert)) {
207 >                        odev.hres = 2.*VIEWDIST*tan(PI/180./2.*nv->horiz) /
208 >                                        pwidth;
209 >                        odev.vres = 2.*VIEWDIST*tan(PI/180./2.*nv->vert) /
210 >                                        pheight;
211 >                        XResizeWindow(ourdisplay, gwind, odev.hres, odev.vres);
212 >                }
213                  copystruct(&odev.v, nv);
214 +        }
215          qtReplant();
216   }
217  
# Line 530 | Line 543 | register XKeyPressedEvent  *ekey;
543                  inpresflags |= DEV_WAIT;
544                  return;
545          case 'v':                       /* spit out view */
546 <                fputs(VIEWSTR, stderr);
534 <                fprintview(&odev.v, stderr);
535 <                fputc('\n', stderr);
546 >                inpresflags |= DEV_PUTVIEW;
547                  return;
548          case CTRL('Q'):
549          case '\n':
# Line 589 | Line 600 | register XConfigureEvent  *ersz;
600                  return;
601  
602          if (odev.hres != 0 && odev.vres != 0) {
603 <                odev.v.horiz = 2.*180./PI * atan(
604 <                        tan(PI/180./2.*odev.v.horiz) * ersz->width/odev.hres );
594 <                odev.v.vert = 2.*180./PI * atan(
595 <                        tan(PI/180./2.*odev.v.vert) * ersz->height/odev.vres );
603 >                odev.v.horiz = 2.*180./PI * atan(0.5/VIEWDIST*pwidth*odev.hres);
604 >                odev.v.vert = 2.*180./PI * atan(0.5/VIEWDIST*pheight*odev.vres);
605                  inpresflags |= DEV_NEWVIEW;
606          }
607          odev.hres = ersz->width;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines