-
Notifications
You must be signed in to change notification settings - Fork 0
/
DataStructs.hpp
85 lines (71 loc) · 1.99 KB
/
DataStructs.hpp
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
//
// Created by Carlo Ronconi on 27/06/23.
//
#ifndef DRONE_DELIVERY_DATASTRUCTS_HPP
#define DRONE_DELIVERY_DATASTRUCTS_HPP
// The uniform buffer objects data structures
// Remember to use the correct alignas(...) value
// float : alignas(4)
// vec2 : alignas(8)
// vec3 : alignas(16)
// vec4 : alignas(16)
// mat3 : alignas(16)
// mat4 : alignas(16)
struct MetallicUniformBlock {
alignas(4) float amb;
alignas(4) float gamma;
alignas(16) glm::vec3 sColor;
alignas(16) glm::mat4 mvpMat;
alignas(16) glm::mat4 mMat;
alignas(16) glm::mat4 nMat;
};
struct OpaqueUniformBlock {
alignas(4) float amb;
alignas(4) float sigma;
alignas(16) glm::mat4 mvpMat;
alignas(16) glm::mat4 mMat;
alignas(16) glm::mat4 nMat;
};
struct EmitUniformBlock {
alignas(4) float amb;
alignas(4) float sigma;
alignas(16) glm::mat4 mvpMat;
alignas(16) glm::mat4 mMat;
alignas(16) glm::mat4 nMat;
alignas(16) glm::vec3 offset;
alignas(4) float dim; // one of the 2 dimensions - other obtained by repeating the instances
};
struct OverlayUniformBlock {
alignas(4) float visible; // applies to all instances
alignas(16) glm::mat4 mvpMat;
alignas(8) glm::vec2 offset;
alignas(4) float instancesToDraw; // applies only if visible == 1
};
struct AnimationUniformBlock {
alignas(4) float visible;
alignas(16) glm::mat4 mvpMat;
alignas(16) glm::vec3 offset;
alignas(4) float time;
};
struct GlobalUniformBlock {
alignas(16) glm::vec3 DlightDir;
alignas(16) glm::vec3 DlightColor;
alignas(16) glm::vec3 AmbLightColor;
alignas(16) glm::vec3 eyePos;
alignas(4) float usePointLight;
};
// The vertices data structures
struct VertexClassic {
glm::vec3 pos;
glm::vec3 norm;
glm::vec2 UV;
};
struct VertexOverlay {
glm::vec2 pos;
glm::vec2 UV;
};
struct VertexAnimation {
glm::vec3 pos;
};
enum GameState {SPLASH, PLAYING, WON, LOST};
#endif //DRONE_DELIVERY_DATASTRUCTS_HPP