Repository navigation
Expand file tree
/
Copy pathsize.cpp
More file actions
296 lines (253 loc) · 8.02 KB
/
Copy pathsize.cpp
File metadata and controls
296 lines (253 loc) · 8.02 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
#include <stdio.h>
#include <stdint.h>
//#pragma pack(1)
// enum Phase //: uint8_t
// {
// PHASE_BEGAN = 0,
// PHASE_MOVED = 1,
// PHASE_STATIONARY = 2,
// PHASE_ENDED = 3,
// PHASE_CANCELLED = 4,
// };
// struct Touch
// {
// /// Single-click, double, etc
// uint16_t m_TapCount;
// /// Current x
// int16_t m_X;
// /// Current y
// int16_t m_Y;
// /// Current x, in screen space
// int16_t m_ScreenX;
// /// Current y, in screen space
// int16_t m_ScreenY;
// /// Current dx
// int16_t m_DX;
// /// Current dy
// int16_t m_DY;
// /// Current dx, in screen space
// int16_t m_ScreenDX;
// /// Current dy, in screen space
// int16_t m_ScreenDY;
// /// Touch id
// int16_t m_Id;
// /// Begin, end, etc
// Phase m_Phase;
// };
// const static uint32_t MAX_GAMEPAD_AXIS_COUNT = 32;
// const static uint32_t MAX_GAMEPAD_BUTTON_COUNT = 32;
// const static uint32_t MAX_GAMEPAD_HAT_COUNT = 4;
// const static uint32_t MAX_TOUCH_COUNT = 11;
// const static uint32_t MAX_CHAR_COUNT = 256;
// struct GamepadPacket
// {
// float m_Axis[MAX_GAMEPAD_AXIS_COUNT];
// uint32_t m_Buttons[MAX_GAMEPAD_BUTTON_COUNT / 32 + 1];
// uint8_t m_Hat[MAX_GAMEPAD_HAT_COUNT];
// uint8_t m_GamepadDisconnected:1;
// uint8_t m_GamepadConnected:1;
// uint8_t :6;
// };
// struct Action
// {
// union {
// Touch m_Touch[MAX_TOUCH_COUNT];
// char m_Text[MAX_CHAR_COUNT];
// GamepadPacket m_GamepadPacket;
// };
// union {
// uintptr_t m_Gamepad;
// };
// float m_Value;
// float m_PrevValue;
// float m_RepeatTimer;
// float m_AccX;
// float m_AccY;
// float m_AccZ;
// int16_t m_X;
// int16_t m_Y;
// int16_t m_DX;
// int16_t m_DY;
// /// Text or touch count
// int16_t m_Count;
// uint16_t m_GamepadIndex;
// uint16_t m_UserID;
// uint16_t m_IsGamepad : 1;
// uint16_t m_GamepadUnknown : 1;
// uint16_t m_GamepadDisconnected : 1;
// uint16_t m_GamepadConnected : 1;
// uint16_t m_HasGamepadPacket : 1;
// uint16_t m_Pressed : 1;
// uint16_t m_Released : 1;
// uint16_t m_Repeated : 1;
// uint16_t m_PositionSet : 1;
// uint16_t m_AccelerationSet : 1;
// uint16_t m_HasText : 1;
// uint16_t m_Dirty : 1; // it's dirty and should report its value
// uint16_t : 4;
// };
// struct ActionOld
// {
// float m_Value;
// float m_PrevValue;
// float m_RepeatTimer;
// int16_t m_X;
// int16_t m_Y;
// int16_t m_DX;
// int16_t m_DY;
// float m_AccX;
// float m_AccY;
// float m_AccZ;
// union {
// Touch m_Touch[MAX_TOUCH_COUNT];
// char m_Text[MAX_CHAR_COUNT];
// };
// /// Text or touch count
// int16_t m_Count;
// uint16_t m_GamepadIndex;
// uint16_t m_UserID;
// GamepadPacket m_GamepadPacket;
// uint16_t m_IsGamepad : 1;
// uint16_t m_GamepadUnknown : 1;
// uint16_t m_GamepadDisconnected : 1;
// uint16_t m_GamepadConnected : 1;
// uint16_t m_HasGamepadPacket : 1;
// uint16_t m_Pressed : 1;
// uint16_t m_Released : 1;
// uint16_t m_Repeated : 1;
// uint16_t m_PositionSet : 1;
// uint16_t m_AccelerationSet : 1;
// uint16_t m_HasText : 1;
// uint16_t m_Dirty : 1; // it's dirty and should report its value
// uint16_t : 4;
// };
// struct GamepadGuid
// {
// uint16_t m_Bus;
// uint16_t m_CRC16;
// uint16_t m_Vendor;
// uint16_t m_Reserved0;
// uint16_t m_Product;
// uint16_t m_Reserved1;
// uint16_t m_Version;
// uint8_t m_DriverSignature;
// uint8_t m_DriverData;
// };
// struct InputAction
// {
// union {
// Touch m_Touch[MAX_TOUCH_COUNT];
// char m_Text[MAX_CHAR_COUNT]; /// Contains text input if m_HasText, and gamepad name if m_GamepadConnected
// GamepadPacket m_GamepadPacket;
// };
// union {
// GamepadGuid m_GamepadGuid;
// };
// /// Action id, hashed action name
// uint64_t m_ActionId;
// /// Value of the input [0,1]
// float m_Value;
// /// Cursor X coordinate, in virtual screen space
// float m_X;
// /// Cursor Y coordinate, in virtual screen space
// float m_Y;
// /// Cursor dx since last frame, in virtual screen space
// float m_DX;
// /// Cursor dy since last frame, in virtual screen space
// float m_DY;
// /// Cursor X coordinate, in screen space
// float m_ScreenX;
// /// Cursor Y coordinate, in screen space
// float m_ScreenY;
// /// Cursor dx since last frame, in screen space
// float m_ScreenDX;
// /// Cursor dy since last frame, in screen space
// float m_ScreenDY;
// /// Accelerometer x value (if present)
// float m_AccX;
// /// Accelerometer y value (if present)
// float m_AccY;
// /// Accelerometer z value (if present)
// float m_AccZ;
// /// Text or touch count
// int16_t m_Count;
// uint16_t m_GamepadIndex;
// uint16_t m_UserID;
// uint16_t m_IsGamepad : 1;
// uint16_t m_GamepadUnknown : 1;
// uint16_t m_GamepadDisconnected : 1;
// uint16_t m_GamepadConnected : 1;
// uint16_t m_HasGamepadPacket : 1;
// /// If input has a text payload (can be true even if text count is 0)
// uint16_t m_HasText : 1;
// /// If the input was 0 last update
// uint16_t m_Pressed : 1;
// /// If the input turned from above 0 to 0 this update
// uint16_t m_Released : 1;
// /// If the input was held enough for the value to be repeated this update
// uint16_t m_Repeated : 1;
// /// If the position fields (m_X, m_Y, m_DX, m_DY) were set and valid to read
// uint16_t m_PositionSet : 1;
// /// If the accelerometer fields (m_AccX, m_AccY, m_AccZ) were set and valid to read
// uint16_t m_AccelerationSet : 1;
// /// If the input action was consumed in an event dispatch
// uint16_t m_Consumed : 1;
// uint16_t : 4;
// };
// //#pragma pack(pop)
struct Point3
{
float x, y, z, w;
};
struct Vector3
{
float x, y, z, w;
};
struct LightInstance // 48
{
Point3 m_Position;
Vector3 m_Direction;
const void* m_LightPrototype;
float m_Scale;
uint16_t m_LightBufferIndex;
};
struct LightInstance_v2 // 40
{
const void* m_LightPrototype;
float m_Position[3];
float m_Direction[3];
float m_Scale;
uint16_t m_LightBufferIndex;
};
struct LightInstance_v3 // 26 bytes
{
float m_Position[3];
float m_Direction[3];
float m_Scale;
uint32_t m_LightPrototypeHandle;
uint16_t m_LightBufferIndex;
};
struct LightInstance_v4 // 8 bytes
{
uint32_t m_LightPrototypeHandle;
uint16_t m_LightBufferIndex;
};
struct LightInstance_v5 // 8 bytes
{
void* m_LightPrototypeHandle;
uint16_t m_LightBufferIndex;
};
int main(int argc, char const *argv[])
{
// printf("sizeof(Phase): %zu\n", sizeof(Phase));
// printf("sizeof(Touch): %zu\n", sizeof(Touch));
// printf("sizeof(GamepadPacket): %zu\n", sizeof(GamepadPacket));
// printf("sizeof(Action): %zu\n", sizeof(Action));
// printf("sizeof(InputAction): %zu\n", sizeof(InputAction));
printf("sizeof(LightInstance): %zu\n", sizeof(LightInstance));
printf("sizeof(LightInstance_v2): %zu\n", sizeof(LightInstance_v2));
printf("sizeof(LightInstance_v3): %zu\n", sizeof(LightInstance_v3));
printf("sizeof(LightInstance_v4): %zu\n", sizeof(LightInstance_v4));
printf("sizeof(LightInstance_v5): %zu\n", sizeof(LightInstance_v5));
return 0;
}