| 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 |
| 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) |
| 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); |
| 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; |
| 274 |
|
{ |
| 275 |
|
qtUpdate(); |
| 276 |
|
glFlush(); |
| 277 |
+ |
rayqleft = RAYQLEN; |
| 278 |
|
return(XPending(ourdisplay)); |
| 279 |
|
} |
| 280 |
|
|
| 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; |
| 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 |
|
|
| 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); |