annotate VectorTypes.h @ 1270:2e4a07ad5243

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