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.25 by gwlarson, Fri Dec 18 11:56:09 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 315 | Line 320 | register VIEW  *nv;
320   }
321  
322  
323 + dev_section(ofn)                /* add octree for geometry rendering */
324 + char    *ofn;
325 + {
326 +        /* unimplemented */
327 + }
328 +
329 +
330   dev_auxcom(cmd, args)           /* process an auxiliary command */
331   char    *cmd, *args;
332   {
# Line 489 | Line 501 | getevent()                     /* get next event */
501                  getkey(levptr(XKeyPressedEvent));
502                  break;
503          case ButtonPress:
504 <                getmove(levptr(XButtonPressedEvent));
504 >                if (FRAMESTATE(levptr(XButtonPressedEvent)->state))
505 >                        getframe(levptr(XButtonPressedEvent));
506 >                else
507 >                        getmove(levptr(XButtonPressedEvent));
508                  break;
509          }
510   }
# Line 550 | Line 565 | int    dx, dy, mov, orb;
565                          return(0);      /* not on window */
566                  VCOPY(wip, rsL.wp[li]);
567   #endif
568 + #ifdef DEBUG
569 +                fprintf(stderr, "moveview: hit %s at (%f,%f,%f) (t=%f)\n",
570 +                                li < 0 ? "object" : "mesh",
571 +                                wip[0], wip[1], wip[2],
572 +                                (wip[0]-odev.v.vp[0])*odir[0] +
573 +                                (wip[1]-odev.v.vp[1])*odir[1] +
574 +                                (wip[2]-odev.v.vp[2])*odir[2]);
575 + #endif
576                  VSUM(odir, wip, odev.v.vp, -1.);
577          } else                  /* panning with constant viewpoint */
578                  VCOPY(nv.vdir, odir);
# Line 582 | Line 605 | int    dx, dy, mov, orb;
605  
606  
607   static
608 + getframe(ebut)                          /* get focus frame */
609 + XButtonPressedEvent     *ebut;
610 + {
611 +        int     startx = ebut->x, starty = ebut->y;
612 +        int     endx, endy;
613 +
614 +        XMaskEvent(ourdisplay, ButtonReleaseMask, levptr(XEvent));
615 +        endx = levptr(XButtonReleasedEvent)->x;
616 +        endy = levptr(XButtonReleasedEvent)->y;
617 +        if (endx == startx | endy == starty) {
618 +                XBell(ourdisplay, 0);
619 +                return;
620 +        }
621 +        if (endx < startx) {register int c = endx; endx = startx; startx = c;}
622 +        if (endy < starty) {register int c = endy; endy = starty; starty = c;}
623 +        sprintf(odev_args, "%.3f %.3f %.3f %.3f",
624 +                        (startx+.5)/odev.hres, 1.-(endy+.5)/odev.vres,
625 +                        (endx+.5)/odev.hres, 1.-(starty+.5)/odev.vres);
626 +        inpresflags |= DFL(DC_FOCUS);
627 + }
628 +
629 +
630 + static
631   getmove(ebut)                           /* get view change */
632   XButtonPressedEvent     *ebut;
633   {
# Line 664 | Line 710 | register VIEW  *vp;
710          double  d, xmin, xmax, ymin, ymax;
711  
712          if (mindpth >= maxdpth) {
713 <                dev_zmin = 0.1;
713 >                dev_zmin = 1.;
714                  dev_zmax = 100.;
715          } else {
716                  dev_zmin = 0.5*mindpth;
717                  dev_zmax = 1.5*maxdpth;
718 <                if (dev_zmin > dev_zmax/100.)
719 <                        dev_zmin = dev_zmax/100.;
718 >                if (dev_zmin > dev_zmax/5.)
719 >                        dev_zmin = dev_zmax/5.;
720          }
721          if (odev.v.vfore > FTINY)
722                  dev_zmin = odev.v.vfore;
723          if (odev.v.vaft > FTINY)
724                  dev_zmax = odev.v.vaft;
725 <        if (dev_zmin < dev_zmax/5000.)
726 <                dev_zmin = dev_zmax/5000.;
725 >        if (dev_zmin < dev_zmax/100.)
726 >                dev_zmin = dev_zmax/100.;
727          xmax = dev_zmin * tan(PI/180./2. * odev.v.horiz);
728          xmin = -xmax;
729          d = odev.v.hoff * (xmax - xmin);
# Line 718 | Line 764 | static
764   getkey(ekey)                            /* get input key */
765   register XKeyPressedEvent  *ekey;
766   {
767 +        Window  rootw, childw;
768 +        int     rootx, rooty, wx, wy;
769 +        unsigned int    statemask;
770          int  n;
771          char    buf[8];
772  
# Line 739 | Line 788 | register XKeyPressedEvent  *ekey;
788                  return;
789          case 'v':                       /* spit out view */
790                  inpresflags |= DFL(DC_GETVIEW);
791 +                return;
792 +        case 'f':                       /* frame view position */
793 +                if (!XQueryPointer(ourdisplay, gwind, &rootw, &childw,
794 +                                &rootx, &rooty, &wx, &wy, &statemask))
795 +                        return;         /* on another screen */
796 +                sprintf(odev_args, "%.4f %.4f", (wx+.5)/odev.hres,
797 +                                1.-(wy+.5)/odev.vres);
798 +                inpresflags |= DFL(DC_FOCUS);
799 +                return;
800 +        case 'F':                       /* unfocus */
801 +                odev_args[0] = '\0';
802 +                inpresflags |= DFL(DC_FOCUS);
803                  return;
804          case '\n':
805          case '\r':                      /* resume computation */

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines