annotate VectorTypes.h @ 492:0e27362ac1d9

guild
author Gloval
date Thu, 28 Feb 2013 01:38:46 +0400
parents 9c0607679772
children 8b492d4722d4
rev   line source
0
Ritor1
parents:
diff changeset
1 #pragma once
Ritor1
parents:
diff changeset
2
Ritor1
parents:
diff changeset
3 typedef unsigned __int32 uint;
Ritor1
parents:
diff changeset
4
Ritor1
parents:
diff changeset
5 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
6 struct Vec2_short_
Ritor1
parents:
diff changeset
7 {
Ritor1
parents:
diff changeset
8 __int16 x;
Ritor1
parents:
diff changeset
9 __int16 y;
Ritor1
parents:
diff changeset
10 };
Ritor1
parents:
diff changeset
11 #pragma pack(pop)
Ritor1
parents:
diff changeset
12
Ritor1
parents:
diff changeset
13 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
14 struct Vec3_float_
Ritor1
parents:
diff changeset
15 {
Ritor1
parents:
diff changeset
16 void Normalize();
Ritor1
parents:
diff changeset
17
Ritor1
parents:
diff changeset
18
Ritor1
parents:
diff changeset
19 //----- (0049B32D) --------------------------------------------------------
Ritor1
parents:
diff changeset
20 static Vec3_float_ *Vec3_float_::Cross(Vec3_float_ *v1, Vec3_float_ *pOut, float x, float y, float z)
Ritor1
parents:
diff changeset
21 {
Ritor1
parents:
diff changeset
22 double v6; // st7@1
Ritor1
parents:
diff changeset
23 double v7; // st6@1
Ritor1
parents:
diff changeset
24
Ritor1
parents:
diff changeset
25 v6 = x * v1->z - z * v1->x;
Ritor1
parents:
diff changeset
26 v7 = y * v1->x - x * v1->y;
Ritor1
parents:
diff changeset
27 pOut->x = z * v1->y - y * v1->z;
Ritor1
parents:
diff changeset
28 pOut->y = v6;
Ritor1
parents:
diff changeset
29 pOut->z = v7;
Ritor1
parents:
diff changeset
30 return pOut;
Ritor1
parents:
diff changeset
31 }
Ritor1
parents:
diff changeset
32
Ritor1
parents:
diff changeset
33 //----- (0049B02E) --------------------------------------------------------
Ritor1
parents:
diff changeset
34 inline static float NegDot(Vec3_float_ *a1, Vec3_float_ *a2, float *a3)
Ritor1
parents:
diff changeset
35 {
Ritor1
parents:
diff changeset
36 return *a3 = -(a1->z * a2->z + a1->y * a2->y + a1->x * a2->x);
Ritor1
parents:
diff changeset
37 }
Ritor1
parents:
diff changeset
38
Ritor1
parents:
diff changeset
39 float x;
Ritor1
parents:
diff changeset
40 float y;
Ritor1
parents:
diff changeset
41 float z;
Ritor1
parents:
diff changeset
42 };
Ritor1
parents:
diff changeset
43 #pragma pack(pop)
Ritor1
parents:
diff changeset
44
Ritor1
parents:
diff changeset
45
Ritor1
parents:
diff changeset
46 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
47 struct Vec2_int_
Ritor1
parents:
diff changeset
48 {
Ritor1
parents:
diff changeset
49 int x;
Ritor1
parents:
diff changeset
50 int y;
Ritor1
parents:
diff changeset
51 };
Ritor1
parents:
diff changeset
52 #pragma pack(pop)
Ritor1
parents:
diff changeset
53
Ritor1
parents:
diff changeset
54 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
55 struct Vec2_float_
Ritor1
parents:
diff changeset
56 {
Ritor1
parents:
diff changeset
57 float x;
Ritor1
parents:
diff changeset
58 float y;
Ritor1
parents:
diff changeset
59 };
Ritor1
parents:
diff changeset
60 #pragma pack(pop)
Ritor1
parents:
diff changeset
61
Ritor1
parents:
diff changeset
62
Ritor1
parents:
diff changeset
63 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
64 struct Vec3_short_
Ritor1
parents:
diff changeset
65 {
Ritor1
parents:
diff changeset
66 __int16 x;
Ritor1
parents:
diff changeset
67 __int16 y;
Ritor1
parents:
diff changeset
68 __int16 z;
Ritor1
parents:
diff changeset
69 };
Ritor1
parents:
diff changeset
70 #pragma pack(pop)
Ritor1
parents:
diff changeset
71
Ritor1
parents:
diff changeset
72 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
73 struct Vec3_int_
Ritor1
parents:
diff changeset
74 {
Ritor1
parents:
diff changeset
75 inline Vec3_int_():
Ritor1
parents:
diff changeset
76 x(0), y(0), z(0)
Ritor1
parents:
diff changeset
77 {}
Ritor1
parents:
diff changeset
78 inline Vec3_int_(int a, int b = 0, int c = 0):
Ritor1
parents:
diff changeset
79 x(a), y(b), z(c)
Ritor1
parents:
diff changeset
80 {}
Ritor1
parents:
diff changeset
81
Ritor1
parents:
diff changeset
82 void Normalize_float();
Ritor1
parents:
diff changeset
83
Ritor1
parents:
diff changeset
84 static void __fastcall Rotate(int sDepth, int sRotY, int sRotX, Vec3_int_ v, int *outx, int *outy, int *outz);
Ritor1
parents:
diff changeset
85 static void Normalize(int *x, int *y, int *z);
Ritor1
parents:
diff changeset
86
Ritor1
parents:
diff changeset
87 int x;
Ritor1
parents:
diff changeset
88 int y;
Ritor1
parents:
diff changeset
89 int z;
Ritor1
parents:
diff changeset
90 };
Ritor1
parents:
diff changeset
91 #pragma pack(pop)
Ritor1
parents:
diff changeset
92
Ritor1
parents:
diff changeset
93 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
94 struct Vec4_int_
Ritor1
parents:
diff changeset
95 {
Ritor1
parents:
diff changeset
96 int x;
Ritor1
parents:
diff changeset
97 int y;
Ritor1
parents:
diff changeset
98 int z;
Ritor1
parents:
diff changeset
99 int w;
Ritor1
parents:
diff changeset
100 };
Ritor1
parents:
diff changeset
101 #pragma pack(pop)
Ritor1
parents:
diff changeset
102
Ritor1
parents:
diff changeset
103
Ritor1
parents:
diff changeset
104
Ritor1
parents:
diff changeset
105
Ritor1
parents:
diff changeset
106
Ritor1
parents:
diff changeset
107
Ritor1
parents:
diff changeset
108 /* 82 */
Ritor1
parents:
diff changeset
109 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
110 struct Plane_int_
Ritor1
parents:
diff changeset
111 {
Ritor1
parents:
diff changeset
112 Vec3_int_ vNormal;
Ritor1
parents:
diff changeset
113 int dist;
Ritor1
parents:
diff changeset
114 };
Ritor1
parents:
diff changeset
115 #pragma pack(pop)
Ritor1
parents:
diff changeset
116
Ritor1
parents:
diff changeset
117
Ritor1
parents:
diff changeset
118 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
119 struct BBox_short_
Ritor1
parents:
diff changeset
120 {
Ritor1
parents:
diff changeset
121 __int16 x1;
Ritor1
parents:
diff changeset
122 __int16 x2;
Ritor1
parents:
diff changeset
123 __int16 y1;
Ritor1
parents:
diff changeset
124 __int16 y2;
Ritor1
parents:
diff changeset
125 __int16 z1;
Ritor1
parents:
diff changeset
126 __int16 z2;
Ritor1
parents:
diff changeset
127 };
Ritor1
parents:
diff changeset
128 #pragma pack(pop)
Ritor1
parents:
diff changeset
129
Ritor1
parents:
diff changeset
130 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
131 struct BBox_int_
Ritor1
parents:
diff changeset
132 {
Ritor1
parents:
diff changeset
133 int x1;
Ritor1
parents:
diff changeset
134 int x2;
Ritor1
parents:
diff changeset
135 int y1;
Ritor1
parents:
diff changeset
136 int y2;
Ritor1
parents:
diff changeset
137 int z1;
Ritor1
parents:
diff changeset
138 int z2;
Ritor1
parents:
diff changeset
139 };
Ritor1
parents:
diff changeset
140 #pragma pack(pop)
Ritor1
parents:
diff changeset
141
Ritor1
parents:
diff changeset
142 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
143 struct Plane_float_
Ritor1
parents:
diff changeset
144 {
Ritor1
parents:
diff changeset
145 struct Vec3_float_ vNormal;
Ritor1
parents:
diff changeset
146 float dist;
Ritor1
parents:
diff changeset
147 };
Ritor1
parents:
diff changeset
148 #pragma pack(pop)
Ritor1
parents:
diff changeset
149
Ritor1
parents:
diff changeset
150
Ritor1
parents:
diff changeset
151
Ritor1
parents:
diff changeset
152
Ritor1
parents:
diff changeset
153 /* 196 */
Ritor1
parents:
diff changeset
154 #pragma pack(push, 1)
Ritor1
parents:
diff changeset
155 struct Matrix3x3_float_
Ritor1
parents:
diff changeset
156 {
Ritor1
parents:
diff changeset
157 union
Ritor1
parents:
diff changeset
158 {
Ritor1
parents:
diff changeset
159 struct
Ritor1
parents:
diff changeset
160 {
Ritor1
parents:
diff changeset
161 float _11; float _12; float _13;
Ritor1
parents:
diff changeset
162 float _21; float _22; float _23;
Ritor1
parents:
diff changeset
163 float _31; float _32; float _33;
Ritor1
parents:
diff changeset
164 };
Ritor1
parents:
diff changeset
165 float v[3][3];
Ritor1
parents:
diff changeset
166 };
Ritor1
parents:
diff changeset
167 };
Ritor1
parents:
diff changeset
168 #pragma pack(pop)
Ritor1
parents:
diff changeset
169