33 |
|
#define NCONEV 7 /* number of cone base vertices */ |
34 |
|
#endif |
35 |
|
#ifndef CONEH |
36 |
< |
#define CONEH 5. /* cone height (fraction of depth) */ |
36 |
> |
#define CONEH 3. /* cone height (fraction of depth) */ |
37 |
|
#endif |
38 |
|
#ifndef CONEW |
39 |
< |
#define CONEW 0.07 /* cone width (fraction of screen) */ |
39 |
> |
#define CONEW 0.05 /* cone width (fraction of screen) */ |
40 |
|
#endif |
41 |
|
#ifndef DIRPEN |
42 |
|
#define DIRPEN 0.001 /* direction penalty factor */ |
43 |
|
#endif |
44 |
+ |
#ifndef VALUA |
45 |
+ |
#define VALUA 16 /* target value area (pixels) */ |
46 |
+ |
#endif |
47 |
|
|
48 |
|
#define GAMMA 1.4 /* default gamma correction */ |
49 |
|
|
90 |
|
|
91 |
|
static int headlocked = 0; /* lock vertical motion */ |
92 |
|
|
93 |
+ |
static int quicken = 0; /* quicker, sloppier update rate? */ |
94 |
+ |
|
95 |
|
static struct { |
96 |
|
float (*wp)[3]; /* world intersection point array */ |
97 |
|
int4 *wd; /* world direction array */ |
194 |
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
195 |
|
/* allocate our value list */ |
196 |
|
if (!AllocValues(DisplayWidth(ourdisplay,ourscreen) * |
197 |
< |
DisplayHeight(ourdisplay,ourscreen) / 4)) |
197 |
> |
DisplayHeight(ourdisplay,ourscreen) / VALUA)) |
198 |
|
error(SYSTEM, "insufficient memory for value storage"); |
199 |
|
odev.name = id; |
200 |
|
odev.ifd = ConnectionNumber(ourdisplay); |
387 |
|
} |
388 |
|
|
389 |
|
|
390 |
+ |
#define SUCCSTEP 8 /* skip step when successful */ |
391 |
+ |
#define MAXSTEP 64 |
392 |
+ |
|
393 |
|
static |
394 |
|
drawvalue(li) /* draw a pixel value as a cone */ |
395 |
|
register int li; |
396 |
|
{ |
397 |
+ |
static int skipstep = 1; |
398 |
|
static FVECT disp; |
399 |
|
FVECT apex; |
400 |
|
double d, dorg, dnew, h, v; |
401 |
|
register int i; |
402 |
+ |
/* check for quicker update */ |
403 |
+ |
if (quicken) { |
404 |
+ |
if (li % skipstep) |
405 |
+ |
return; |
406 |
+ |
if (skipstep < MAXSTEP) |
407 |
+ |
skipstep++; |
408 |
+ |
} |
409 |
|
/* compute cone coordinates */ |
410 |
|
disp[0] = rV.wp[li][0] - odev.v.vp[0]; |
411 |
|
disp[1] = rV.wp[li][1] - odev.v.vp[1]; |
418 |
|
if (dorg > 1e5) { /* background pixel */ |
419 |
|
dnew = maxdepth; |
420 |
|
d = dnew/dorg; |
421 |
+ |
dorg = maxdepth; |
422 |
|
} else { /* foreground pixel, compute penalty */ |
423 |
|
normalize(disp); |
424 |
|
d = dnew = dorg + coneh*fdir2diff(rV.wd[li],disp)*DIRPEN; |
450 |
|
glVertex3d(conev[0][0] + disp[0], conev[0][1] + disp[1], |
451 |
|
conev[0][2] + disp[2]); |
452 |
|
glEnd(); /* done */ |
453 |
+ |
skipstep = SUCCSTEP; |
454 |
|
} |
455 |
|
|
456 |
+ |
#undef SUCCSTEP |
457 |
+ |
#undef MAXSTEP |
458 |
|
|
459 |
+ |
|
460 |
|
#define LEAFSIZ (3*sizeof(float)+sizeof(int4)+\ |
461 |
|
sizeof(TMbright)+7*sizeof(BYTE)) |
462 |
|
|
829 |
|
int rootx, rooty, wx, wy; |
830 |
|
unsigned int statemask; |
831 |
|
|
832 |
+ |
quicken = 1; /* accelerate update rate */ |
833 |
|
XNoOp(ourdisplay); |
834 |
|
|
835 |
|
while (!XCheckMaskEvent(ourdisplay, |
855 |
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT); |
856 |
|
redraw(); |
857 |
|
} |
858 |
+ |
quicken = 0; |
859 |
|
dev_flush(); |
860 |
|
} |
861 |
|
|