1 |
< |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
1 |
> |
/* Copyright (c) 1999 Silicon Graphics, Inc. */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ SGI"; |
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 |
+ |
#ifndef MINWIDTH |
43 |
+ |
#define MINWIDTH 480 /* minimum graphics window width */ |
44 |
+ |
#define MINHEIGHT 400 /* minimum graphics window height */ |
45 |
+ |
#endif |
46 |
+ |
#ifndef VIEWDIST |
47 |
+ |
#define VIEWDIST 356 /* assumed viewing distance (mm) */ |
48 |
+ |
#endif |
49 |
+ |
#ifndef BORWIDTH |
50 |
+ |
#define BORWIDTH 5 /* border width */ |
51 |
+ |
#endif |
52 |
|
|
53 |
|
#ifndef FEQ |
54 |
|
#define FEQ(a,b) ((a)-(b) <= FTINY && (a)-(b) >= -FTINY) |
70 |
|
#define MOVDEG (-5) /* degrees to orbit CW/down /frame */ |
71 |
|
#define MOVORB(s) ((s)&ShiftMask ? 1 : (s)&ControlMask ? -1 : 0) |
72 |
|
|
63 |
– |
#define MINWIDTH 480 /* minimum graphics window width */ |
64 |
– |
#define MINHEIGHT 400 /* minimum graphics window height */ |
65 |
– |
|
66 |
– |
#define VIEWDIST 356 /* assumed viewing distance (mm) */ |
67 |
– |
|
68 |
– |
#define BORWIDTH 5 /* border width */ |
69 |
– |
|
73 |
|
#define setstereobuf(bid) (glXWaitGL(), \ |
74 |
|
XSGISetStereoBuffer(ourdisplay, gwind, bid), \ |
75 |
|
glXWaitX()) |
253 |
|
XMapWindow(ourdisplay, gwind); |
254 |
|
dev_input(); /* sets size and view angles */ |
255 |
|
if (!odInit(DisplayWidth(ourdisplay,ourscreen) * |
256 |
< |
DisplayHeight(ourdisplay,ourscreen) / 4)) |
256 |
> |
DisplayHeight(ourdisplay,ourscreen) / 3)) |
257 |
|
error(SYSTEM, "insufficient memory for value storage"); |
258 |
|
odev.name = id; |
259 |
|
odev.firstuse = 1; /* can't recycle samples */ |
287 |
|
{ |
288 |
|
viewflags |= VWCHANGE; /* pretend our view has changed */ |
289 |
|
wipeclean(); /* clean off display and samples */ |
290 |
+ |
dev_flush(); /* redraw geometry & get depth */ |
291 |
|
rayqleft = 0; /* hold off update */ |
292 |
|
} |
293 |
|
|
334 |
|
dev_input(); /* get resize event */ |
335 |
|
} |
336 |
|
copystruct(&odev.v, nv); /* setview() already called */ |
333 |
– |
#ifdef STEREO |
334 |
– |
copystruct(&vwright, nv); |
335 |
– |
d = eyesepdist / sqrt(nv->hn2); |
336 |
– |
VSUM(vwright.vp, nv->vp, nv->hvec, d); |
337 |
– |
/* setview(&vwright); -- Unnecessary */ |
338 |
– |
#endif |
337 |
|
viewflags |= VWCHANGE; |
338 |
|
} |
339 |
+ |
#ifdef STEREO |
340 |
+ |
copystruct(&vwright, nv); |
341 |
+ |
d = eyesepdist / sqrt(nv->hn2); |
342 |
+ |
VSUM(vwright.vp, nv->vp, nv->hvec, d); |
343 |
+ |
/* setview(&vwright); -- Unnecessary */ |
344 |
+ |
#endif |
345 |
|
wipeclean(); |
346 |
|
return(1); |
347 |
|
} |
376 |
|
char *cmd, *args; |
377 |
|
{ |
378 |
|
#ifdef DOBJ |
379 |
< |
if (dobj_command(cmd, args) >= 0) |
379 |
> |
int vischange; |
380 |
> |
|
381 |
> |
if ((vischange = dobj_command(cmd, args)) >= 0) { |
382 |
> |
if (vischange) { |
383 |
> |
imm_mode = beam_sync(1) > 0; |
384 |
> |
dev_clear(); |
385 |
> |
} |
386 |
|
return; |
387 |
+ |
} |
388 |
|
#endif |
389 |
|
sprintf(errmsg, "%s: unknown command", cmd); |
390 |
|
error(COMMAND, errmsg); |
520 |
|
else |
521 |
|
pbuf = NULL; |
522 |
|
#ifdef STEREO |
523 |
< |
setstereobuf(STEREO_BUFFER_RIGHT); |
523 |
> |
pushright(); |
524 |
|
glReadPixels(0, 0, odev.hres, odev.vres, |
525 |
|
GL_DEPTH_COMPONENT, GL_FLOAT, depthright); |
526 |
|
if (pbuf != NULL) { |
535 |
|
else |
536 |
|
*dbp = mapdepth(*dbp); |
537 |
|
glClear(GL_DEPTH_BUFFER_BIT); |
527 |
– |
setstereobuf(STEREO_BUFFER_LEFT); |
538 |
|
odDepthMap(1, depthright); |
539 |
+ |
popright(); |
540 |
|
#endif |
541 |
|
/* read back depth buffer */ |
542 |
|
glReadPixels(0, 0, odev.hres, odev.vres, |
806 |
|
XNoOp(ourdisplay); /* makes sure we're not idle */ |
807 |
|
|
808 |
|
viewflags &= ~VWSTEADY; /* flag moving view */ |
809 |
< |
setglpersp(&odev.v); /* start us off in perspective */ |
809 |
> |
setglpersp(); /* start us off in perspective */ |
810 |
|
while (!XCheckMaskEvent(ourdisplay, |
811 |
|
ButtonReleaseMask, levptr(XEvent))) { |
812 |
|
/* get cursor position */ |
848 |
|
|
849 |
|
|
850 |
|
static |
851 |
< |
setglpersp(vp) /* set perspective view in GL */ |
841 |
< |
register VIEW *vp; |
851 |
> |
setglpersp() /* set perspective view in GL */ |
852 |
|
{ |
853 |
|
double d, xmin, xmax, ymin, ymax; |
854 |
|
GLfloat vec[4]; |
860 |
|
dev_zmax = 100.; |
861 |
|
} else { |
862 |
|
dev_zmin = 0.5*depthlim[0]; |
863 |
< |
dev_zmax = 2.0*depthlim[1]; |
863 |
> |
dev_zmax = 1.25*depthlim[1]; |
864 |
|
if (dev_zmin > dev_zmax/5.) |
865 |
|
dev_zmin = dev_zmax/5.; |
866 |
|
} |
1005 |
|
return; |
1006 |
|
case CTRL('L'): /* refresh from server */ |
1007 |
|
if (inpresflags & DFL(DC_REDRAW)) |
1008 |
< |
return; |
1008 |
> |
return; /* already called */ |
1009 |
|
XRaiseWindow(ourdisplay, gwind); |
1010 |
< |
XFlush(ourdisplay); |
1010 |
> |
XFlush(ourdisplay); /* raise up window */ |
1011 |
|
sleep(1); /* wait for restacking */ |
1012 |
< |
dev_clear(); /* clear display and samples */ |
1003 |
< |
dev_flush(); /* draw octrees */ |
1012 |
> |
dev_clear(); /* clear buffer and samples */ |
1013 |
|
odRemap(1); /* start fresh histogram */ |
1014 |
|
inpresflags |= DFL(DC_REDRAW); /* resend values from server */ |
1015 |
|
return; |
1048 |
|
if (xmin <= 0 && xmax >= odev.hres-1 && |
1049 |
|
ymin <= 0 && ymax >= odev.vres) { |
1050 |
|
DCHECK(eexp->count, WARNING, "multiple clear in fixwindow"); |
1051 |
< |
if (viewflags & VWORTHO) /* workaround for... */ |
1043 |
< |
glDrawBuffer(GL_FRONT); /* ...GLX window mapping bug */ |
1044 |
< |
glClear(GL_DEPTH_BUFFER_BIT); /* clear the entire buffer */ |
1045 |
< |
#ifdef STEREO |
1046 |
< |
setstereobuf(STEREO_BUFFER_RIGHT); |
1047 |
< |
glClear(GL_DEPTH_BUFFER_BIT); |
1048 |
< |
setstereobuf(STEREO_BUFFER_LEFT); |
1049 |
< |
#endif |
1050 |
< |
odRedrawAll(); |
1051 |
> |
wipeclean(); /* make sure we're go */ |
1052 |
|
return; |
1053 |
|
} |
1054 |
|
/* clear portion of depth */ |