18 |
|
|
19 |
|
#include "x11icon.h" |
20 |
|
|
21 |
+ |
#ifndef RAYQLEN |
22 |
+ |
#define RAYQLEN 50000 /* max. rays to queue before flush */ |
23 |
+ |
#endif |
24 |
+ |
|
25 |
|
#ifndef FEQ |
26 |
|
#define FEQ(a,b) ((a)-(b) <= FTINY && (a)-(b) >= -FTINY) |
27 |
|
#endif |
85 |
|
for (cp = tail; *cp && *cp != '.'; cp++) |
86 |
|
; |
87 |
|
if (cp-tail == 3 && !strncmp(tail, "x11", 3)) |
88 |
< |
return(TM_F_CAMERA); |
88 |
> |
return(TM_F_CAMERA|TM_F_NOSTDERR); |
89 |
|
if (cp-tail == 4 && !strncmp(tail, "x11h", 4)) |
90 |
< |
return(TM_F_HUMAN); |
90 |
> |
return(TM_F_HUMAN|TM_F_NOSTDERR); |
91 |
|
error(USER, "illegal driver name"); |
92 |
|
} |
93 |
|
|
162 |
|
oursizhints.min_height = MINHEIGHT; |
163 |
|
oursizhints.flags = PMinSize; |
164 |
|
XSetNormalHints(ourdisplay, gwind, &oursizhints); |
161 |
– |
/* map the window and get its size */ |
162 |
– |
XMapWindow(ourdisplay, gwind); |
163 |
– |
dev_input(); |
164 |
– |
/* allocate our leaf pile */ |
165 |
– |
if (!qtAllocLeaves(DisplayWidth(ourdisplay,ourscreen) * |
166 |
– |
DisplayHeight(ourdisplay,ourscreen) / |
167 |
– |
(qtMinNodesiz*qtMinNodesiz))) |
168 |
– |
error(SYSTEM, "insufficient memory for leaf storage"); |
169 |
– |
|
165 |
|
/* figure out sensible view */ |
166 |
|
pwidth = (double)DisplayWidthMM(ourdisplay, ourscreen) / |
167 |
|
DisplayWidth(ourdisplay, ourscreen); |
168 |
|
pheight = (double)DisplayHeightMM(ourdisplay, ourscreen) / |
169 |
|
DisplayHeight(ourdisplay, ourscreen); |
170 |
|
copystruct(&odev.v, &stdview); |
176 |
– |
odev.name = id; |
171 |
|
odev.v.type = VT_PER; |
172 |
< |
odev.v.horiz = 2.*180./PI * atan(0.5/VIEWDIST*pwidth*odev.hres); |
173 |
< |
odev.v.vert = 2.*180./PI * atan(0.5/VIEWDIST*pheight*odev.vres); |
172 |
> |
/* map the window and get its size */ |
173 |
> |
XMapWindow(ourdisplay, gwind); |
174 |
> |
dev_input(); /* sets size and view angles */ |
175 |
> |
/* allocate our leaf pile */ |
176 |
> |
if (!qtAllocLeaves(DisplayWidth(ourdisplay,ourscreen) * |
177 |
> |
DisplayHeight(ourdisplay,ourscreen) * 3 / |
178 |
> |
(qtMinNodesiz*qtMinNodesiz*2))) |
179 |
> |
error(SYSTEM, "insufficient memory for leaf storage"); |
180 |
> |
odev.name = id; |
181 |
|
odev.ifd = ConnectionNumber(ourdisplay); |
182 |
|
} |
183 |
|
|
204 |
|
VIEW *nv; |
205 |
|
{ |
206 |
|
if (nv->type == VT_PAR || /* check view legality */ |
207 |
< |
nv->horiz > 160. || nv->vert > 160.) { |
207 |
> |
nv->horiz > 160. || nv->vert > 160.) { |
208 |
|
error(COMMAND, "illegal view type/angle"); |
209 |
|
nv->type = VT_PER; |
210 |
|
nv->horiz = odev.v.horiz; |
237 |
|
odev.vres = dh; |
238 |
|
} |
239 |
|
XResizeWindow(ourdisplay, gwind, odev.hres, odev.vres); |
240 |
+ |
dev_input(); /* wait for resize event */ |
241 |
|
} |
242 |
|
copystruct(&odev.v, nv); |
243 |
|
} |
282 |
|
dev_flush() /* flush output */ |
283 |
|
{ |
284 |
|
qtUpdate(); |
285 |
+ |
rayqleft = RAYQLEN; |
286 |
|
return(XPending(ourdisplay)); |
287 |
|
} |
288 |
|
|
458 |
|
static BYTE gridrgb[3] = {0x0, 0xff, 0xff}; |
459 |
|
unsigned long pixel; |
460 |
|
|
461 |
< |
if (!mapped || odev.v.type != VT_PER) |
461 |
> |
if (!mapped) |
462 |
|
return; |
463 |
|
if (ncolors > 0) |
464 |
|
pixel = pixval[get_pixel(gridrgb, xnewcolr)]; |
475 |
|
int dx, dy, mov, orb; |
476 |
|
{ |
477 |
|
VIEW nv; |
478 |
< |
FVECT v1; |
478 |
> |
FVECT odir, v1; |
479 |
|
double d; |
480 |
|
register int li; |
481 |
|
/* start with old view */ |
484 |
|
if (mov | orb) { |
485 |
|
if ((li = qtFindLeaf(dx, dy)) < 0) |
486 |
|
return(0); /* not on window */ |
487 |
< |
VSUM(nv.vdir, qtL.wp[li], nv.vp, -1.); |
487 |
> |
VSUM(odir, qtL.wp[li], nv.vp, -1.); |
488 |
|
} else { |
489 |
|
if (viewray(nv.vp, nv.vdir, &odev.v, |
490 |
|
(dx+.5)/odev.hres, (dy+.5)/odev.vres) < -FTINY) |
491 |
|
return(0); /* outside view */ |
492 |
|
} |
493 |
|
if (orb && mov) { /* orbit left/right */ |
494 |
< |
spinvector(nv.vdir, nv.vdir, nv.vup, MOVDEG*PI/180.*mov); |
495 |
< |
VSUM(nv.vp, qtL.wp[li], nv.vdir, -1.); |
494 |
> |
spinvector(odir, odir, nv.vup, d=MOVDEG*PI/180.*mov); |
495 |
> |
VSUM(nv.vp, qtL.wp[li], odir, -1.); |
496 |
> |
spinvector(nv.vdir, nv.vdir, nv.vup, d); |
497 |
|
} else if (orb) { /* orbit up/down */ |
498 |
< |
fcross(v1, nv.vdir, nv.vup); |
498 |
> |
fcross(v1, odir, nv.vup); |
499 |
|
if (normalize(v1) == 0.) |
500 |
|
return(0); |
501 |
< |
spinvector(nv.vdir, nv.vdir, v1, MOVDEG*PI/180.*orb); |
502 |
< |
VSUM(nv.vp, qtL.wp[li], nv.vdir, -1.); |
501 |
> |
spinvector(odir, odir, v1, d=MOVDEG*PI/180.*orb); |
502 |
> |
VSUM(nv.vp, qtL.wp[li], odir, -1.); |
503 |
> |
spinvector(nv.vdir, nv.vdir, v1, d); |
504 |
|
} else if (mov) { /* move forward/backward */ |
505 |
|
d = MOVPCT/100. * mov; |
506 |
< |
VSUM(nv.vp, nv.vp, nv.vdir, d); |
506 |
> |
VSUM(nv.vp, nv.vp, odir, d); |
507 |
|
} |
508 |
|
if (!mov ^ !orb && headlocked) { /* restore head height */ |
509 |
|
VSUM(v1, odev.v.vp, nv.vp, -1.); |