41 static void P__transform(
int num_vert,
float (*in)[4],
42 float (*out)[4],
float (*c)[4]);
43 static void P_matrix_copy(
float (*from)[4],
float (*to)[4],
int size);
48 static int stack_ptr = -1;
56 static float trans_mat[4][4] = {
63 static float ident[4][4] = {
99 P__transform(4, d, c_stack[stack_ptr], trans_mat);
119 P__transform(num_vert, in, out, trans_mat);
136 static void P__transform(
int num_vert,
float (*in)[4],
float (*out)[4],
139 register int k, j, i;
141 for (i = 0; i < num_vert; i++) {
142 for (j = 0; j < 4; j++) {
145 for (k = 0; k < 4; k++) {
146 out[i][j] += in[i][k] * c[k][j];
161 static void P_matrix_copy(
float (*from)[4],
float (*to)[4],
int size)
165 for (i = 0; i < size; i++) {
166 for (j = 0; j < 4; j++) {
167 to[i][j] = from[i][j];
180 G_warning(
"P_pushmatrix(): %s",
_(
"Out of matrix stack space"));
186 P_matrix_copy(trans_mat, c_stack[stack_ptr], 4);
200 G_warning(
"P_popmatrix(): %s",
_(
"Tried to pop an empty stack"));
205 P_matrix_copy(c_stack[stack_ptr], trans_mat, 4);
221 P_matrix_copy(ident, d, 4);
223 theta = (
NPI / 180.) * angle;
230 d[1][1] = cos(theta);
231 d[1][2] = sin(theta);
232 d[2][1] = -sin(theta);
233 d[2][2] = cos(theta);
239 d[0][0] = cos(theta);
240 d[0][2] = -sin(theta);
241 d[2][0] = sin(theta);
242 d[2][2] = cos(theta);
247 d[0][0] = cos(theta);
248 d[0][1] = sin(theta);
249 d[1][0] = -sin(theta);
250 d[1][1] = cos(theta);
256 P__transform(4, d, c_stack[stack_ptr], trans_mat);
void P_transform(int num_vert, float(*in)[4], float(*out)[4])
Transform array of vectors using current T matrix.
void P_rot(float angle, char axis)
Rotate matrix.
int P_popmatrix(void)
Pop top of matrix stack, placing it into the current transformation matrix.
int P_pushmatrix(void)
Push current transformation matrix onto matrix stack.
void G_warning(const char *,...) __attribute__((format(printf
void P_scale(float x, float y, float z)
ADD.