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

Comparing ray/src/hd/rhd_glx.c (file contents):
Revision 3.23 by gwlarson, Thu Aug 27 19:33:05 1998 UTC vs.
Revision 3.24 by gwlarson, Thu Dec 10 10:45:54 1998 UTC

# Line 21 | Line 21 | static char SCCSid[] = "$SunId$ SGI";
21   #endif
22  
23   #include "standard.h"
24 #include "rhd_sample.h"
24  
25   #include <sys/types.h>
26   #include <GL/glx.h>
# Line 29 | Line 28 | static char SCCSid[] = "$SunId$ SGI";
28   #ifdef STEREO
29   #include <X11/extensions/SGIStereo.h>
30   #endif
31 +
32 + #include "rhd_sample.h"
33   #ifdef DOBJ
34   #include "rhdobj.h"
35   #endif
# Line 36 | Line 37 | static char SCCSid[] = "$SunId$ SGI";
37   #include "x11icon.h"
38  
39   #ifndef RAYQLEN
40 < #define RAYQLEN         250             /* max. rays to queue before flush */
40 > #define RAYQLEN         1024            /* max. rays to queue before flush */
41   #endif
42  
43   #ifndef FEQ
# Line 45 | Line 46 | static char SCCSid[] = "$SunId$ SGI";
46  
47   #define GAMMA           1.4             /* default gamma correction */
48  
49 + #define FRAMESTATE(s)   (((s)&(ShiftMask|ControlMask))==(ShiftMask|ControlMask))
50 +
51   #define MOVPCT          7               /* percent distance to move /frame */
52   #define MOVDIR(b)       ((b)==Button1 ? 1 : (b)==Button2 ? 0 : -1)
53   #define MOVDEG          (-5)            /* degrees to orbit CW/down /frame */
# Line 74 | Line 77 | static char SCCSid[] = "$SunId$ SGI";
77  
78   struct driver   odev;                   /* global device driver structure */
79  
80 + char odev_args[64];                     /* command arguments */
81 +
82   #ifdef STEREO
83   static VIEW     vwright;                /* right eye view */
84   #endif
# Line 101 | Line 106 | static int     inpresflags;            /* input result flags */
106   static int      headlocked = 0;         /* lock vertical motion */
107  
108   static int  resizewindow(), getevent(), getkey(), moveview(), wipeclean(),
109 <                setglpersp(), getmove(), fixwindow(), mytmflags();
109 >                setglpersp(), getframe(), getmove(), fixwindow(), mytmflags();
110  
111   #ifdef STEREO
112   static int  pushright(), popright();
# Line 489 | Line 494 | getevent()                     /* get next event */
494                  getkey(levptr(XKeyPressedEvent));
495                  break;
496          case ButtonPress:
497 <                getmove(levptr(XButtonPressedEvent));
497 >                if (FRAMESTATE(levptr(XButtonPressedEvent)->state))
498 >                        getframe(levptr(XButtonPressedEvent));
499 >                else
500 >                        getmove(levptr(XButtonPressedEvent));
501                  break;
502          }
503   }
# Line 550 | Line 558 | int    dx, dy, mov, orb;
558                          return(0);      /* not on window */
559                  VCOPY(wip, rsL.wp[li]);
560   #endif
561 + #ifdef DEBUG
562 +                fprintf(stderr, "moveview: hit %s at (%f,%f,%f) (t=%f)\n",
563 +                                li < 0 ? "object" : "mesh",
564 +                                wip[0], wip[1], wip[2],
565 +                                (wip[0]-odev.v.vp[0])*odir[0] +
566 +                                (wip[1]-odev.v.vp[1])*odir[1] +
567 +                                (wip[2]-odev.v.vp[2])*odir[2]);
568 + #endif
569                  VSUM(odir, wip, odev.v.vp, -1.);
570          } else                  /* panning with constant viewpoint */
571                  VCOPY(nv.vdir, odir);
# Line 582 | Line 598 | int    dx, dy, mov, orb;
598  
599  
600   static
601 + getframe(ebut)                          /* get focus frame */
602 + XButtonPressedEvent     *ebut;
603 + {
604 +        int     startx = ebut->x, starty = ebut->y;
605 +        int     endx, endy;
606 +
607 +        XMaskEvent(ourdisplay, ButtonReleaseMask, levptr(XEvent));
608 +        endx = levptr(XButtonReleasedEvent)->x;
609 +        endy = levptr(XButtonReleasedEvent)->y;
610 +        if (endx == startx | endy == starty) {
611 +                XBell(ourdisplay, 0);
612 +                return;
613 +        }
614 +        if (endx < startx) {register int c = endx; endx = startx; startx = c;}
615 +        if (endy < starty) {register int c = endy; endy = starty; starty = c;}
616 +        sprintf(odev_args, "%.3f %.3f %.3f %.3f",
617 +                        (startx+.5)/odev.hres, 1.-(endy+.5)/odev.vres,
618 +                        (endx+.5)/odev.hres, 1.-(starty+.5)/odev.vres);
619 +        inpresflags |= DFL(DC_FOCUS);
620 + }
621 +
622 +
623 + static
624   getmove(ebut)                           /* get view change */
625   XButtonPressedEvent     *ebut;
626   {
# Line 718 | Line 757 | static
757   getkey(ekey)                            /* get input key */
758   register XKeyPressedEvent  *ekey;
759   {
760 +        Window  rootw, childw;
761 +        int     rootx, rooty, wx, wy;
762 +        unsigned int    statemask;
763          int  n;
764          char    buf[8];
765  
# Line 739 | Line 781 | register XKeyPressedEvent  *ekey;
781                  return;
782          case 'v':                       /* spit out view */
783                  inpresflags |= DFL(DC_GETVIEW);
784 +                return;
785 +        case 'f':                       /* frame view position */
786 +                if (!XQueryPointer(ourdisplay, gwind, &rootw, &childw,
787 +                                &rootx, &rooty, &wx, &wy, &statemask))
788 +                        return;         /* on another screen */
789 +                sprintf(odev_args, "%.4f %.4f", (wx+.5)/odev.hres,
790 +                                1.-(wy+.5)/odev.vres);
791 +                inpresflags |= DFL(DC_FOCUS);
792 +                return;
793 +        case 'F':                       /* unfocus */
794 +                odev_args[0] = '\0';
795 +                inpresflags |= DFL(DC_FOCUS);
796                  return;
797          case '\n':
798          case '\r':                      /* resume computation */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines