1 |
– |
/* Copyright (c) 1998 Silicon Graphics, Inc. */ |
2 |
– |
|
1 |
|
#ifndef lint |
2 |
< |
static char SCCSid[] = "$SunId$ SGI"; |
2 |
> |
static const char RCSid[] = "$Id$"; |
3 |
|
#endif |
6 |
– |
|
4 |
|
/* |
5 |
|
* Holodeck beam support for display process |
6 |
|
*/ |
7 |
|
|
8 |
|
#include "rholo.h" |
9 |
|
#include "rhdisp.h" |
13 |
– |
#include "view.h" |
10 |
|
|
11 |
|
struct cellist { |
12 |
|
GCOORD *cl; |
26 |
|
FVECT cp[4], ip[4], pf, pb; |
27 |
|
double af, ab, sf2, sb2, dfb2, df2, db2, penalty; |
28 |
|
register int i; |
29 |
+ |
/* special case */ |
30 |
+ |
if (hr <= 0 | vr <= 0) |
31 |
+ |
return(0); |
32 |
|
/* compute cell corners in image */ |
33 |
|
if (!hdbcoord(gc, hp, bi)) |
34 |
|
error(CONSISTENCY, "bad beam index in npixels"); |
52 |
|
(ip[1][0]-ip[3][0])*(ip[2][1]-ip[3][1]); |
53 |
|
af *= af >= 0 ? 0.5 : -0.5; |
54 |
|
getback: |
55 |
< |
copystruct(&vrev, vp); /* compute reverse view */ |
55 |
> |
vrev = *vp; /* compute reverse view */ |
56 |
|
for (i = 0; i < 3; i++) { |
57 |
|
vrev.vdir[i] = -vp->vdir[i]; |
58 |
|
vrev.vup[i] = -vp->vup[i]; |
238 |
|
GCOORD *gcp; |
239 |
|
register struct cellist *cl; |
240 |
|
{ |
241 |
< |
copystruct(cl->cl+cl->n, gcp); |
241 |
> |
*(cl->cl+cl->n) = *gcp; |
242 |
|
cl->n++; |
243 |
|
return(1); |
244 |
|
} |
280 |
|
if (cl.cl == NULL) |
281 |
|
goto memerr; |
282 |
|
cl.n = 0; /* add cells within pyramid */ |
283 |
< |
visit_cells(org, dir, hp, addcell, &cl); |
283 |
> |
visit_cells(org, dir, hp, addcell, (char *)&cl); |
284 |
|
if (!cl.n) { |
285 |
< |
free((char *)cl.cl); |
285 |
> |
free((void *)cl.cl); |
286 |
|
return(NULL); |
287 |
|
} |
288 |
|
*np = cl.n * orient; |
291 |
|
* sorted automatically by visit_cells(), so we don't need this. |
292 |
|
*/ |
293 |
|
/* optimize memory use */ |
294 |
< |
cl.cl = (GCOORD *)realloc((char *)cl.cl, cl.n*sizeof(GCOORD)); |
294 |
> |
cl.cl = (GCOORD *)realloc((void *)cl.cl, cl.n*sizeof(GCOORD)); |
295 |
|
if (cl.cl == NULL) |
296 |
|
goto memerr; |
297 |
|
/* sort the list */ |
303 |
|
} |
304 |
|
|
305 |
|
|
306 |
< |
gridlines(f) /* run through holodeck section grid lines */ |
307 |
< |
int (*f)(); |
306 |
> |
extern void |
307 |
> |
gridlines( /* run through holodeck section grid lines */ |
308 |
> |
void (*f)(FVECT wp[2]) |
309 |
> |
) |
310 |
|
{ |
311 |
|
register int hd, w, i; |
312 |
|
int g0, g1; |