10#include "evan/EvanPlatform.hpp"
12#include "evan/DeviceContext.hpp"
14#include "evan/GPUVertex.hpp"
18#include <utility/math/aabb.hpp>
20#include <utility/logging/loggable.hpp>
21#include <utility/logging/default_logger.hpp>
42 protected utility::logging::Loggable<GPUMesh,
43 utility::logging::DefaultLogger>
75 GPUMesh(std::shared_ptr<DeviceContext> deviceContext,
76 std::vector<GPUVertex> vertices, std::vector<uint32_t> indices,
181 [[nodiscard]]
const utility::math::AabbF &
getBounds()
const;
247 std::vector<uint32_t> indices);
A class representing a mesh stored on the GPU, containing vertex and index buffers,...
void createIndexBuffer(std::shared_ptr< DeviceContext > deviceContext, std::vector< uint32_t > indices)
Creates the vertex buffer on the GPU using the provided device context and vertex data.
uint32_t getIndexCount() const
Retrieves the count of indices in the index buffer associated with this GPUMesh instance.
void destroy(VkDevice device)
Destroys the GPUMesh instance by cleaning up GPU resources associated with the vertex and index buffe...
VkBuffer getVertexBuffer() const
Retrieves the Vulkan vertex buffer associated with this GPUMesh instance.
VkDeviceMemory _vertexBufferMemory
utility::math::AabbF _bounds
size_t getVertexCount() const
Retrieves the number of vertices the vertex buffer was allocated for.
std::shared_ptr< DeviceContext > _deviceContext
VkDeviceMemory _indexBufferMemory
void updateVertices(const std::vector< GPUVertex > &vertices)
Updates the vertex data of the mesh in place.
void setTransform(const glm::mat4 &transform)
Sets the model transform of this mesh.
uint32_t getMaterialID() const
Retrieves the material ID associated with this GPUMesh instance.
const utility::math::AabbF & getBounds() const
Retrieves the axis-aligned bounding box of this mesh.
VkBuffer getIndexBuffer() const
Retrieves the Vulkan index buffer associated with this GPUMesh instance.
const glm::mat4 & getTransform() const
Retrieves the per-instance model transform of this mesh.
void cleanup()
Releases the vertex and index buffers owned by this mesh.
GPUMesh(std::shared_ptr< DeviceContext > deviceContext, std::vector< GPUVertex > vertices, std::vector< uint32_t > indices, uint32_t materialID)
Constructs a GPUMesh instance by creating vertex and index buffers on the GPU using the provided devi...