Crimson Engine
1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
Toggle main menu visibility
Loading...
Searching...
No Matches
MeshSoA.hpp
Go to the documentation of this file.
1
#pragma once
2
#include <vector>
3
#include "
../ecs/components/Mesh.hpp
"
4
#include "
core/VulkanBuffer.hpp
"
5
10
struct
MeshSoA
{
12
std::vector<uint32_t>
ids
;
14
std::vector<std::vector<Vertex>>
vertices
;
16
std::vector<std::vector<uint32_t>>
indices
;
17
19
std::vector<VulkanBuffer>
vertexBuffers
;
21
std::vector<VulkanBuffer>
indexBuffers
;
22
29
size_t
push
(
const
std::vector<Vertex>& verts,
const
std::vector<uint32_t>& inds) {
30
ids
.push_back(
ids
.size());
31
vertices
.push_back(verts);
32
indices
.push_back(inds);
33
34
vertexBuffers
.emplace_back();
// placeholder VulkanBuffer
35
indexBuffers
.emplace_back();
36
37
return
ids
.size() - 1;
38
}
39
43
void
clear
() {
44
for
(
auto
& vb :
vertexBuffers
) {
45
vb.destroy();
46
}
47
for
(
auto
& ib :
indexBuffers
) {
48
ib.destroy();
49
}
50
vertexBuffers
.clear();
51
indexBuffers
.clear();
52
ids
.clear();
53
vertices
.clear();
54
indices
.clear();
55
}
56
};
Mesh.hpp
VulkanBuffer.hpp
MeshSoA
Structure of Arrays representing mesh buffers and geometry information.
Definition
MeshSoA.hpp:10
MeshSoA::clear
void clear()
Safely destroys and clears all allocated Vulkan buffers.
Definition
MeshSoA.hpp:43
MeshSoA::ids
std::vector< uint32_t > ids
Unique mesh IDs.
Definition
MeshSoA.hpp:12
MeshSoA::vertices
std::vector< std::vector< Vertex > > vertices
Arrays of vertices for each mesh.
Definition
MeshSoA.hpp:14
MeshSoA::indices
std::vector< std::vector< uint32_t > > indices
Arrays of indices for each mesh.
Definition
MeshSoA.hpp:16
MeshSoA::vertexBuffers
std::vector< VulkanBuffer > vertexBuffers
Allocated Vulkan vertex buffers.
Definition
MeshSoA.hpp:19
MeshSoA::indexBuffers
std::vector< VulkanBuffer > indexBuffers
Allocated Vulkan index buffers.
Definition
MeshSoA.hpp:21
MeshSoA::push
size_t push(const std::vector< Vertex > &verts, const std::vector< uint32_t > &inds)
Pushes a new mesh geometry configuration.
Definition
MeshSoA.hpp:29
engine
include
soa
MeshSoA.hpp
Generated by
1.17.0