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

Comparing ray/src/hd/rhd_ogl.c (file contents):
Revision 3.15 by gwlarson, Tue Jan 5 18:16:17 1999 UTC vs.
Revision 3.22 by schorsch, Mon Jul 21 22:30:18 2003 UTC

# Line 1 | Line 1
1 /* Copyright (c) 1999 Silicon Graphics, Inc. */
2
1   #ifndef lint
2 < static char SCCSid[] = "$SunId$ SGI";
2 > static const char       RCSid[] = "$Id$";
3   #endif
6
4   /*
5   * OpenGL driver for holodeck display.
6   * Based on GLX driver using T-mesh.
# Line 22 | Line 19 | static char SCCSid[] = "$SunId$ SGI";
19  
20   #include "standard.h"
21  
25 #include <sys/types.h>
22   #include <GL/glx.h>
23   #include <GL/glu.h>
24   #ifdef STEREO
25   #include <X11/extensions/SGIStereo.h>
26   #endif
27 + #include <time.h>
28  
29   #include "rhd_odraw.h"
30   #ifdef DOBJ
# Line 246 | Line 243 | char  *id;
243          setstereobuf(STEREO_BUFFER_LEFT);
244   #endif
245          checkglerr("setting rendering parameters");
246 <        copystruct(&odev.v, &stdview);
246 >        odev.v = stdview;
247          odev.v.type = VT_PER;
248          viewflags = VWSTEADY;           /* view starts static */
249                                          /* map the window */
# Line 333 | Line 330 | register VIEW  *nv;
330                          XResizeWindow(ourdisplay, gwind, odev.hres, odev.vres);
331                          dev_input();    /* get resize event */
332                  }
333 <                copystruct(&odev.v, nv);        /* setview() already called */
333 >                odev.v = *nv;   /* setview() already called */
334                  viewflags |= VWCHANGE;
335          }
336   #ifdef STEREO
337 <        copystruct(&vwright, nv);
337 >        vwright = *nv;
338          d = eyesepdist / sqrt(nv->hn2);
339          VSUM(vwright.vp, nv->vp, nv->hvec, d);
340          /* setview(&vwright);   -- Unnecessary */
# Line 350 | Line 347 | register VIEW  *nv;
347   dev_section(gfn, pfn)           /* add octree for geometry rendering */
348   char    *gfn, *pfn;
349   {
353        extern char     *index();
350          char    *cp;
351  
352          if (gfn == NULL) {
# Line 558 | Line 554 | xferdepth()                    /* load and clear depth buffer */
554          glClear(GL_DEPTH_BUFFER_BIT);           /* clear system depth buffer */
555          odDepthMap(0, depthbuffer);             /* transfer depth data */
556          if (pbuf != NULL)
557 <                free((char *)pbuf);             /* free our portal buffer */
557 >                free((void *)pbuf);             /* free our portal buffer */
558   }
559  
560  
# Line 569 | Line 565 | freedepth()                            /* free recorded depth buffer */
565                  return;
566   #ifdef STEREO
567          odDepthMap(1, NULL);
568 <        free((char *)depthright);
568 >        free((void *)depthright);
569          depthright = NULL;
570   #endif
571          odDepthMap(0, NULL);
572 <        free((char *)depthbuffer);
572 >        free((void *)depthbuffer);
573          depthbuffer = NULL;
574   }
575  
# Line 723 | Line 719 | int    dx, dy, mov, orb;
719          double  d, d1;
720          register int    li;
721                                  /* start with old view */
722 <        copystruct(&nv, &odev.v);
722 >        nv = odev.v;
723                                  /* orient our motion */
724          if (viewray(v1, odir, &odev.v,
725                          (dx+.5)/odev.hres, (dy+.5)/odev.vres) < -FTINY)
# Line 793 | Line 789 | XButtonPressedEvent    *ebut;
789  
790  
791   static
792 + waitabit()                              /* pause a moment */
793 + {
794 +        struct timespec ts;
795 +        ts.tv_sec = 0;
796 +        ts.tv_nsec = 50000000;
797 +        nanosleep(&ts, NULL);
798 + }
799 +
800 +
801 + static
802   getmove(ebut)                           /* get view change */
803   XButtonPressedEvent     *ebut;
804   {
# Line 809 | Line 815 | XButtonPressedEvent    *ebut;
815          setglpersp();                   /* start us off in perspective */
816          while (!XCheckMaskEvent(ourdisplay,
817                          ButtonReleaseMask, levptr(XEvent))) {
818 +                                        /* pause so as not to move too fast */
819 +                waitabit();
820                                          /* get cursor position */
821                  if (!XQueryPointer(ourdisplay, gwind, &rootw, &childw,
822                                  &rootx, &rooty, &wx, &wy, &statemask))
# Line 868 | Line 876 | setglpersp()                   /* set perspective view in GL */
876                  dev_zmin = odev.v.vfore;
877          if (odev.v.vaft > FTINY)
878                  dev_zmax = odev.v.vaft;
879 <        if (dev_zmin < dev_zmax/100.)
880 <                dev_zmin = dev_zmax/100.;
879 >        if (dev_zmin*500. < dev_zmax)
880 >                dev_zmin = dev_zmax/500.;
881          setzrat();
882          xmax = dev_zmin * tan(PI/180./2. * odev.v.horiz);
883          xmin = -xmax;
# Line 945 | Line 953 | wipeclean()                    /* prepare for redraw */
953                  viewflags &= ~VWCHANGE;         /* change noted */
954          } else if (viewflags & VWSTEADY)
955                  odRedrawAll();
956 <        setglpersp(&odev.v);            /* reset view & clipping planes */
956 >        setglpersp();                   /* reset view & clipping planes */
957   }
958  
959  

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines