37 |
|
#include "x11icon.h" |
38 |
|
|
39 |
|
#ifndef RAYQLEN |
40 |
< |
#define RAYQLEN 50000 /* max. rays to queue before flush */ |
40 |
> |
#define RAYQLEN 0 /* max. rays to queue before flush */ |
41 |
|
#endif |
42 |
|
|
43 |
|
#ifndef FEQ |
231 |
|
glDisable(GL_CULL_FACE); |
232 |
|
glLightModeli(GL_LIGHT_MODEL_TWO_SIDE, GL_TRUE); |
233 |
|
glPolygonMode(GL_FRONT_AND_BACK, GL_FILL); |
234 |
+ |
glPixelStorei(GL_PACK_ALIGNMENT, 1); |
235 |
+ |
glPixelStorei(GL_UNPACK_ALIGNMENT, 1); |
236 |
|
/* figure out sensible view */ |
237 |
|
pwidth = (double)DisplayWidthMM(ourdisplay, ourscreen) / |
238 |
|
DisplayWidth(ourdisplay, ourscreen); |
250 |
|
XMapWindow(ourdisplay, gwind); |
251 |
|
dev_input(); /* sets size and view angles */ |
252 |
|
if (!odInit(DisplayWidth(ourdisplay,ourscreen) * |
253 |
< |
DisplayHeight(ourdisplay,ourscreen) / 4)) |
253 |
> |
DisplayHeight(ourdisplay,ourscreen) / 3)) |
254 |
|
error(SYSTEM, "insufficient memory for value storage"); |
255 |
|
odev.name = id; |
256 |
|
odev.firstuse = 1; /* can't recycle samples */ |
282 |
|
|
283 |
|
dev_clear() /* clear our representation */ |
284 |
|
{ |
285 |
< |
wipeclean(); |
285 |
> |
viewflags |= VWCHANGE; /* pretend our view has changed */ |
286 |
> |
wipeclean(); /* clean off display and samples */ |
287 |
|
rayqleft = 0; /* hold off update */ |
288 |
|
} |
289 |
|
|
505 |
|
} |
506 |
|
/* allocate alpha buffer for portals */ |
507 |
|
if (gmPortals) |
508 |
< |
pbuf = (GLubyte *)malloc(odev.hres*odev.vres * |
506 |
< |
(4*sizeof(GLubyte))); |
508 |
> |
pbuf = (GLubyte *)malloc(odev.hres*odev.vres*sizeof(GLubyte)); |
509 |
|
else |
510 |
|
pbuf = NULL; |
511 |
|
#ifdef STEREO |
516 |
|
glClear(GL_COLOR_BUFFER_BIT); |
517 |
|
gmDrawPortals(0xff, -1, -1, -1); |
518 |
|
glReadPixels(0, 0, odev.hres, odev.vres, |
519 |
< |
GL_RGBA, GL_UNSIGNED_BYTE, pbuf); |
519 |
> |
GL_RED, GL_UNSIGNED_BYTE, pbuf); |
520 |
|
} |
521 |
|
for (dbp = depthright + odev.hres*odev.vres; dbp-- > depthright; ) |
522 |
< |
if (pbuf != NULL && pbuf[4*(dbp-depthright)]&0x40) |
522 |
> |
if (pbuf != NULL && pbuf[dbp-depthright]&0x40) |
523 |
|
*dbp = FHUGE; |
524 |
|
else |
525 |
|
*dbp = mapdepth(*dbp); |
534 |
|
glClear(GL_COLOR_BUFFER_BIT); /* find portals */ |
535 |
|
gmDrawPortals(0xff, -1, -1, -1); |
536 |
|
glReadPixels(0, 0, odev.hres, odev.vres, |
537 |
< |
GL_RGBA, GL_UNSIGNED_BYTE, pbuf); |
537 |
> |
GL_RED, GL_UNSIGNED_BYTE, pbuf); |
538 |
> |
#ifdef DEBUG |
539 |
> |
glXSwapBuffers(ourdisplay, gwind); |
540 |
> |
#endif |
541 |
|
} |
542 |
|
for (dbp = depthbuffer + odev.hres*odev.vres; dbp-- > depthbuffer; ) |
543 |
< |
if (pbuf != NULL && pbuf[4*(dbp-depthbuffer)]&0x40) |
543 |
> |
if (pbuf != NULL && pbuf[dbp-depthbuffer]&0x40) |
544 |
|
*dbp = FHUGE; |
545 |
|
else |
546 |
|
*dbp = mapdepth(*dbp); |
795 |
|
XNoOp(ourdisplay); /* makes sure we're not idle */ |
796 |
|
|
797 |
|
viewflags &= ~VWSTEADY; /* flag moving view */ |
798 |
< |
setglpersp(&odev.v); /* start us off in perspective */ |
798 |
> |
setglpersp(); /* start us off in perspective */ |
799 |
|
while (!XCheckMaskEvent(ourdisplay, |
800 |
|
ButtonReleaseMask, levptr(XEvent))) { |
801 |
|
/* get cursor position */ |
837 |
|
|
838 |
|
|
839 |
|
static |
840 |
< |
setglpersp(vp) /* set perspective view in GL */ |
836 |
< |
register VIEW *vp; |
840 |
> |
setglpersp() /* set perspective view in GL */ |
841 |
|
{ |
842 |
|
double d, xmin, xmax, ymin, ymax; |
843 |
|
GLfloat vec[4]; |
849 |
|
dev_zmax = 100.; |
850 |
|
} else { |
851 |
|
dev_zmin = 0.5*depthlim[0]; |
852 |
< |
dev_zmax = 1.75*depthlim[1]; |
852 |
> |
dev_zmax = 2.0*depthlim[1]; |
853 |
|
if (dev_zmin > dev_zmax/5.) |
854 |
|
dev_zmin = dev_zmax/5.; |
855 |
|
} |
932 |
|
(VWCHANGE|VWSTEADY)) { /* clear samples if new */ |
933 |
|
odClean(); |
934 |
|
viewflags &= ~VWCHANGE; /* change noted */ |
935 |
< |
} |
935 |
> |
} else if (viewflags & VWSTEADY) |
936 |
> |
odRedrawAll(); |
937 |
|
setglpersp(&odev.v); /* reset view & clipping planes */ |
938 |
|
} |
939 |
|
|
984 |
|
inpresflags |= DFL(DC_RESUME); |
985 |
|
return; |
986 |
|
case CTRL('R'): /* redraw screen */ |
987 |
< |
odRemap(0); |
987 |
> |
odRemap(0); /* new tone mapping */ |
988 |
|
glClear(GL_DEPTH_BUFFER_BIT); |
989 |
|
#ifdef STEREO |
990 |
|
setstereobuf(STEREO_BUFFER_RIGHT); |
996 |
|
if (inpresflags & DFL(DC_REDRAW)) |
997 |
|
return; |
998 |
|
XRaiseWindow(ourdisplay, gwind); |
999 |
< |
XFlush(ourdisplay); |
1000 |
< |
sleep(1); |
1001 |
< |
wipeclean(); /* fresh display */ |
1002 |
< |
odRemap(1); /* fresh tone mapping */ |
1003 |
< |
dev_flush(); /* draw octrees */ |
999 |
< |
inpresflags |= DFL(DC_REDRAW); /* resend values from server */ |
999 |
> |
XFlush(ourdisplay); /* raise up window */ |
1000 |
> |
sleep(1); /* wait for restacking */ |
1001 |
> |
dev_clear(); /* clear buffer and samples */ |
1002 |
> |
odRemap(1); /* start fresh histogram */ |
1003 |
> |
dev_flush(); /* redraw geometry */ |
1004 |
|
rayqleft = 0; /* hold off update */ |
1005 |
+ |
inpresflags |= DFL(DC_REDRAW); /* resend values from server */ |
1006 |
|
return; |
1007 |
|
case 'K': /* kill rtrace process(es) */ |
1008 |
|
inpresflags |= DFL(DC_KILL); |
1035 |
|
} |
1036 |
|
xmin = eexp->x; xmax = eexp->x + eexp->width; |
1037 |
|
ymin = odev.vres - eexp->y - eexp->height; ymax = odev.vres - eexp->y; |
1038 |
+ |
|
1039 |
+ |
if (xmin <= 0 && xmax >= odev.hres-1 && |
1040 |
+ |
ymin <= 0 && ymax >= odev.vres) { |
1041 |
+ |
DCHECK(eexp->count, WARNING, "multiple clear in fixwindow"); |
1042 |
+ |
wipeclean(); /* make sure we're go */ |
1043 |
+ |
return; |
1044 |
+ |
} |
1045 |
|
/* clear portion of depth */ |
1046 |
|
glPushAttrib(GL_DEPTH_BUFFER_BIT|GL_COLOR_BUFFER_BIT); |
1047 |
|
glColorMask(GL_FALSE, GL_FALSE, GL_FALSE, GL_FALSE); |