summaryrefslogtreecommitdiff
path: root/src/entities.cpp
diff options
context:
space:
mode:
authorJonathan Bradley <jcb@pikum.xyz>2023-09-21 19:55:21 -0400
committerJonathan Bradley <jcb@pikum.xyz>2023-09-25 06:51:45 -0400
commitf04604a9784be6c32a7f8f42b9633872a03ce897 (patch)
tree873c88c2e0bbc85206aa45d8aab6b5f1d4b8744e /src/entities.cpp
parent37dd0adf200d21924d69fd3ee7f084916087ac1c (diff)
save current scene state
Diffstat (limited to 'src/entities.cpp')
-rw-r--r--src/entities.cpp60
1 files changed, 9 insertions, 51 deletions
diff --git a/src/entities.cpp b/src/entities.cpp
index 0c7003c..b4d0f4b 100644
--- a/src/entities.cpp
+++ b/src/entities.cpp
@@ -1,7 +1,7 @@
#include "entities.hpp"
-DynArray<EntityType> globalEntityTypes{16};
+DynArray<EntityType> GlobalEntityTypes{16};
VkDescriptorSetLayout vkDescriptorSetLayout_Texture = VK_NULL_HANDLE;
VkPipelineLayout vkPipelineLayout_Texture = VK_NULL_HANDLE;
VkSampler vkSampler_Texture = VK_NULL_HANDLE;
@@ -15,50 +15,8 @@ struct ImplementedPipelines {
};
} vkPipelines;
-VkPipelineLayoutCreateInfo sharedVkPipelineLayoutCreateInfo {
- .sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO,
- .pNext = nullptr,
- .flags = 0,
- .setLayoutCount = 0,
- .pSetLayouts = nullptr,
- .pushConstantRangeCount = 0,
- .pPushConstantRanges = nullptr,
-};
-
-VkWriteDescriptorSet uboDescriptor {
- .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
- .pNext = nullptr,
- .dstSet = nullptr,
- .dstBinding = 0,
- .dstArrayElement = 0,
- .descriptorCount = 1,
- .descriptorType = VK_DESCRIPTOR_TYPE_UNIFORM_BUFFER,
- .pImageInfo = nullptr,
- .pBufferInfo = nullptr,
- .pTexelBufferView = nullptr,
-};
-
-VkDescriptorImageInfo textureDescriptorInfo {
- .sampler = nullptr,
- .imageView = nullptr,
- .imageLayout = VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
-};
-
-VkWriteDescriptorSet samplerDescriptor {
- .sType = VK_STRUCTURE_TYPE_WRITE_DESCRIPTOR_SET,
- .pNext = nullptr,
- .dstSet = nullptr,
- .dstBinding = 1,
- .dstArrayElement = 0,
- .descriptorCount = 1,
- .descriptorType = VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER,
- .pImageInfo = &textureDescriptorInfo,
- .pBufferInfo = nullptr,
- .pTexelBufferView = nullptr,
-};
-
void EntityType_Init() {
- globalEntityTypes.Push(
+ GlobalEntityTypes.Push(
EntityType {
.modelsDir = "assets/models",
.modelFile = "cube.gltf",
@@ -73,7 +31,7 @@ void EntityType_Init() {
}
}
);
- globalEntityTypes.Push(
+ GlobalEntityTypes.Push(
EntityType {
.modelsDir = "assets/models",
.modelFile = "plane.gltf",
@@ -396,9 +354,9 @@ void EntityType_Init() {
AM_Destroy(vertShaderAssetHandle);
}
- long entityTypeCount = globalEntityTypes.Count();
+ long entityTypeCount = GlobalEntityTypes.Count();
for (long i = 0; i < entityTypeCount; ++i) {
- EntityType_Load(globalEntityTypes[i]);
+ EntityType_Load(GlobalEntityTypes[i]);
}
}
@@ -877,11 +835,11 @@ void EntityType_Load(EntityType &et) {
}
void EntityType_Teardown() {
- long entityTypeCount = globalEntityTypes.Count();
+ long entityTypeCount = GlobalEntityTypes.Count();
for (long i = 0; i < entityTypeCount; ++i) {
- if (globalEntityTypes[i].modelFile == nullptr) continue;
- auto *et = &globalEntityTypes[i];
- auto *grBinds = ECS_GetGrBinds(globalEntityTypes[i].entityHandle);
+ if (GlobalEntityTypes[i].modelFile == nullptr) continue;
+ auto *et = &GlobalEntityTypes[i];
+ auto *grBinds = ECS_GetGrBinds(GlobalEntityTypes[i].entityHandle);
if (grBinds->vertexBuffer != VK_NULL_HANDLE)
vkDestroyBuffer(vkDevice, grBinds->vertexBuffer, vkAllocator);
if (grBinds->normalsBuffer != VK_NULL_HANDLE)