CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::RendererMeshManager Class Reference

A manager class that creates, manages and handles GPU vertex and index buffers for meshes used by the renderer. More...

#include <CeresEngine/Renderer/Resources/RendererMesh.hpp>

Classes

struct  MeshInfo
 

Public Member Functions

 RendererMeshManager (Renderer &renderer, GPUDevice &device)
 Creates a new instance of the RendererMeshManager.
 
 ~RendererMeshManager ()
 Destroys the RendererMeshManager and releases all GPU resources managed and allocated by it.
 
GPUVertexBuffer getVertexBuffer (const HMesh &mesh)
 Tries to locate a VertexBuffer for the given mesh.
 
GPUIndexBuffer getIndexBuffer (const HMesh &mesh)
 Tries to locate a IndexBuffer for the given mesh.
 
RendererMeshPtr get (const MeshPtr &mesh)
 Gets a renderer mesh object.
 

Private Member Functions

RendererMeshPtr getOrCreate (const MeshPtr &mesh)
 Gets an existing or creates a new renderer mesh instance for the given engine mesh.
 
RendererMeshPtr create (const MeshPtr &mesh)
 Creates a new renderer mesh instance for the given engine mesh.
 
void notifyDestroy (const RendererMesh *mesh) noexcept
 Notifies the manager that the renderer mesh is being destroyed.
 

Private Attributes

RenderermRenderer
 The renderer that owns this manager instance.
 
GPUDevicemDevice
 The device to which the meshes will be uploaded to.
 
HashMap< Mesh *, MeshInfomMeshes
 A map that holds mesh information for each engine mesh used by the renderer.
 

Friends

class RendererMesh
 

Detailed Description

A manager class that creates, manages and handles GPU vertex and index buffers for meshes used by the renderer.

Constructor & Destructor Documentation

◆ RendererMeshManager()

CeresEngine::RendererMeshManager::RendererMeshManager ( Renderer renderer,
GPUDevice device 
)
explicit

Creates a new instance of the RendererMeshManager.

◆ ~RendererMeshManager()

CeresEngine::RendererMeshManager::~RendererMeshManager ( )

Destroys the RendererMeshManager and releases all GPU resources managed and allocated by it.

Member Function Documentation

◆ create()

RendererMeshPtr CeresEngine::RendererMeshManager::create ( const MeshPtr mesh)
private

Creates a new renderer mesh instance for the given engine mesh.

◆ get()

RendererMeshPtr CeresEngine::RendererMeshManager::get ( const MeshPtr mesh)
inline

Gets a renderer mesh object.

The renderer mesh is a renderer usable representation of a mesh resource. This mesh begins in the pending state but will eventually be uploaded to GPU and be usable by renderables and other objects in the renderer scene.

If a renderer mesh object for the given mesh resource already exists, the existing instance is returned to the user. If no existing instance is found, a new one is created and returned to the user.

Parameters
meshThe mesh resource to get or create a new renderer mesh for.

◆ getIndexBuffer()

GPUIndexBuffer CeresEngine::RendererMeshManager::getIndexBuffer ( const HMesh mesh)

Tries to locate a IndexBuffer for the given mesh.

If no such buffer exists, the manager might schedule an asynchronous upload of data to the GPU and return once the index buffer becomes available.

Parameters
meshThe mesh to return a GPU index buffer resource for.
Returns
A GPU IndexBuffer for the mesh. If no such buffer exists, the manager might return nullptr until the GPU data upload is complete.

◆ getOrCreate()

RendererMeshPtr CeresEngine::RendererMeshManager::getOrCreate ( const MeshPtr mesh)
private

Gets an existing or creates a new renderer mesh instance for the given engine mesh.

◆ getVertexBuffer()

GPUVertexBuffer CeresEngine::RendererMeshManager::getVertexBuffer ( const HMesh mesh)

Tries to locate a VertexBuffer for the given mesh.

If no such buffer exists, the manager might schedule an asynchronous upload of data to the GPU and return once the vertex buffer becomes available.

Parameters
meshThe mesh to return a GPU vertex buffer resource for.
Returns
A GPU VertexBuffer for the mesh. If no such buffer exists, the manager might return nullptr until the GPU data upload is complete.

◆ notifyDestroy()

void CeresEngine::RendererMeshManager::notifyDestroy ( const RendererMesh mesh)
privatenoexcept

Notifies the manager that the renderer mesh is being destroyed.

Friends And Related Symbol Documentation

◆ RendererMesh

Member Data Documentation

◆ mDevice

GPUDevice& CeresEngine::RendererMeshManager::mDevice
private

The device to which the meshes will be uploaded to.

◆ mMeshes

HashMap<Mesh*, MeshInfo> CeresEngine::RendererMeshManager::mMeshes
private

A map that holds mesh information for each engine mesh used by the renderer.

◆ mRenderer

Renderer& CeresEngine::RendererMeshManager::mRenderer
private

The renderer that owns this manager instance.


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