diff options
| author | Jonathan Bradley <jcb@pikum.xyz> | 2023-09-22 09:22:54 -0400 |
|---|---|---|
| committer | Jonathan Bradley <jcb@pikum.xyz> | 2023-09-25 12:54:43 -0400 |
| commit | 65043c16755a2121be38a307eb53eb94803c65ed (patch) | |
| tree | ebd6cb70c60a7edc81c2a8ac0091024c6d452488 /src/entities.cpp | |
| parent | 31dc984812e538f3db37d7d8816db0fa649f4f27 (diff) | |
entities - expose method to find EntityType by typeCode
Diffstat (limited to 'src/entities.cpp')
| -rw-r--r-- | src/entities.cpp | 40 |
1 files changed, 9 insertions, 31 deletions
diff --git a/src/entities.cpp b/src/entities.cpp index b4d0f4b..db3d0a3 100644 --- a/src/entities.cpp +++ b/src/entities.cpp @@ -16,37 +16,6 @@ struct ImplementedPipelines { } vkPipelines; void EntityType_Init() { - GlobalEntityTypes.Push( - EntityType { - .modelsDir = "assets/models", - .modelFile = "cube.gltf", - .entityTypeCode = "EntTypeCube", - .entityHandle = ECS_CreateEntity(), - .startingInstanceCount = 16, - .Importer_GLTF = { - .AccessorIndexVertex = 0, - .AccessorIndexNormal = 1, - .AccessorIndexUV = 2, - .AccessorIndexIndex = 3, - } - } - ); - GlobalEntityTypes.Push( - EntityType { - .modelsDir = "assets/models", - .modelFile = "plane.gltf", - .entityTypeCode = "EntTypePlane", - .entityHandle = ECS_CreateEntity(), - .startingInstanceCount = 16, - .Importer_GLTF = { - .AccessorIndexVertex = 0, - .AccessorIndexNormal = 1, - .AccessorIndexUV = 2, - .AccessorIndexIndex = 3, - } - } - ); - VkDescriptorSetLayoutBinding vkDescriptorSetLayoutBindings[2]; for (long i = 0; i < 2; ++i) { vkDescriptorSetLayoutBindings[i].pImmutableSamplers = nullptr; @@ -360,6 +329,15 @@ void EntityType_Init() { } } +int64_t EntityType_FindByTypeCode(const char *typeCode) { + for (int64_t i = 0; i < GlobalEntityTypes.Count(); ++i) { + if (strcmp(typeCode, GlobalEntityTypes[i].entityTypeCode) == 0) { + return i; + } + } + return -1; +} + void EntityType_Load(EntityType &et) { assert(et.startingInstanceCount > 0); if (et.modelFile != nullptr && et.modelFile != CAFE_BABE(char)) { |
