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

Comparing ray/src/hd/rhd_glx1.c (file contents):
Revision 3.7 by greg, Fri May 20 02:06:39 2011 UTC vs.
Revision 3.11 by greg, Fri Feb 12 00:53:56 2021 UTC

# Line 21 | Line 21 | static const char      RCSid[] = "$Id$";
21   #define RAYQLEN         50000           /* max. rays to queue before flush */
22   #endif
23  
24 #ifndef FEQ
25 #define FEQ(a,b)        ((a)-(b) <= FTINY && (a)-(b) >= -FTINY)
26 #endif
27
24   #ifndef MAXCONE
25   #define MAXCONE         16              /* number of different cone sizes */
26   #endif
# Line 104 | Line 100 | static void fixwindow(XExposeEvent  *eexp);
100   static void resizewindow(XConfigureEvent  *ersz);
101  
102  
103 < extern void
103 > void
104   dev_open(
105          char  *id
106   )
# Line 204 | Line 200 | dev_open(
200   }
201  
202  
203 < extern void
203 > void
204   dev_close(void)                 /* close our display and free resources */
205   {
206          glXMakeCurrent(ourdisplay, None, NULL);
# Line 222 | Line 218 | dev_close(void)                        /* close our display and free resour
218   }
219  
220  
221 < extern void
221 > void
222   dev_clear(void)                 /* clear our quadtree */
223   {
224          qtCompost(100);
# Line 231 | Line 227 | dev_clear(void)                        /* clear our quadtree */
227   }
228  
229  
230 < extern int
230 > int
231   dev_view(                       /* assign new driver view */
232 <        register VIEW   *nv
232 >        VIEW    *nv
233   )
234   {
235          if (nv->type == VT_PAR ||               /* check view legality */
# Line 250 | Line 246 | dev_view(                      /* assign new driver view */
246                  return(0);
247          }
248          if (nv != &odev.v) {
249 <                if (!FEQ(nv->horiz,odev.v.horiz) ||     /* resize window? */
250 <                                !FEQ(nv->vert,odev.v.vert)) {
249 >                if (!FABSEQ(nv->horiz,odev.v.horiz) ||  /* resize window? */
250 >                                !FABSEQ(nv->vert,odev.v.vert)) {
251                          int     dw = DisplayWidth(ourdisplay,ourscreen);
252                          int     dh = DisplayHeight(ourdisplay,ourscreen);
253  
# Line 284 | Line 280 | dev_view(                      /* assign new driver view */
280   }
281  
282  
283 < extern void
283 > void
284   dev_section(            /* add octree for geometry rendering */
285          char    *gfn,
286          char    *pfn
# Line 294 | Line 290 | dev_section(           /* add octree for geometry rendering */
290   }
291  
292  
293 < extern void
293 > void
294   dev_auxcom(             /* process an auxiliary command */
295          char    *cmd,
296          char    *args
# Line 305 | Line 301 | dev_auxcom(            /* process an auxiliary command */
301   }
302  
303  
304 < extern VIEW *
304 > VIEW *
305   dev_auxview(            /* return nth auxiliary view */
306          int     n,
307          int     hvres[2]
# Line 318 | Line 314 | dev_auxview(           /* return nth auxiliary view */
314   }
315  
316  
317 < extern int
317 > int
318   dev_input(void)                 /* get X11 input */
319   {
320          inpresflags = 0;
# Line 332 | Line 328 | dev_input(void)                        /* get X11 input */
328   }
329  
330  
331 < extern int
331 > int
332   dev_flush(void)                 /* flush output */
333   {
334          qtUpdate();
# Line 342 | Line 338 | dev_flush(void)                        /* flush output */
338   }
339  
340  
341 < extern void
341 > void
342   dev_cone(               /* render a cone in view coordinates */
343          uby8    rgb[3],
344          FVECT   ip,
345          double  rad
346   )
347   {
348 <        register int    ci, j;
348 >        int     ci, j;
349          double  apexh, basez;
350                                          /* is window mapped? */
351          if (!mapped)
# Line 387 | Line 383 | static int
383   mytmflags(void)                 /* figure out tone mapping flags */
384   {
385          extern char     *progname;
386 <        register char   *cp, *tail;
386 >        char    *cp, *tail;
387                                          /* find basic name */
388          for (cp = tail = progname; *cp; cp++)
389                  if (*cp == '/')
# Line 406 | Line 402 | mytmflags(void)                        /* figure out tone mapping flags */
402   static void
403   initcones(void)                 /* initialize cone vertices */
404   {
405 <        register int    i, j;
405 >        int     i, j;
406          double  minrad, d;
407  
408          if (cone[0].nverts)
# Line 433 | Line 429 | initcones(void)                        /* initialize cone vertices */
429   static void
430   freecones(void)                 /* free cone vertices */
431   {
432 <        register int    i;
432 >        int     i;
433  
434          for (i = MAXCONE; i--; )
435                  if (cone[i].nverts) {
# Line 465 | Line 461 | getevent(void)                 /* get next event */
461                  getkey(levptr(XKeyPressedEvent));
462                  break;
463          case ButtonPress:
464 <                getmove(levptr(XButtonPressedEvent));
464 >                switch (levptr(XButtonPressedEvent)->button) {
465 >                case Button4:           /* wheel up */
466 >                case Button5:           /* wheel down */
467 >                        break;
468 >                default:
469 >                        getmove(levptr(XButtonPressedEvent));
470 >                        break;
471 >                }
472                  break;
473          }
474   }
# Line 473 | Line 476 | getevent(void)                 /* get next event */
476  
477   static void
478   draw3dline(                     /* draw 3d line in world coordinates */
479 <        register FVECT  wp[2]
479 >        FVECT   wp[2]
480   )
481   {
482          glVertex3d(wp[0][0], wp[0][1], wp[0][2]);
# Line 538 | Line 541 | moveview(      /* move our view */
541          VIEW    nv;
542          FVECT   odir, v1;
543          double  d;
544 <        register int    li;
544 >        int     li;
545                                  /* start with old view */
546          nv = odev.v;
547                                  /* change view direction */
# Line 556 | Line 559 | moveview(      /* move our view */
559                  VSUM(nv.vp, qtL.wp[li], odir, -1.);
560                  spinvector(nv.vdir, nv.vdir, nv.vup, d);
561          } else if (orb) {               /* orbit up/down */
562 <                fcross(v1, odir, nv.vup);
563 <                if (normalize(v1) == 0.)
562 >                if (geodesic(odir, odir, nv.vup,
563 >                                d=MOVDEG*PI/180.*orb, GEOD_RAD) == 0.0)
564                          return(0);
562                spinvector(odir, odir, v1, d=MOVDEG*PI/180.*orb);
565                  VSUM(nv.vp, qtL.wp[li], odir, -1.);
566 <                spinvector(nv.vdir, nv.vdir, v1, d);
566 >                geodesic(nv.vdir, nv.vdir, nv.vup, d, GEOD_RAD);
567          } else if (mov) {               /* move forward/backward */
568                  d = MOVPCT/100. * mov;
569                  VSUM(nv.vp, nv.vp, odir, d);
# Line 624 | Line 626 | getmove(                               /* get view change */
626  
627   static void
628   getkey(                         /* get input key */
629 <        register XKeyPressedEvent  *ekey
629 >        XKeyPressedEvent  *ekey
630   )
631   {
632          int  n;
# Line 696 | Line 698 | getkey(                                /* get input key */
698  
699   static void
700   fixwindow(                              /* repair damage to window */
701 <        register XExposeEvent  *eexp
701 >        XExposeEvent  *eexp
702   )
703   {
704          int     xmin, xmax, ymin, ymax;
# Line 722 | Line 724 | fixwindow(                             /* repair damage to window */
724  
725   static void
726   resizewindow(                   /* resize window */
727 <        register XConfigureEvent  *ersz
727 >        XConfigureEvent  *ersz
728   )
729   {
730          glViewport(0, 0, ersz->width, ersz->height);

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines