40static void P__transform(
int num_vert,
float (*in)[4],
float (*
out)[4],
42static void P_matrix_copy(
float (*from)[4],
float (*to)[4],
int size);
46static int stack_ptr = -1;
54static float trans_mat[4][4] = {
55 {1., 0., 0., 0.}, {0., 1., 0., 0.}, {0., 0., 1., 0.}, {0., 0., 0., 1.}};
57static float ident[4][4] = {
58 {1., 0., 0., 0.}, {0., 1., 0., 0.}, {0., 0., 1., 0.}, {0., 0., 0., 1.}};
89 P__transform(4, d, c_stack[stack_ptr], trans_mat);
126static void P__transform(
int num_vert,
float (*in)[4],
float (*
out)[4],
129 register int k,
j, i;
132 for (
j = 0;
j < 4;
j++) {
135 for (k = 0; k < 4; k++) {
136 out[i][
j] += in[i][k] * c[k][
j];
151static void P_matrix_copy(
float (*from)[4],
float (*to)[4],
int size)
155 for (i = 0; i < size; i++) {
156 for (
j = 0;
j < 4;
j++) {
157 to[i][
j] = from[i][
j];
170 G_warning(
"P_pushmatrix(): %s",
_(
"Out of matrix stack space"));
176 P_matrix_copy(trans_mat, c_stack[stack_ptr], 4);
191 G_warning(
"P_popmatrix(): %s",
_(
"Tried to pop an empty stack"));
196 P_matrix_copy(c_stack[stack_ptr], trans_mat, 4);
212 P_matrix_copy(ident, d, 4);
221 d[1][1] =
cos(theta);
222 d[1][2] =
sin(theta);
223 d[2][1] = -
sin(theta);
224 d[2][2] =
cos(theta);
230 d[0][0] =
cos(theta);
231 d[0][2] = -
sin(theta);
232 d[2][0] =
sin(theta);
233 d[2][2] =
cos(theta);
238 d[0][0] =
cos(theta);
239 d[0][1] =
sin(theta);
240 d[1][0] = -
sin(theta);
241 d[1][1] =
cos(theta);
247 P__transform(4, d, c_stack[stack_ptr], trans_mat);
void G_warning(const char *,...) __attribute__((format(printf
OGSF header file (structures)
int P_popmatrix(void)
Pop top of matrix stack, placing it into the current transformation matrix.
void P_transform(int num_vert, float(*in)[4], float(*out)[4])
Transform array of vectors using current T matrix.
void P_scale(float x, float y, float z)
ADD.
void P_rot(float angle, char axis)
Rotate matrix.
int P_pushmatrix(void)
Push current transformation matrix onto matrix stack.