diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2023-10-02 19:51:10 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2023-10-02 19:51:10 -0400 |
| commit | 4899815c69894bba3eb1a6faa8ccbbc676751728 (patch) | |
| tree | e3d5895b35d060d193ec59ccdeaf65dfbad6e145 /src/components.hpp | |
| parent | 2bdee2ce549b1306cafb1d657624eeed4cf7225a (diff) | |
instancing now works as intended
Diffstat (limited to 'src/components.hpp')
| -rw-r--r-- | src/components.hpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/components.hpp b/src/components.hpp index 06477da..490e798 100644 --- a/src/components.hpp +++ b/src/components.hpp @@ -4,8 +4,7 @@ #include "macros.hpp" #include "dynamic-array.hpp" -#include <glm/vec2.hpp> -#include <glm/vec3.hpp> +#include <glm/gtc/quaternion.hpp> #include <vulkan/vulkan_core.h> const uint64_t ECS_UNSET_VAL = 0xFFFFFFFFFFFFFFFF; @@ -22,12 +21,6 @@ struct Entity { bool isMarkedForRemoval = false; }; -struct InstPos { - glm::vec3 pos; - glm::vec3 rot; - glm::vec3 scale; -}; - struct CompGrBinds { EntityHandle entHandle = EntityHandle_MAX; GrBindsHandle grBindsHandle = GrBindsHandle_MAX; @@ -53,9 +46,14 @@ struct CompGrBinds { VkBuffer instanceBuffer = VK_NULL_HANDLE; uint32_t instanceFirstBinding = 0; uint32_t instanceBindingCount = 0; + uint32_t instanceCounter = 0; VkDeviceSize instanceOffsets = 0; - DynArray<InstPos> instances{0}; - bool isInstanceBufferNeedingUpdated = false; +}; + +struct InstPos { + glm::vec3 pos; + glm::quat rot; + glm::vec3 scale; }; struct CompInstance { @@ -63,7 +61,8 @@ struct CompInstance { GrBindsHandle grBindsHandle = GrBindsHandle_MAX; InstanceHandle instanceHandle = InstanceHandle_MAX; uint64_t index = ECS_UNSET_VAL; - InstPos *ptr = nullptr; + InstPos instPos; + bool isNeedingUpdated = false; }; #endif /* PKE_COMPONENTS_HPP */ |
