2 extern vec_t softwaretransform_rotatematrix[3][4];
3 extern vec_t softwaretransform_matrix[3][4];
4 extern vec_t softwaretransform_invmatrix[3][4];
5 extern int softwaretransform_complexity;
7 void softwaretransformidentity (void);
8 void softwaretransformset (vec3_t origin, vec3_t angles, vec_t scale);
9 void softwaretransformforentity (entity_render_t *r);
11 // #defines for speed reasons
12 #define softwaretransform(in, out)\
13 {\
14         if (softwaretransform_complexity == 0)\
15         {\
16                 VectorCopy(in, out);\
17         }\
18         else if (softwaretransform_complexity == 1)\
19         {\
20                 out[0] = in[0] + softwaretransform_matrix[0][3];\
21                 out[1] = in[1] + softwaretransform_matrix[1][3];\
22                 out[2] = in[2] + softwaretransform_matrix[2][3];\
23         }\
24         else\
25         {\
26                 out[0] = DotProduct(in, softwaretransform_matrix[0]) + softwaretransform_matrix[0][3];\
27                 out[1] = DotProduct(in, softwaretransform_matrix[1]) + softwaretransform_matrix[1][3];\
28                 out[2] = DotProduct(in, softwaretransform_matrix[2]) + softwaretransform_matrix[2][3];\
29         }\
30 }
32 #define softwaretransformdirection(in, out)\
33 {\
34         if (softwaretransform_complexity == 2)\
35         {\
36                 out[0] = DotProduct(in, softwaretransform_rotatematrix[0]);\
37                 out[1] = DotProduct(in, softwaretransform_rotatematrix[1]);\
38                 out[2] = DotProduct(in, softwaretransform_rotatematrix[2]);\
39         }\
40         else\
41                 VectorCopy(in, out);\
42 }
44 #define softwareuntransform(in, out)\
45 {\
46         if (softwaretransform_complexity == 0)\
47         {\
48                 VectorCopy(in, out);\
49         }\
50         else if (softwaretransform_complexity == 1)\
51         {\
52                 out[0] = in[0] - softwaretransform_invmatrix[0][3];\
53                 out[1] = in[1] - softwaretransform_invmatrix[1][3];\
54                 out[2] = in[2] - softwaretransform_invmatrix[2][3];\
55         }\
56         else\
57         {\
58                 vec3_t soft_v;\
59                 soft_v[0] = in[0] - softwaretransform_invmatrix[0][3];\
60                 soft_v[1] = in[1] - softwaretransform_invmatrix[1][3];\
61                 soft_v[2] = in[2] - softwaretransform_invmatrix[2][3];\
62                 out[0] = DotProduct(soft_v, softwaretransform_invmatrix[0]);\
63                 out[1] = DotProduct(soft_v, softwaretransform_invmatrix[1]);\
64                 out[2] = DotProduct(soft_v, softwaretransform_invmatrix[2]);\
65         }\
66 }