annotate src/dmvecmat.c @ 2294:7f6ba3b32f54

Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Wed, 03 Jul 2019 10:28:43 +0300
parents 696c58784635
children 69a5af2eb1ea
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
1 /*
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
2 * DMLib
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
3 * -- Vector and matrix functions
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
4 * Programmed and designed by Matti 'ccr' Hamalainen
863
27949209238b Update copyrights.
Matti Hamalainen <ccr@tnsp.org>
parents: 839
diff changeset
5 * (C) Copyright 2011-2015 Tecnic Software productions (TNSP)
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
6 */
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
7 #include "dmvecmat.h"
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
8
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
9
269
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
10 void dm_vector_add_n(DMVector *dst, const DMVector *src, const int nlist)
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
11 {
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
12 int i;
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
13 for (i = 0; i < nlist; i++)
283
4d42b8910d7e Using SSE inline asm is not worth it in single operations, it hinders
Matti Hamalainen <ccr@tnsp.org>
parents: 281
diff changeset
14 {
269
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
15 dm_vector_add(dst + i, src + i);
283
4d42b8910d7e Using SSE inline asm is not worth it in single operations, it hinders
Matti Hamalainen <ccr@tnsp.org>
parents: 281
diff changeset
16 }
269
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
17 }
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
18
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
19
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
20 void dm_vector_add_r_n(DMVector *dst, const DMVector *src1, const DMVector *src2, const int nlist)
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
21 {
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
22 int i;
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
23 for (i = 0; i < nlist; i++)
283
4d42b8910d7e Using SSE inline asm is not worth it in single operations, it hinders
Matti Hamalainen <ccr@tnsp.org>
parents: 281
diff changeset
24 {
269
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
25 dm_vector_add_r(dst + i, src1 + i, src2 + i);
283
4d42b8910d7e Using SSE inline asm is not worth it in single operations, it hinders
Matti Hamalainen <ccr@tnsp.org>
parents: 281
diff changeset
26 }
269
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
27 }
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
28
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
29
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
30 void dm_vector_sub_n(DMVector *dst, const DMVector *src, const int nlist)
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
31 {
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
32 int i;
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
33 for (i = 0; i < nlist; i++)
283
4d42b8910d7e Using SSE inline asm is not worth it in single operations, it hinders
Matti Hamalainen <ccr@tnsp.org>
parents: 281
diff changeset
34 {
269
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
35 dm_vector_add(dst + i, src + i);
283
4d42b8910d7e Using SSE inline asm is not worth it in single operations, it hinders
Matti Hamalainen <ccr@tnsp.org>
parents: 281
diff changeset
36 }
269
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
37 }
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
38
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
39
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
40 void dm_vector_sub_r_n(DMVector *dst, const DMVector *src1, const DMVector *src2, const int nlist)
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
41 {
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
42 int i;
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
43 for (i = 0; i < nlist; i++)
283
4d42b8910d7e Using SSE inline asm is not worth it in single operations, it hinders
Matti Hamalainen <ccr@tnsp.org>
parents: 281
diff changeset
44 {
269
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
45 dm_vector_sub_r(dst + i, src1 + i, src2 + i);
283
4d42b8910d7e Using SSE inline asm is not worth it in single operations, it hinders
Matti Hamalainen <ccr@tnsp.org>
parents: 281
diff changeset
46 }
269
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
47 }
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
48
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
49
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
50 /* Multiply given vector with a matrix
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
51 */
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
52 void dm_vector_mul_by_mat(DMVector *vd, const DMVector *vs, const DMMatrix *mat)
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
53 {
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
54 vd->x = (vs->x * mat->m[0][0]) + (vs->y * mat->m[1][0]) + (vs->z * mat->m[2][0]);
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
55 vd->y = (vs->x * mat->m[0][1]) + (vs->y * mat->m[1][1]) + (vs->z * mat->m[2][1]);
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
56 vd->z = (vs->x * mat->m[0][2]) + (vs->y * mat->m[1][2]) + (vs->z * mat->m[2][2]);
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
57 }
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
58
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
59
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
60 /* Multiply list of given vectors with given matrix.
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
61 */
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
62 void dm_vector_mul_by_mat_n(DMVector *list, const int nlist, const DMMatrix *mat)
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
63 {
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
64 int i;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
65
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
66 for (i = 0; i < nlist; i++)
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
67 {
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
68 DMVector q;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
69 memcpy(&q, &list[i], sizeof(DMVector));
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
70
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
71 list[i].x = (q.x * mat->m[0][0]) + (q.y * mat->m[1][0]) + (q.z * mat->m[2][0]);
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
72 list[i].y = (q.x * mat->m[0][1]) + (q.y * mat->m[1][1]) + (q.z * mat->m[2][1]);
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
73 list[i].z = (q.x * mat->m[0][2]) + (q.y * mat->m[1][2]) + (q.z * mat->m[2][2]);
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
74 }
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
75 }
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
76
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
77
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
78 /* Set matrix to unit-matrix
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
79 */
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
80 void dm_matrix_unit(DMMatrix *mat)
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
81 {
1167
848a88ce7a57 Use dmMemset().
Matti Hamalainen <ccr@tnsp.org>
parents: 1102
diff changeset
82 dmMemset(mat, 0, sizeof(DMMatrix));
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
83 mat->m[0][0] = 1.0f;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
84 mat->m[1][1] = 1.0f;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
85 mat->m[2][2] = 1.0f;
279
5acc1232c8c0 Set the last 1 of the unit matrix as they are now 4x4 instead of 3x3.
Matti Hamalainen <ccr@tnsp.org>
parents: 270
diff changeset
86 mat->m[3][3] = 1.0f;
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
87 }
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
88
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
89
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
90 /* Transpose the matrix mat2 to mat1
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
91 */
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
92 void dm_matrix_transpose(DMMatrix *mat1, const DMMatrix *mat2)
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
93 {
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
94 int i, j;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
95
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
96 for (i = 0; i < DM_MATRIX_SIZE; i++)
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
97 for (j = 0; j < DM_MATRIX_SIZE; j++)
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
98 mat1->m[i][j] = mat2->m[j][i];
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
99 }
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
100
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
101
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
102 /* Multiply matrices mat1 and mat2, putting result into mat1
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
103 */
269
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
104 void dm_matrix_mul_r(DMMatrix *dst, const DMMatrix *mat1, const DMMatrix *mat2)
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
105 {
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
106 int i, j;
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
107 for (i = 0; i < DM_MATRIX_SIZE; i++)
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
108 for (j = 0; j < DM_MATRIX_SIZE; j++)
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
109 dst->m[i][j] =
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
110 (mat1->m[i][0] * mat2->m[0][j]) +
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
111 (mat1->m[i][1] * mat2->m[1][j]) +
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
112 (mat1->m[i][2] * mat2->m[2][j]);
270
89a05a5e7a82 Add (untested) SSE asm version of matrix product (matrix x matrix multiplication).
Matti Hamalainen <ccr@tnsp.org>
parents: 269
diff changeset
113 }
89a05a5e7a82 Add (untested) SSE asm version of matrix product (matrix x matrix multiplication).
Matti Hamalainen <ccr@tnsp.org>
parents: 269
diff changeset
114
89a05a5e7a82 Add (untested) SSE asm version of matrix product (matrix x matrix multiplication).
Matti Hamalainen <ccr@tnsp.org>
parents: 269
diff changeset
115
89a05a5e7a82 Add (untested) SSE asm version of matrix product (matrix x matrix multiplication).
Matti Hamalainen <ccr@tnsp.org>
parents: 269
diff changeset
116 void dm_matrix_mul(DMMatrix *mat1, const DMMatrix *mat2)
89a05a5e7a82 Add (untested) SSE asm version of matrix product (matrix x matrix multiplication).
Matti Hamalainen <ccr@tnsp.org>
parents: 269
diff changeset
117 {
89a05a5e7a82 Add (untested) SSE asm version of matrix product (matrix x matrix multiplication).
Matti Hamalainen <ccr@tnsp.org>
parents: 269
diff changeset
118 DMMatrix tmpM;
89a05a5e7a82 Add (untested) SSE asm version of matrix product (matrix x matrix multiplication).
Matti Hamalainen <ccr@tnsp.org>
parents: 269
diff changeset
119 dm_matrix_mul_r(&tmpM, mat1, mat2);
89a05a5e7a82 Add (untested) SSE asm version of matrix product (matrix x matrix multiplication).
Matti Hamalainen <ccr@tnsp.org>
parents: 269
diff changeset
120 memcpy(mat1, &tmpM, sizeof(DMMatrix));
269
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
121 }
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
122
159264c27929 Add some new vector and matrix operations, and introduce some SSE inline
Matti Hamalainen <ccr@tnsp.org>
parents: 239
diff changeset
123
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
124 /* Multiply given list of matrices (size of nMatrices units) with given matrix.
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
125 */
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
126 void dm_matrix_mul_n(DMMatrix * list, const int nlist, const DMMatrix *mat)
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
127 {
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
128 int i;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
129 for (i = 0; i < nlist; i++)
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
130 dm_matrix_mul(&list[i], mat);
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
131 }
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
132
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
133
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
134 /* Optimized rotation matrix creation
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
135 */
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
136 void dm_matrix_rot(DMMatrix *mat,
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
137 const DMFloat sx, const DMFloat sy, const DMFloat sz,
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
138 const DMFloat cx, const DMFloat cy, const DMFloat cz)
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
139 {
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
140 const DMFloat
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
141 q = cx * sz,
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
142 l = cx * cz,
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
143 i = sx * sz,
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
144 j = sx * cz;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
145
1102
e06abfde6c39 Cosmetics pass: Remove excess whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
146 mat->m[0][3] =
e06abfde6c39 Cosmetics pass: Remove excess whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
147 mat->m[1][3] =
e06abfde6c39 Cosmetics pass: Remove excess whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
148 mat->m[2][3] =
e06abfde6c39 Cosmetics pass: Remove excess whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
149 mat->m[3][0] =
e06abfde6c39 Cosmetics pass: Remove excess whitespace.
Matti Hamalainen <ccr@tnsp.org>
parents: 863
diff changeset
150 mat->m[3][1] =
839
9fb3a6a39930 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 812
diff changeset
151 mat->m[3][2] = 0;
9fb3a6a39930 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 812
diff changeset
152
9fb3a6a39930 Cleanups.
Matti Hamalainen <ccr@tnsp.org>
parents: 812
diff changeset
153 mat->m[3][3] = 1.0f;
281
9ba4f25abbce Fix rotation matrix creation.
Matti Hamalainen <ccr@tnsp.org>
parents: 280
diff changeset
154
0
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
155 mat->m[0][0] = cy * cz;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
156 mat->m[0][1] = cy * sz;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
157 mat->m[0][2] = -sy;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
158
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
159 mat->m[1][0] = (sy * j) - q;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
160 mat->m[1][1] = (sy * i) + l;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
161 mat->m[1][2] = sx * cy;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
162
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
163
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
164 mat->m[2][0] = (sy * l) + i;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
165 mat->m[2][1] = (sy * q) - j;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
166 mat->m[2][2] = cx * cy;
32250b436bca Initial re-import.
Matti Hamalainen <ccr@tnsp.org>
parents:
diff changeset
167 }