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); |
266 |
|
{ |
267 |
|
qtUpdate(); |
268 |
|
glFlush(); |
269 |
+ |
rayqleft = RAYQLEN; |
270 |
|
return(XPending(ourdisplay)); |
271 |
|
} |
272 |
|
|
278 |
|
{ |
279 |
|
register int ci, j; |
280 |
|
double apexh, basez; |
281 |
+ |
/* is window mapped? */ |
282 |
+ |
if (!mapped) |
283 |
+ |
return; |
284 |
|
/* compute apex height (0. to 1.) */ |
285 |
|
if (ip[2] > 1e6) |
286 |
|
apexh = 1. - 1./DEPTHFACT; |
292 |
|
else |
293 |
|
apexh = 1. - ip[2]/(curzmax*DEPTHFACT); |
294 |
|
} |
295 |
< |
/* find closest cone match */ |
295 |
> |
rad *= 1.25; /* find conservative cone match */ |
296 |
|
for (ci = 0; ci < MAXCONE-1; ci++) |
297 |
|
if (cone[ci].rad >= rad) |
298 |
|
break; |
322 |
|
for (cp = tail; *cp && *cp != '.'; cp++) |
323 |
|
; |
324 |
|
if (cp-tail == 3 && !strncmp(tail, "glx", 3)) |
325 |
< |
return(TM_F_CAMERA); |
325 |
> |
return(TM_F_CAMERA|TM_F_NOSTDERR); |
326 |
|
if (cp-tail == 4 && !strncmp(tail, "glxh", 4)) |
327 |
< |
return(TM_F_HUMAN); |
327 |
> |
return(TM_F_HUMAN|TM_F_NOSTDERR); |
328 |
|
error(USER, "illegal driver name"); |
329 |
|
} |
330 |
|
|
575 |
|
inpresflags |= DFL(DC_RESUME); |
576 |
|
return; |
577 |
|
case CTRL('R'): /* redraw screen */ |
578 |
+ |
if (nxtzmax > FTINY) { |
579 |
+ |
curzmax = nxtzmax; |
580 |
+ |
nxtzmax = 0.; |
581 |
+ |
} |
582 |
|
glClear(GL_DEPTH_BUFFER_BIT); |
583 |
|
qtRedraw(0, 0, odev.hres, odev.vres); |
584 |
|
return; |
585 |
|
case CTRL('L'): /* refresh from server */ |
586 |
|
if (inpresflags & DFL(DC_REDRAW)) |
587 |
|
return; |
588 |
+ |
if (nxtzmax > FTINY) { |
589 |
+ |
curzmax = nxtzmax; |
590 |
+ |
nxtzmax = 0.; |
591 |
+ |
} |
592 |
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
593 |
|
draw_grids(); |
594 |
|
glFlush(); |
595 |
|
qtCompost(100); /* get rid of old values */ |
596 |
|
inpresflags |= DFL(DC_REDRAW); /* resend values from server */ |
597 |
+ |
rayqleft = 0; /* hold off update */ |
598 |
|
return; |
599 |
|
case 'K': /* kill rtrace process(es) */ |
600 |
|
inpresflags |= DFL(DC_KILL); |
644 |
|
resizewindow(ersz) /* resize window */ |
645 |
|
register XConfigureEvent *ersz; |
646 |
|
{ |
647 |
+ |
glViewport(0, 0, ersz->width, ersz->height); |
648 |
+ |
|
649 |
|
if (ersz->width == odev.hres && ersz->height == odev.vres) |
650 |
|
return; |
651 |
|
|
654 |
|
|
655 |
|
odev.v.horiz = 2.*180./PI * atan(0.5/VIEWDIST*pwidth*odev.hres); |
656 |
|
odev.v.vert = 2.*180./PI * atan(0.5/VIEWDIST*pheight*odev.vres); |
638 |
– |
|
639 |
– |
glViewport(0, 0, odev.hres, odev.vres); |
657 |
|
|
658 |
|
inpresflags |= DFL(DC_SETVIEW); |
659 |
|
} |