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.5 by gregl, Fri Dec 26 14:46:21 1997 UTC vs.
Revision 3.14 by gregl, Tue Jan 6 05:26:19 1998 UTC

# Line 16 | Line 16 | static char SCCSid[] = "$SunId$ SGI";
16  
17   #include  "x11icon.h"
18  
19 + #ifndef RAYQLEN
20 + #define RAYQLEN         50000           /* max. rays to queue before flush */
21 + #endif
22 +
23   #ifndef FEQ
24   #define FEQ(a,b)        ((a)-(b) <= FTINY && (a)-(b) >= -FTINY)
25   #endif
# Line 100 | Line 104 | char  *id;
104          XSizeHints      oursizhints;
105                                          /* set quadtree globals */
106          qtMinNodesiz = 3;
107 +        qtDepthEps = 0.07;
108                                          /* open display server */
109          ourdisplay = XOpenDisplay(NULL);
110          if (ourdisplay == NULL)
# Line 161 | Line 166 | char  *id;
166                                          /* map the window */
167          XMapWindow(ourdisplay, gwind);
168          dev_input();                    /* sets size and view angles */
164        glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
169                                          /* allocate our leaf pile */
170 <        if (!qtAllocLeaves(2 * DisplayWidth(ourdisplay,ourscreen) *
171 <                        DisplayHeight(ourdisplay,ourscreen) /
172 <                        (qtMinNodesiz*qtMinNodesiz)))
170 >        if (!qtAllocLeaves(DisplayWidth(ourdisplay,ourscreen) *
171 >                        DisplayHeight(ourdisplay,ourscreen) * 3 /
172 >                        (qtMinNodesiz*qtMinNodesiz*2)))
173                  error(SYSTEM, "insufficient memory for value storage");
174          odev.name = id;
175          odev.ifd = ConnectionNumber(ourdisplay);
# Line 191 | Line 195 | dev_close()                    /* close our display and free resources
195   }
196  
197  
198 + dev_clear()                     /* clear our quadtree */
199 + {
200 +        qtCompost(100);
201 +        glClear(GL_DEPTH_BUFFER_BIT);
202 +        rayqleft = 0;                   /* hold off update */
203 + }
204 +
205 +
206   int
207   dev_view(nv)                    /* assign new driver view */
208   register VIEW   *nv;
# Line 262 | Line 274 | dev_flush()                    /* flush output */
274   {
275          qtUpdate();
276          glFlush();
277 +        rayqleft = RAYQLEN;
278          return(XPending(ourdisplay));
279   }
280  
# Line 273 | Line 286 | double rad;
286   {
287          register int    ci, j;
288          double  apexh, basez;
289 +                                        /* is window mapped? */
290 +        if (!mapped)
291 +                return;
292                                          /* compute apex height (0. to 1.) */
293          if (ip[2] > 1e6)
294                  apexh = 1. - 1./DEPTHFACT;
# Line 314 | Line 330 | mytmflags()                    /* figure out tone mapping flags */
330          for (cp = tail; *cp && *cp != '.'; cp++)
331                  ;
332          if (cp-tail == 3 && !strncmp(tail, "glx", 3))
333 <                return(TM_F_CAMERA);
333 >                return(TM_F_CAMERA|TM_F_NOSTDERR);
334          if (cp-tail == 4 && !strncmp(tail, "glxh", 4))
335 <                return(TM_F_HUMAN);
335 >                return(TM_F_HUMAN|TM_F_NOSTDERR);
336          error(USER, "illegal driver name");
337   }
338  
# Line 567 | Line 583 | register XKeyPressedEvent  *ekey;
583                  inpresflags |= DFL(DC_RESUME);
584                  return;
585          case CTRL('R'):                 /* redraw screen */
586 +                if (nxtzmax > FTINY) {
587 +                        curzmax = nxtzmax;
588 +                        nxtzmax = 0.;
589 +                }
590                  glClear(GL_DEPTH_BUFFER_BIT);
591                  qtRedraw(0, 0, odev.hres, odev.vres);
592                  return;
593          case CTRL('L'):                 /* refresh from server */
594                  if (inpresflags & DFL(DC_REDRAW))
595                          return;
596 +                if (nxtzmax > FTINY) {
597 +                        curzmax = nxtzmax;
598 +                        nxtzmax = 0.;
599 +                }
600                  glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
601                  draw_grids();
602                  glFlush();
603                  qtCompost(100);                 /* get rid of old values */
604                  inpresflags |= DFL(DC_REDRAW);  /* resend values from server */
605 +                rayqleft = 0;                   /* hold off update */
606                  return;
607          case 'K':                       /* kill rtrace process(es) */
608                  inpresflags |= DFL(DC_KILL);
# Line 627 | Line 652 | static
652   resizewindow(ersz)                      /* resize window */
653   register XConfigureEvent  *ersz;
654   {
655 +        glViewport(0, 0, ersz->width, ersz->height);
656 +
657          if (ersz->width == odev.hres && ersz->height == odev.vres)
658                  return;
659  
# Line 635 | Line 662 | register XConfigureEvent  *ersz;
662  
663          odev.v.horiz = 2.*180./PI * atan(0.5/VIEWDIST*pwidth*odev.hres);
664          odev.v.vert = 2.*180./PI * atan(0.5/VIEWDIST*pheight*odev.vres);
638
639        glViewport(0, 0, odev.hres, odev.vres);
665  
666          inpresflags |= DFL(DC_SETVIEW);
667   }

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines