5 |
|
#endif |
6 |
|
|
7 |
|
/* |
8 |
< |
* Holodeck beam support |
8 |
> |
* Holodeck beam support for display process |
9 |
|
*/ |
10 |
|
|
11 |
|
#include "rholo.h" |
90 |
|
hdworld(lo, hp, gp); |
91 |
|
gp[((gc.w>>1)+1)%3] = 1; |
92 |
|
hdworld(ld, hp, gp); |
93 |
< |
ld[0] -= lo[0]; ld[1] -= lo[1]; ld[2] -= lo[1]; |
93 |
> |
ld[0] -= lo[0]; ld[1] -= lo[1]; ld[2] -= lo[2]; |
94 |
|
/* find scanline limits */ |
95 |
|
lbeg = 0; lend = hp->grid[((gc.w>>1)+1)%3]; |
96 |
|
for (i = 0; i < 4; i++) { |
97 |
|
t = DOT(pn[i], lo) - po[i]; |
98 |
|
d = -DOT(pn[i], ld); |
99 |
< |
if (d <= FTINY && d >= -FTINY) { |
100 |
< |
if (t < 0) |
101 |
< |
goto nextscan; |
102 |
< |
continue; |
103 |
< |
} |
104 |
< |
if (t > 0) { |
99 |
> |
if (d > FTINY) { /* <- plane */ |
100 |
|
if ((t /= d) < lend) |
101 |
|
lend = t; |
102 |
< |
} else { |
102 |
> |
} else if (d < -FTINY) { /* plane -> */ |
103 |
|
if ((t /= d) > lbeg) |
104 |
|
lbeg = t; |
105 |
+ |
} else if (t < 0) { /* outside */ |
106 |
+ |
lend = -1; |
107 |
+ |
break; |
108 |
|
} |
109 |
|
} |
110 |
+ |
if (lbeg >= lend) |
111 |
+ |
continue; |
112 |
|
i = lend + .5; /* visit cells on this scan */ |
113 |
|
for (gc.i[0] = lbeg + .5; gc.i[0] < i; gc.i[0]++) |
114 |
|
n += (*vf)(&gc, dp); |
115 |
– |
nextscan:; |
115 |
|
} |
116 |
|
} |
117 |
|
return(n); |
172 |
|
return(NULL); |
173 |
|
} |
174 |
|
#if 0 |
175 |
< |
/* We're just going to free this memory in a moment, and list is */ |
176 |
< |
/* sorted automatically by visit_cells(), so we don't need this. */ |
175 |
> |
/* We're just going to free this memory in a moment, and list is |
176 |
> |
* sorted automatically by visit_cells(), so we don't need this. |
177 |
> |
*/ |
178 |
|
if (*cl < n) { /* optimize memory use */ |
179 |
|
cl = (int *)realloc((char *)cl, |
180 |
|
sizeof(int) + *cl*sizeof(GCOORD)); |