comparison VectorTypes.h @ 1512:af57b3b76fe4

Clean and decouple. (1)
author yoctozepto
date Mon, 02 Sep 2013 15:23:09 +0200
parents ff1867836af5
children 4055b09160ae
comparison
equal deleted inserted replaced
1511:948191fca433 1512:af57b3b76fe4
1 #pragma once 1 #pragma once
2
3 typedef unsigned __int32 uint;
4 2
5 #pragma pack(push, 1) 3 #pragma pack(push, 1)
6 struct Vec2_short_ 4 struct Vec2_short_
7 { 5 {
8 __int16 x; 6 __int16 x;
9 __int16 y; 7 __int16 y;
10 }; 8 };
11 #pragma pack(pop) 9 #pragma pack(pop)
12
13 #pragma pack(push, 1)
14 struct Vec3_float_
15 {
16 void Normalize();
17
18
19 //----- (0049B32D) --------------------------------------------------------
20 static Vec3_float_ *Vec3_float_::Cross(Vec3_float_ *v1, Vec3_float_ *pOut, float x, float y, float z)
21 {
22 pOut->x = z * v1->y - y * v1->z;
23 pOut->y = x * v1->z - z * v1->x;
24 pOut->z = y * v1->x - x * v1->y;
25 return pOut;
26 }
27
28 //----- (0049B02E) --------------------------------------------------------
29 inline static float NegDot(Vec3_float_ *a1, Vec3_float_ *a2, float *a3)
30 {
31 return *a3 = -(a1->z * a2->z + a1->y * a2->y + a1->x * a2->x);
32 }
33
34 float x;
35 float y;
36 float z;
37 };
38 #pragma pack(pop)
39
40 10
41 #pragma pack(push, 1) 11 #pragma pack(push, 1)
42 struct Vec2_int_ 12 struct Vec2_int_
43 { 13 {
44 int x; 14 int x;
52 float x; 22 float x;
53 float y; 23 float y;
54 }; 24 };
55 #pragma pack(pop) 25 #pragma pack(pop)
56 26
57
58 #pragma pack(push, 1) 27 #pragma pack(push, 1)
59 struct Vec3_short_ 28 struct Vec3_short_
60 { 29 {
61 __int16 x; 30 __int16 x;
62 __int16 y; 31 __int16 y;
65 #pragma pack(pop) 34 #pragma pack(pop)
66 35
67 #pragma pack(push, 1) 36 #pragma pack(push, 1)
68 struct Vec3_int_ 37 struct Vec3_int_
69 { 38 {
70 inline Vec3_int_(): 39 inline Vec3_int_(int a = 0, int b = 0, int c = 0):
71 x(0), y(0), z(0)
72 {}
73 inline Vec3_int_(int a, int b = 0, int c = 0):
74 x(a), y(b), z(c) 40 x(a), y(b), z(c)
75 {} 41 {}
76 42
77 void Normalize_float(); 43 void Normalize_float();
78 44
84 int z; 50 int z;
85 }; 51 };
86 #pragma pack(pop) 52 #pragma pack(pop)
87 53
88 #pragma pack(push, 1) 54 #pragma pack(push, 1)
55 struct Vec3_float_
56 {
57 void Normalize();
58
59 //----- (0049B32D) --------------------------------------------------------
60 static Vec3_float_ *Vec3_float_::Cross(Vec3_float_ *v1, Vec3_float_ *pOut, float x, float y, float z)
61 {
62 pOut->x = z * v1->y - y * v1->z;
63 pOut->y = x * v1->z - z * v1->x;
64 pOut->z = y * v1->x - x * v1->y;
65 return pOut;
66 }
67
68 //----- (0049B02E) --------------------------------------------------------
69 inline static float NegDot(Vec3_float_ *a1, Vec3_float_ *a2, float *a3)
70 {
71 return *a3 = -(a1->z * a2->z + a1->y * a2->y + a1->x * a2->x);
72 }
73
74 float x;
75 float y;
76 float z;
77 };
78 #pragma pack(pop)
79
80 #pragma pack(push, 1)
89 struct Vec4_int_ 81 struct Vec4_int_
90 { 82 {
91 int x; 83 int x;
92 int y; 84 int y;
93 int z; 85 int z;
94 int w; 86 int w;
95 }; 87 };
96 #pragma pack(pop) 88 #pragma pack(pop)
97 89
98
99
100
101
102
103 /* 82 */ 90 /* 82 */
104 #pragma pack(push, 1) 91 #pragma pack(push, 1)
105 struct Plane_int_ 92 struct Plane_int_
106 { 93 {
107 Vec3_int_ vNormal; 94 Vec3_int_ vNormal;
108 int dist; 95 int dist;
109 }; 96 };
110 #pragma pack(pop) 97 #pragma pack(pop)
111
112 98
113 #pragma pack(push, 1) 99 #pragma pack(push, 1)
114 struct BBox_short_ 100 struct BBox_short_
115 { 101 {
116 __int16 x1; 102 __int16 x1;
140 struct Vec3_float_ vNormal; 126 struct Vec3_float_ vNormal;
141 float dist; 127 float dist;
142 }; 128 };
143 #pragma pack(pop) 129 #pragma pack(pop)
144 130
145
146
147
148 /* 196 */ 131 /* 196 */
149 #pragma pack(push, 1) 132 #pragma pack(push, 1)
150 struct Matrix3x3_float_ 133 struct Matrix3x3_float_
151 { 134 {
152 union 135 union
159 }; 142 };
160 float v[3][3]; 143 float v[3][3];
161 }; 144 };
162 }; 145 };
163 #pragma pack(pop) 146 #pragma pack(pop)
164