1 |
< |
/* Copyright (c) 1997 Silicon Graphics, Inc. */ |
1 |
> |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
2 |
|
|
3 |
|
#ifndef lint |
4 |
|
static char SCCSid[] = "$SunId$ SGI"; |
13 |
|
#include "rhdriver.h" |
14 |
|
|
15 |
|
#ifndef MAXDIST |
16 |
< |
#define MAXDIST 13 /* maximum distance outside section */ |
16 |
> |
#define MAXDIST 42 /* maximum distance outside section */ |
17 |
|
#endif |
18 |
|
|
19 |
|
extern GCOORD *getviewcells(); |
94 |
|
|
95 |
|
if (!cb1->wants) /* put orphans at the end, unsorted */ |
96 |
|
return(cb2->wants); |
97 |
+ |
if (!cb2->wants) |
98 |
+ |
return(-1); |
99 |
|
if ((c = cb1->bi - cb2->bi)) /* sort on beam index first */ |
100 |
|
return(c); |
101 |
|
return(cb1->hd - cb2->hd); /* use hd to resolve matches */ |
164 |
|
} |
165 |
|
|
166 |
|
|
165 |
– |
cbeamadj(v, hr, vr) /* adjust our beam list */ |
166 |
– |
VIEW *v; |
167 |
– |
int hr, vr; |
168 |
– |
{ |
169 |
– |
register PACKHEAD *pa; |
170 |
– |
register int i; |
171 |
– |
int n; |
172 |
– |
/* first handle additions */ |
173 |
– |
pa = (PACKHEAD *)malloc(xcbeams*sizeof(PACKHEAD)); |
174 |
– |
if (xcbeams && pa == NULL) |
175 |
– |
goto memerr; |
176 |
– |
for (i = xcbeams; i--; ) { |
177 |
– |
pa[i].hd = cbeam[ncbeams+i].hd; |
178 |
– |
pa[i].bi = cbeam[ncbeams+i].bi; |
179 |
– |
pa[i].nr = npixels(v, hr, vr, hdlist[pa[i].hd], pa[i].bi) + 1; |
180 |
– |
} |
181 |
– |
n = xcbeams; /* now sort list for deletions */ |
182 |
– |
cbeamsort(0); |
183 |
– |
pa = (PACKHEAD *)realloc((char *)pa, (n+xcbeams)*sizeof(PACKHEAD)); |
184 |
– |
if (n+xcbeams && pa == NULL) |
185 |
– |
goto memerr; |
186 |
– |
for (i = xcbeams; i--; ) { |
187 |
– |
pa[n+i].hd = cbeam[ncbeams+i].hd; |
188 |
– |
pa[n+i].bi = cbeam[ncbeams+i].bi; |
189 |
– |
pa[n+i].nr = 0; |
190 |
– |
} |
191 |
– |
n += xcbeams; |
192 |
– |
xcbeams = 0; /* delete orphans */ |
193 |
– |
serv_request(DR_ADJSET, n*sizeof(PACKHEAD), (char *)pa); |
194 |
– |
free((char *)pa); |
195 |
– |
return; |
196 |
– |
memerr: |
197 |
– |
error(SYSTEM, "out of memory in cbeamadj"); |
198 |
– |
} |
199 |
– |
|
200 |
– |
|
167 |
|
cbeamop(op, bl, n, v, hr, vr) /* update beams on server list */ |
168 |
|
int op; |
169 |
|
register struct beamcomp *bl; |
184 |
|
pa[i].bi = bl[i].bi; |
185 |
|
pa[i].nr = v==NULL ? 0 : |
186 |
|
npixels(v, hr, vr, hdlist[bl[i].hd], bl[i].bi); |
187 |
+ |
pa[i].nc = 0; |
188 |
|
} |
189 |
|
serv_request(op, n*sizeof(PACKHEAD), (char *)pa); |
190 |
|
free((char *)pa); |
235 |
|
VOXL vl[8]; |
236 |
|
FVECT vp; |
237 |
|
{ |
271 |
– |
static int lastn = 0, lastd = -1; |
238 |
|
int n = 0; |
239 |
|
FVECT gp; |
240 |
|
double d; |
270 |
|
error(COMMAND, "move past outer limits"); |
271 |
|
return(0); |
272 |
|
} |
273 |
< |
/* warn of dangerous moves */ |
308 |
< |
if (n < lastn && bestd >= lastd) |
309 |
< |
error(WARNING, "moving outside holodeck section"); |
310 |
< |
else if (n > lastn && bestd <= lastd) |
311 |
< |
error(WARNING, "moving inside holodeck section"); |
312 |
< |
lastd = bestd; |
313 |
< |
return(lastn = n); |
273 |
> |
return(n); |
274 |
|
} |
275 |
|
|
276 |
|
|
444 |
|
VOXL vlnew[8]; |
445 |
|
int n, comn; |
446 |
|
|
447 |
< |
if (!vn->type) { /* clear our beam list */ |
447 |
> |
if (vn == NULL || !vn->type) { /* clear our beam list */ |
448 |
|
set_voxels(vlnew, 0); |
449 |
|
cbeamop(DR_DELSET, cbeam, ncbeams, NULL, 0, 0); |
450 |
|
ncbeams = 0; |
451 |
< |
copystruct(&dvw, vn); |
451 |
> |
dvw.type = 0; |
452 |
|
return(1); |
453 |
|
} |
454 |
|
/* find our new voxels */ |
467 |
|
mvview(ca.vi, &dvw, vn); |
468 |
|
else /* else add all new cells */ |
469 |
|
doview(&ca, vn); |
510 |
– |
#if 1 |
511 |
– |
cbeamadj(vn, odev.hres, odev.vres); |
512 |
– |
#else |
470 |
|
/* inform server of new beams */ |
471 |
|
cbeamop(DR_ADDSET, cbeam+ncbeams, xcbeams, vn, odev.hres, odev.vres); |
472 |
|
/* sort list to put orphans at end */ |
474 |
|
/* tell server to delete orphans */ |
475 |
|
cbeamop(DR_DELSET, cbeam+ncbeams, xcbeams, NULL, 0, 0); |
476 |
|
xcbeams = 0; /* truncate our list */ |
520 |
– |
#endif |
477 |
|
copystruct(&dvw, vn); /* record new view */ |
478 |
|
return(1); |
479 |
|
} |