The Joe Engine
Joe's engine programming playground
JoeEngine::JEMeshBufferManager Class Reference

The JEMeshBufferManager. More...

#include <MeshBufferManager.h>

Public Member Functions

 JEMeshBufferManager ()
 
 ~JEMeshBufferManager ()=default
 Destructor (default). More...
 
void Initialize (VkPhysicalDevice physicalDevice, VkDevice device, VkCommandPool commandPool, const JEVulkanQueue &graphicsQueue)
 Initialization. More...
 
void Cleanup ()
 Cleanup all Vulkan objects and memory. More...
 
void ExpandMemberLists ()
 Preps member lists for new data. More...
 
MeshComponent CreateMeshComponent (const std::string &filepath)
 Create a new Mesh Component. More...
 
MeshComponent CreateMeshComponent (const std::vector< JEMeshVertex > &vertices, const std::vector< uint32_t > &indices)
 Create a new Mesh Component from existing vertex and index lists. More...
 
MeshComponent CreateMeshComponent (const std::vector< JEMeshPointVertex > &vertices, const std::vector< uint32_t > &indices)
 Create a new Mesh Component from existing vertex and index lists. More...
 
void UpdateMeshBuffer (uint32_t bufferId, const std::vector< JEMeshVertex > &vertices, const std::vector< uint32_t > &indices)
 Update a mesh buffer to a new list of vertices and indices. More...
 
void UpdateMeshBuffer (uint32_t bufferId, const std::vector< JEMeshPointVertex > &vertices, const std::vector< uint32_t > &indices)
 Update a mesh buffer to a new list of vertices and indices. More...
 
const VkBuffer & GetVertexBufferAt (int index) const
 Get vertex buffer at index. More...
 
const VkBuffer & GetIndexBufferAt (int index) const
 Get index buffer at index. More...
 
const std::vector< uint32_t > & GetIndexListAt (int index) const
 Get index list at index. More...
 
const std::vector< BoundingBoxData > & GetBoundingBoxData () const
 Get all bounding box data. More...
 
const JESingleMeshGetScreenSpaceTriMesh () const
 Get the single-instance screen-space triangle mesh struct data. More...
 
const JESingleMeshGetBoundingBoxMesh () const
 Get the single-instance bounding box mesh struct data. More...
 

Detailed Description

The JEMeshBufferManager.

Class that manages all mesh buffer data, from loading to access. Provides convenience functions such as creating Mesh Components (for usage with the Joe Engine's entity-component system) and updating mesh buffers.

Constructor & Destructor Documentation

◆ JEMeshBufferManager()

JoeEngine::JEMeshBufferManager::JEMeshBufferManager ( )
inline

Default constructor. Initializes member variables and reserve data for each member list.

◆ ~JEMeshBufferManager()

JoeEngine::JEMeshBufferManager::~JEMeshBufferManager ( )
default

Destructor (default).

Member Function Documentation

◆ Cleanup()

void JoeEngine::JEMeshBufferManager::Cleanup ( )

Cleanup all Vulkan objects and memory.

◆ CreateMeshComponent() [1/3]

MeshComponent JoeEngine::JEMeshBufferManager::CreateMeshComponent ( const std::string &  filepath)

Create a new Mesh Component.

Parameters
filepaththe mesh file source path.
Returns
a new Mesh Component.

◆ CreateMeshComponent() [2/3]

MeshComponent JoeEngine::JEMeshBufferManager::CreateMeshComponent ( const std::vector< JEMeshPointVertex > &  vertices,
const std::vector< uint32_t > &  indices 
)

Create a new Mesh Component from existing vertex and index lists.

Parameters
verticesthe existing list of point mesh vertices.
indicesthe existing list of mesh indices.

◆ CreateMeshComponent() [3/3]

MeshComponent JoeEngine::JEMeshBufferManager::CreateMeshComponent ( const std::vector< JEMeshVertex > &  vertices,
const std::vector< uint32_t > &  indices 
)

Create a new Mesh Component from existing vertex and index lists.

Parameters
verticesthe existing list of triangle mesh vertices.
indicesthe existing list of mesh indices.

◆ ExpandMemberLists()

void JoeEngine::JEMeshBufferManager::ExpandMemberLists ( )

Preps member lists for new data.

◆ GetBoundingBoxData()

const std::vector<BoundingBoxData>& JoeEngine::JEMeshBufferManager::GetBoundingBoxData ( ) const
inline

Get all bounding box data.

Returns the member list of all bounding box data.

Returns
const-reference to the list of all bounding box data.

◆ GetBoundingBoxMesh()

const JESingleMesh& JoeEngine::JEMeshBufferManager::GetBoundingBoxMesh ( ) const
inline

Get the single-instance bounding box mesh struct data.

◆ GetIndexBufferAt()

const VkBuffer& JoeEngine::JEMeshBufferManager::GetIndexBufferAt ( int  index) const
inline

Get index buffer at index.

Returns the index buffer corresponding to the given index / mesh buffer ID.

Parameters
indexthe mesh ID whose index buffer to return.
Returns
the index buffer corresponding to the index.

◆ GetIndexListAt()

const std::vector<uint32_t>& JoeEngine::JEMeshBufferManager::GetIndexListAt ( int  index) const
inline

Get index list at index.

Returns the index list corresponding to the given index / mesh buffer ID.

Parameters
indexthe mesh ID whose index list to return.
Returns
the index list corresponding to the index.

◆ GetScreenSpaceTriMesh()

const JESingleMesh& JoeEngine::JEMeshBufferManager::GetScreenSpaceTriMesh ( ) const
inline

Get the single-instance screen-space triangle mesh struct data.

◆ GetVertexBufferAt()

const VkBuffer& JoeEngine::JEMeshBufferManager::GetVertexBufferAt ( int  index) const
inline

Get vertex buffer at index.

Returns the vertex buffer corresponding to the given index / mesh buffer ID.

Parameters
indexthe mesh ID whose vertex buffer to return.
Returns
the vertex buffer corresponding to the index.

◆ Initialize()

void JoeEngine::JEMeshBufferManager::Initialize ( VkPhysicalDevice  physicalDevice,
VkDevice  device,
VkCommandPool  commandPool,
const JEVulkanQueue graphicsQueue 
)

Initialization.

Parameters
physicalDevicethe Vulkan physical device.
devicethe Vulkan logical device.
commandPoolthe Vulkan command pool.
graphicsQueuethe Vulkan graphics queue.

◆ UpdateMeshBuffer() [1/2]

void JoeEngine::JEMeshBufferManager::UpdateMeshBuffer ( uint32_t  bufferId,
const std::vector< JEMeshPointVertex > &  vertices,
const std::vector< uint32_t > &  indices 
)

Update a mesh buffer to a new list of vertices and indices.

Parameters
bufferIdthe ID of the mesh buffer to update.
verticesthe new list of point mesh vertices.
indicesthe new list of mesh indices.

◆ UpdateMeshBuffer() [2/2]

void JoeEngine::JEMeshBufferManager::UpdateMeshBuffer ( uint32_t  bufferId,
const std::vector< JEMeshVertex > &  vertices,
const std::vector< uint32_t > &  indices 
)

Update a mesh buffer to a new list of vertices and indices.

Parameters
bufferIdthe ID of the mesh buffer to update.
verticesthe new list of triangle mesh vertices.
indicesthe new list of mesh indices.

The documentation for this class was generated from the following files: