blob: 7f3c0bb8f4fc3c8fd88b55450f5b5b198306ef3a (
plain)
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
|
#ifndef PKE_COMPONENTS_HPP
#define PKE_COMPONENTS_HPP
#include "macros.hpp"
#include "dynamic-array.hpp"
#include <glm/vec2.hpp>
#include <glm/vec3.hpp>
#include <vulkan/vulkan_core.h>
const uint64_t ECS_UNSET_VAL = 0xFFFFFFFFFFFFFFFF;
TypeSafeInt_H(EntityHandle, uint64_t, ECS_UNSET_VAL);
TypeSafeInt_H(GrBindsHandle, uint64_t, ECS_UNSET_VAL);
TypeSafeInt_H(InstanceHandle, uint64_t, ECS_UNSET_VAL);
struct Entity {
EntityHandle handle = EntityHandle_MAX;
EntityHandle parentHandle = EntityHandle_MAX;
GrBindsHandle grBindsHandle = GrBindsHandle_MAX;
InstanceHandle instanceHandle = InstanceHandle_MAX;
bool isMarkedForRemoval = false;
};
struct Vert {
glm::vec3 pos;
glm::vec2 tex;
};
struct InstPos {
glm::vec3 pos;
glm::vec3 rot;
glm::vec3 scale;
};
struct CompGrBinds {
GrBindsHandle grBindsHandle = GrBindsHandle_MAX;
VkDeviceMemory deviceMemory = VK_NULL_HANDLE;
VkBuffer vertexBuffer = VK_NULL_HANDLE;
uint32_t vertexFirstBinding = 0;
uint32_t vertexCount = 0;
VkDeviceSize vertexOffsets = 0;
DynArray<Vert> vertexes{0};
VkBuffer indexBuffer = VK_NULL_HANDLE;
uint32_t indexFirstBinding = 0;
uint32_t indexCount = 0;
VkDeviceSize indexOffsets = 0;
DynArray<uint16_t> indexes{0};
VkBuffer instanceBuffer = VK_NULL_HANDLE;
uint32_t instanceFirstBinding = 0;
uint32_t instanceCount = 0;
VkDeviceSize instanceOffsets = 0;
DynArray<InstPos> instances{0};
VkPipelineLayout vkPipelineLayout = VK_NULL_HANDLE;
VkDescriptorSet vkDescriptorSet = VK_NULL_HANDLE;
};
struct CompInstance {
GrBindsHandle grBindsHandle = GrBindsHandle_MAX;
InstanceHandle instanceHandle = InstanceHandle_MAX;
uint64_t index = ECS_UNSET_VAL;
InstPos *ptr = nullptr;
};
#endif /* PKE_COMPONENTS_HPP */
|