33 |
|
int ac; |
34 |
|
char **av; |
35 |
|
{ |
36 |
+ |
#define randshift(x,n) ((long)(x) << shifttab[(n)&63]) |
37 |
+ |
static char shifttab[64] = { 15, 5, 11, 5, 6, 3, |
38 |
+ |
9, 15, 13, 2, 13, 5, 2, 12, 14, 11, |
39 |
+ |
11, 12, 12, 3, 2, 11, 8, 12, 1, 12, |
40 |
+ |
5, 4, 15, 9, 14, 5, 13, 14, 2, 10, |
41 |
+ |
10, 14, 12, 3, 5, 5, 14, 6, 12, 11, |
42 |
+ |
13, 9, 12, 8, 1, 6, 5, 12, 7, 13, |
43 |
+ |
15, 8, 9, 2, 6, 11, 9, 11 }; |
44 |
|
register int i; |
45 |
|
register XF_SPEC *spec; |
46 |
|
XF thisxf; |
88 |
|
spec->xf.sca = xf_context->xf.sca * thisxf.sca; |
89 |
|
} else |
90 |
|
spec->xf = thisxf; |
91 |
+ |
spec->xid = 0; /* compute unique transform id */ |
92 |
+ |
for (i = 0; i < sizeof(MAT4)/sizeof(unsigned short); i++) |
93 |
+ |
spec->xid ^= randshift(((unsigned short *)&spec->xf.xfm)[i],i); |
94 |
+ |
|
95 |
|
spec->prev = xf_context; /* push new transform onto stack */ |
96 |
|
xf_context = spec; |
97 |
|
return(MG_OK); |
98 |
+ |
#undef randshift |
99 |
|
} |
100 |
|
|
101 |
|
|
102 |
|
void |
103 |
+ |
xf_clear() /* clear transform stack */ |
104 |
+ |
{ |
105 |
+ |
register XF_SPEC *spec; |
106 |
+ |
|
107 |
+ |
while (xf_argc) |
108 |
+ |
free((MEM_PTR)xf_argv[--xf_argc]); |
109 |
+ |
if (xf_maxarg) { |
110 |
+ |
free((MEM_PTR)xf_argv); |
111 |
+ |
xf_argv = NULL; |
112 |
+ |
xf_maxarg = 0; |
113 |
+ |
} |
114 |
+ |
while ((spec = xf_context) != NULL) { |
115 |
+ |
xf_context = spec->prev; |
116 |
+ |
free((MEM_PTR)spec); |
117 |
+ |
} |
118 |
+ |
} |
119 |
+ |
|
120 |
+ |
|
121 |
+ |
void |
122 |
|
xf_xfmpoint(v1, v2) /* transform a point by the current matrix */ |
123 |
|
FVECT v1, v2; |
124 |
|
{ |
220 |
|
xf(ret, ac, av) /* get transform specification */ |
221 |
|
register XF *ret; |
222 |
|
int ac; |
223 |
< |
char *av[]; |
223 |
> |
char **av; |
224 |
|
{ |
225 |
|
MAT4 xfmat, m4; |
226 |
|
double xfsca, dtmp; |