summaryrefslogtreecommitdiff
path: root/src/components.hpp
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2023-09-05 12:10:04 -0400
committerJonathan Bradley <jcb@pikum.xyz>2023-09-06 17:24:27 -0400
commit3c55528b3e0e6e52e416535d9884254a0f21d07e (patch)
tree4457601a42c2ee7ac4c40818061648bc5c350705 /src/components.hpp
parent08ff9cd0e2b754caf60aaceedf670b9e6b61d664 (diff)
instancing checkpoint
Diffstat (limited to 'src/components.hpp')
-rw-r--r--src/components.hpp35
1 files changed, 32 insertions, 3 deletions
diff --git a/src/components.hpp b/src/components.hpp
index f0a46a9..8f0d3a5 100644
--- a/src/components.hpp
+++ b/src/components.hpp
@@ -1,36 +1,65 @@
#ifndef PKE_COMPONENTS_HPP
#define PKE_COMPONENTS_HPP
-#include"macros.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, UINT64_MAX);
TypeSafeInt_H(GrBindsHandle, uint64_t, UINT64_MAX);
+TypeSafeInt_H(InstanceHandle, uint64_t, UINT64_MAX);
struct Entity {
EntityHandle handle = EntityHandle{EntityHandle_T{ECS_UNSET_VAL}};
EntityHandle parentHandle = EntityHandle{EntityHandle_T{ECS_UNSET_VAL}};
- bool isMarkedForRemoval = false;
GrBindsHandle grBindsHandle = GrBindsHandle{GrBindsHandle_T{ECS_UNSET_VAL}};
+ InstanceHandle instanceHandle = InstanceHandle{InstanceHandle_T{ECS_UNSET_VAL}};
+ bool isMarkedForRemoval = false;
};
-struct GrBindsComp {
+struct Vert {
+ glm::vec3 pos;
+ glm::vec2 tex;
+};
+
+struct InstPos {
+ glm::vec3 pos;
+ glm::vec3 rot;
+ glm::vec3 scale;
+};
+
+struct CompGrBinds {
+ GrBindsHandle grBindsHandle = GrBindsHandle{GrBindsHandle_T{ECS_UNSET_VAL}};
+ 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{GrBindsHandle_T{ECS_UNSET_VAL}};
+ InstanceHandle instanceHandle = InstanceHandle{InstanceHandle_T{ECS_UNSET_VAL}};
+ uint64_t index = ECS_UNSET_VAL;
+ InstPos *ptr = nullptr;
+};
+
#endif /* PKE_COMPONENTS_HPP */