--- ray/src/hd/rhd_glx.c 1997/12/26 15:33:12 3.6 +++ ray/src/hd/rhd_glx.c 1998/01/01 16:28:44 3.12 @@ -16,6 +16,10 @@ static char SCCSid[] = "$SunId$ SGI"; #include "x11icon.h" +#ifndef RAYQLEN +#define RAYQLEN 50000 /* max. rays to queue before flush */ +#endif + #ifndef FEQ #define FEQ(a,b) ((a)-(b) <= FTINY && (a)-(b) >= -FTINY) #endif @@ -100,6 +104,7 @@ char *id; XSizeHints oursizhints; /* set quadtree globals */ qtMinNodesiz = 3; + qtDepthEps = 0.07; /* open display server */ ourdisplay = XOpenDisplay(NULL); if (ourdisplay == NULL) @@ -161,11 +166,10 @@ char *id; /* map the window */ XMapWindow(ourdisplay, gwind); dev_input(); /* sets size and view angles */ - glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); /* allocate our leaf pile */ - if (!qtAllocLeaves(2 * DisplayWidth(ourdisplay,ourscreen) * - DisplayHeight(ourdisplay,ourscreen) / - (qtMinNodesiz*qtMinNodesiz))) + if (!qtAllocLeaves(DisplayWidth(ourdisplay,ourscreen) * + DisplayHeight(ourdisplay,ourscreen) * 3 / + (qtMinNodesiz*qtMinNodesiz*2))) error(SYSTEM, "insufficient memory for value storage"); odev.name = id; odev.ifd = ConnectionNumber(ourdisplay); @@ -262,6 +266,7 @@ dev_flush() /* flush output */ { qtUpdate(); glFlush(); + rayqleft = RAYQLEN; return(XPending(ourdisplay)); } @@ -273,6 +278,9 @@ double rad; { register int ci, j; double apexh, basez; + /* is window mapped? */ + if (!mapped) + return; /* compute apex height (0. to 1.) */ if (ip[2] > 1e6) apexh = 1. - 1./DEPTHFACT; @@ -314,9 +322,9 @@ mytmflags() /* figure out tone mapping flags */ for (cp = tail; *cp && *cp != '.'; cp++) ; if (cp-tail == 3 && !strncmp(tail, "glx", 3)) - return(TM_F_CAMERA); + return(TM_F_CAMERA|TM_F_NOSTDERR); if (cp-tail == 4 && !strncmp(tail, "glxh", 4)) - return(TM_F_HUMAN); + return(TM_F_HUMAN|TM_F_NOSTDERR); error(USER, "illegal driver name"); } @@ -567,12 +575,20 @@ register XKeyPressedEvent *ekey; inpresflags |= DFL(DC_RESUME); return; case CTRL('R'): /* redraw screen */ + if (nxtzmax > FTINY) { + curzmax = nxtzmax; + nxtzmax = 0.; + } glClear(GL_DEPTH_BUFFER_BIT); qtRedraw(0, 0, odev.hres, odev.vres); return; case CTRL('L'): /* refresh from server */ if (inpresflags & DFL(DC_REDRAW)) return; + if (nxtzmax > FTINY) { + curzmax = nxtzmax; + nxtzmax = 0.; + } glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); draw_grids(); glFlush();