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.31 by greg, Thu Sep 6 00:07:43 2012 UTC vs.
Revision 3.34 by greg, Fri Feb 12 00:53:56 2021 UTC

# Line 49 | Line 49 | static const char      RCSid[] = "$Id$";
49   #define BORWIDTH        5               /* border width */
50   #endif
51  
52 #ifndef FEQ
53 #define FEQ(a,b)        ((a)-(b) <= FTINY && (a)-(b) >= -FTINY)
54 #endif
55
52   #define VWHEADLOCK      01              /* head position is locked flag */
53   #define VWPERSP         02              /* perspective view is set */
54   #define VWORTHO         04              /* orthographic view is set */
# Line 129 | Line 125 | static void freedepth(void);
125   static double getdistance(int dx, int dy, FVECT direc);
126   static int mytmflags(void);
127   static void getevent(void);
128 < static void draw3dline(register FVECT wp[2]);
128 > static void draw3dline(FVECT wp[2]);
129   static void draw_grids(int fore);
130   static int moveview(int dx, int dy, int mov, int orb);
131   static void getframe(XButtonPressedEvent *ebut);
132   static void getmove(XButtonPressedEvent *ebut);
133 < static void getkey(register XKeyPressedEvent *ekey);
134 < static void fixwindow(register XExposeEvent *eexp);
135 < static void resizewindow(register XConfigureEvent *ersz);
133 > static void getkey(XKeyPressedEvent *ekey);
134 > static void fixwindow(XExposeEvent *eexp);
135 > static void resizewindow(XConfigureEvent *ersz);
136   static void waitabit(void);
137   static void setglpersp(void);
138   static void setglortho(void);
# Line 153 | Line 149 | extern int     gmPortals;      /* GL portal list id */
149   extern time_t   time();
150  
151  
152 < extern void
152 > void
153   dev_open(id)                    /* initialize GLX driver */
154   char  *id;
155   {
# Line 286 | Line 282 | char  *id;
282   }
283  
284  
285 < extern void
285 > void
286   dev_close(void)                 /* close our display and free resources */
287   {
288   #ifdef DOBJ
# Line 309 | Line 305 | dev_close(void)                        /* close our display and free resour
305   }
306  
307  
308 < extern void
308 > void
309   dev_clear(void)                 /* clear our representation */
310   {
311          viewflags |= VWCHANGE;          /* pretend our view has changed */
# Line 319 | Line 315 | dev_clear(void)                        /* clear our representation */
315   }
316  
317  
318 < extern int
318 > int
319   dev_view(                       /* assign new driver view */
320 <        register VIEW   *nv
320 >        VIEW    *nv
321   )
322   {
323   #ifdef STEREO
# Line 337 | Line 333 | dev_view(                      /* assign new driver view */
333          }
334          if (nv != &odev.v) {
335                                                  /* resize window? */
336 <                if (!FEQ(nv->horiz,odev.v.horiz) ||
337 <                                !FEQ(nv->vert,odev.v.vert)) {
336 >                if (!FABSEQ(nv->horiz,odev.v.horiz) ||
337 >                                !FABSEQ(nv->vert,odev.v.vert)) {
338                          int     dw = DisplayWidth(ourdisplay,ourscreen);
339                          int     dh = DisplayHeight(ourdisplay,ourscreen);
340  
# Line 376 | Line 372 | dev_view(                      /* assign new driver view */
372   }
373  
374  
375 < extern void
375 > void
376   dev_section(            /* add octree for geometry rendering */
377          char    *gfn,
378          char    *pfn
# Line 401 | Line 397 | dev_section(           /* add octree for geometry rendering */
397   }
398  
399  
400 < extern void
400 > void
401   dev_auxcom(             /* process an auxiliary command */
402          char    *cmd,
403          char    *args
# Line 423 | Line 419 | dev_auxcom(            /* process an auxiliary command */
419   }
420  
421  
422 < extern VIEW *
422 > VIEW *
423   dev_auxview(            /* return nth auxiliary view */
424          int     n,
425          int     hvres[2]
# Line 440 | Line 436 | dev_auxview(           /* return nth auxiliary view */
436   }
437  
438  
439 < extern int
439 > int
440   dev_input(void)                 /* get X11 input */
441   {
442          inpresflags = 0;
# Line 456 | Line 452 | dev_input(void)                        /* get X11 input */
452   }
453  
454  
455 < extern void
455 > void
456   dev_value(              /* add a pixel value to our texture */
457          COLR    c,
458          FVECT   d,
# Line 475 | Line 471 | dev_value(             /* add a pixel value to our texture */
471   }
472  
473  
474 < extern int
474 > int
475   dev_flush(void)                 /* flush output as appropriate */
476   {
477          int     ndrawn;
# Line 527 | Line 523 | checkglerr(            /* check for GL or GLU error */
523          char    *where
524   )
525   {
526 <        register GLenum errcode;
526 >        GLenum  errcode;
527  
528          while ((errcode = glGetError()) != GL_NO_ERROR) {
529                  sprintf(errmsg, "OpenGL error %s: %s",
# Line 540 | Line 536 | checkglerr(            /* check for GL or GLU error */
536   static void
537   xferdepth(void)                 /* load and clear depth buffer */
538   {
539 <        register GLfloat        *dbp;
540 <        register GLubyte        *pbuf;
539 >        GLfloat *dbp;
540 >        GLubyte *pbuf;
541  
542          if (depthbuffer == NULL) {      /* allocate private depth buffer */
543   #ifdef STEREO
# Line 677 | Line 673 | static int
673   mytmflags(void)                 /* figure out tone mapping flags */
674   {
675          extern char     *progname;
676 <        register char   *cp, *tail;
676 >        char    *cp, *tail;
677                                          /* find basic name */
678          for (cp = tail = progname; *cp; cp++)
679                  if (*cp == '/')
# Line 720 | Line 716 | getevent(void)                 /* get next event */
716                  getkey(levptr(XKeyPressedEvent));
717                  break;
718          case ButtonPress:
719 <                if (FRAMESTATE(levptr(XButtonPressedEvent)->state))
720 <                        getframe(levptr(XButtonPressedEvent));
719 >                if (FRAMESTATE(levptr(XButtonPressedEvent)->state))
720 >                        getframe(levptr(XButtonPressedEvent));
721                  else
722 <                        getmove(levptr(XButtonPressedEvent));
722 >                        switch (levptr(XButtonPressedEvent)->button) {
723 >                        case Button4:           /* wheel up */
724 >                        case Button5:           /* wheel down */
725 >                                break;
726 >                        default:
727 >                                getmove(levptr(XButtonPressedEvent));
728 >                                break;
729 >                        }
730                  break;
731          }
732   }
# Line 731 | Line 734 | getevent(void)                 /* get next event */
734  
735   static void
736   draw3dline(                     /* draw 3d line in world coordinates */
737 <        register FVECT  wp[2]
737 >        FVECT   wp[2]
738   )
739   {
740          glVertex3d(wp[0][0], wp[0][1], wp[0][2]);
# Line 851 | Line 854 | getframe(                              /* get focus frame */
854                                                  /* set frame for rendering */
855          if ((endx == startx) | (endy == starty))
856                  return;
857 <        if (endx < startx) {register int c = endx; endx = startx; startx = c;}
858 <        if (endy < starty) {register int c = endy; endy = starty; starty = c;}
857 >        if (endx < startx) {int c = endx; endx = startx; startx = c;}
858 >        if (endy < starty) {int c = endy; endy = starty; starty = c;}
859          sprintf(odev_args, "%.3f %.3f %.3f %.3f",
860                          (startx+.5)/odev.hres, 1.-(endy+.5)/odev.vres,
861                          (endx+.5)/odev.hres, 1.-(starty+.5)/odev.vres);
# Line 1032 | Line 1035 | wipeclean(void)                        /* prepare for redraw */
1035  
1036   static void
1037   getkey(                         /* get input key */
1038 <        register XKeyPressedEvent  *ekey
1038 >        XKeyPressedEvent  *ekey
1039   )
1040   {
1041          Window  rootw, childw;
# Line 1116 | Line 1119 | getkey(                                /* get input key */
1119  
1120   static void
1121   fixwindow(                              /* repair damage to window */
1122 <        register XExposeEvent  *eexp
1122 >        XExposeEvent  *eexp
1123   )
1124   {
1125          int     xmin, ymin, xmax, ymax;
# Line 1162 | Line 1165 | fixwindow(                             /* repair damage to window */
1165  
1166   static void
1167   resizewindow(                   /* resize window */
1168 <        register XConfigureEvent  *ersz
1168 >        XConfigureEvent  *ersz
1169   )
1170   {
1171          glViewport(0, 0, ersz->width, ersz->height);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines