| 10 |
|
*/ |
| 11 |
|
|
| 12 |
|
#include "standard.h" |
| 13 |
– |
#include "rhd_qtree.h" |
| 14 |
– |
|
| 13 |
|
#include <X11/Xlib.h> |
| 14 |
|
#include <X11/cursorfont.h> |
| 15 |
|
#include <X11/Xutil.h> |
| 16 |
< |
|
| 16 |
> |
#include "rhd_qtree.h" |
| 17 |
|
#include "x11icon.h" |
| 18 |
|
|
| 19 |
|
#ifndef RAYQLEN |
| 291 |
|
do |
| 292 |
|
getevent(); |
| 293 |
|
|
| 294 |
< |
while (XQLength(ourdisplay) > 0); |
| 294 |
> |
while (XPending(ourdisplay) > 0); |
| 295 |
|
|
| 296 |
+ |
odev.inpready = 0; |
| 297 |
+ |
|
| 298 |
|
return(inpresflags); |
| 299 |
|
} |
| 300 |
|
|
| 322 |
|
{ |
| 323 |
|
qtUpdate(); |
| 324 |
|
rayqleft = RAYQLEN; |
| 325 |
< |
return(XPending(ourdisplay)); |
| 325 |
> |
return(odev.inpready = XPending(ourdisplay)); |
| 326 |
|
} |
| 327 |
|
|
| 328 |
|
|
| 462 |
|
int dp[2][2]; |
| 463 |
|
FVECT wp[2]; |
| 464 |
|
{ |
| 465 |
< |
static FVECT vmin = {0.,0.,0.}, vmax = {1.,1.,FHUGE}; |
| 466 |
< |
FVECT ip[2]; |
| 467 |
< |
/* not exactly right, but who cares? */ |
| 468 |
< |
viewloc(ip[0], &odev.v, wp[0]); |
| 469 |
< |
viewloc(ip[1], &odev.v, wp[1]); |
| 465 |
> |
static FVECT vmin = {0.,0.,0.}, vmax = {1.-FTINY,1.-FTINY,FHUGE}; |
| 466 |
> |
FVECT wpc[2], ip[2]; |
| 467 |
> |
double d, d0, d1; |
| 468 |
> |
/* check for points behind view */ |
| 469 |
> |
d = DOT(odev.v.vp, odev.v.vdir); |
| 470 |
> |
d0 = DOT(wp[0], odev.v.vdir) - d; |
| 471 |
> |
d1 = DOT(wp[1], odev.v.vdir) - d; |
| 472 |
> |
/* work on copy of world points */ |
| 473 |
> |
if (d0 <= d1) { |
| 474 |
> |
VCOPY(wpc[0], wp[0]); VCOPY(wpc[1], wp[1]); |
| 475 |
> |
} else { |
| 476 |
> |
d = d0; d0 = d1; d1 = d; |
| 477 |
> |
VCOPY(wpc[1], wp[0]); VCOPY(wpc[0], wp[1]); |
| 478 |
> |
} |
| 479 |
> |
if (d0 <= FTINY) { |
| 480 |
> |
if (d1 <= FTINY) return(0); |
| 481 |
> |
VSUB(wpc[0], wpc[0], wpc[1]); |
| 482 |
> |
d = .99*d1/(d1-d0); |
| 483 |
> |
VSUM(wpc[0], wpc[1], wpc[0], d); |
| 484 |
> |
} |
| 485 |
> |
/* get view coordinates and clip to window */ |
| 486 |
> |
viewloc(ip[0], &odev.v, wpc[0]); |
| 487 |
> |
viewloc(ip[1], &odev.v, wpc[1]); |
| 488 |
|
if (!clip(ip[0], ip[1], vmin, vmax)) |
| 489 |
|
return(0); |
| 490 |
|
dp[0][0] = ip[0][0]*odev.hres; |
| 515 |
|
static BYTE gridrgb[3] = {0x0, 0xff, 0xff}; |
| 516 |
|
unsigned long pixel; |
| 517 |
|
|
| 500 |
– |
if (!mapped) |
| 501 |
– |
return; |
| 518 |
|
if (ncolors > 0) |
| 519 |
|
pixel = pixval[get_pixel(gridrgb, xnewcolr)]; |
| 520 |
|
else |