| 5 |
|
* Rendering routines for rhpict. |
| 6 |
|
*/ |
| 7 |
|
|
| 8 |
+ |
#include <string.h> |
| 9 |
+ |
|
| 10 |
|
#include "holo.h" |
| 11 |
|
#include "view.h" |
| 12 |
|
#include "random.h" |
| 37 |
|
#define CLR4(f,i) FL4OP(f,i,&=~) |
| 38 |
|
#define TGL4(f,i) FL4OP(f,i,^=) |
| 39 |
|
#define FL4NELS(n) (((n)+0x1f)>>5) |
| 40 |
< |
#define CLR4ALL(f,n) bzero((char *)(f),FL4NELS(n)*sizeof(int4)) |
| 40 |
> |
#define CLR4ALL(f,n) memset((char *)(f),'\0',FL4NELS(n)*sizeof(int32)) |
| 41 |
|
#endif |
| 42 |
|
|
| 43 |
< |
static int4 *pixFlags; /* pixel occupancy flags */ |
| 43 |
> |
static int32 *pixFlags; /* pixel occupancy flags */ |
| 44 |
|
static float pixWeight[MAXRAD2]; /* pixel weighting function */ |
| 45 |
|
static short isqrttab[MAXRAD2]; /* integer square root table */ |
| 46 |
|
|
| 53 |
|
extern int hres, vres; /* current horizontal and vertical res. */ |
| 54 |
|
|
| 55 |
|
|
| 56 |
+ |
void |
| 57 |
|
pixBeam(bp, hb) /* render a particular beam */ |
| 58 |
|
BEAM *bp; |
| 59 |
|
register HDBEAMI *hb; |
| 64 |
|
double d, prox; |
| 65 |
|
COLOR col; |
| 66 |
|
int n; |
| 67 |
< |
register int4 p; |
| 67 |
> |
register int32 p; |
| 68 |
|
|
| 69 |
|
if (!hdbcoord(gc, hb->h, hb->b)) |
| 70 |
|
error(CONSISTENCY, "bad beam in render_beam"); |
| 121 |
|
short forequad[2][2]; |
| 122 |
|
int d; |
| 123 |
|
register int i; |
| 124 |
< |
register int4 p; |
| 124 |
> |
register int32 p; |
| 125 |
|
|
| 126 |
|
if (n <= 0) { |
| 127 |
|
#ifdef DEBUG |
| 155 |
|
COLOR mykern[MAXRAD2]; |
| 156 |
|
int maxr2; |
| 157 |
|
double d; |
| 158 |
< |
register int4 p; |
| 158 |
> |
register int32 p; |
| 159 |
|
register int r2; |
| 160 |
|
int i, r, maxr, h2, v2; |
| 161 |
|
|
| 216 |
|
{ |
| 217 |
|
float rnt[NNEIGH]; |
| 218 |
|
double rvar; |
| 219 |
< |
register int4 p, pn; |
| 219 |
> |
register int32 p, pn; |
| 220 |
|
register int ni; |
| 221 |
|
|
| 222 |
|
if (n <= 0) |
| 259 |
|
|
| 260 |
|
reset_flags() /* allocate/set/reset occupancy flags */ |
| 261 |
|
{ |
| 262 |
< |
register int4 p; |
| 262 |
> |
register int32 p; |
| 263 |
|
|
| 264 |
|
if (pixFlags == NULL) { |
| 265 |
< |
pixFlags = (int4 *)calloc(FL4NELS(hres*vres), sizeof(int4)); |
| 265 |
> |
pixFlags = (int32 *)calloc(FL4NELS(hres*vres), sizeof(int32)); |
| 266 |
|
CHECK(pixFlags==NULL, SYSTEM, "out of memory in reset_flags"); |
| 267 |
|
} else |
| 268 |
|
CLR4ALL(pixFlags, hres*vres); |
| 301 |
|
nd[NNEIGH-1] = MAXRAD2; |
| 302 |
|
for (hoff = 0; hoff < hres; hoff = (hoff<=0) - hoff) { |
| 303 |
|
h2 = h + hoff; |
| 304 |
< |
if (h2 < 0 | h2 >= hres) |
| 304 |
> |
if ((h2 < 0) | (h2 >= hres)) |
| 305 |
|
continue; |
| 306 |
|
if ((h2-h)*(h2-h) >= nd[NNEIGH-1]) |
| 307 |
|
break; |
| 308 |
|
for (n = 0; n < NNEIGH && rnl[h2][n] < NINF; n++) { |
| 309 |
|
d = (h2-h)*(h2-h) + (v-rnl[h2][n])*(v-rnl[h2][n]); |
| 310 |
< |
if (d == 0 | d >= nd[NNEIGH-1]) |
| 310 |
> |
if ((d == 0) | (d >= nd[NNEIGH-1])) |
| 311 |
|
continue; |
| 312 |
|
if (nn < NNEIGH) /* insert neighbor */ |
| 313 |
|
nn++; |