annotate VectorTypes.h @ 208:af624eaf2fc5 tip

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