|
CeresEngine 0.2.0
A game development framework
|
A manager that controls all materials currently in use by the renderer. More...
#include <CeresEngine/Renderer/RendererMaterial.hpp>
Public Member Functions | |
| RendererMaterialManager (Renderer &renderer, GPUDevice &device) | |
Creates a new instance of the RendererMaterialManager. | |
| ~RendererMaterialManager () | |
Destroys the RendererMaterialManager and releases all GPU resources managed and allocated by it. | |
| SPtr< RendererMaterial > | get (const HMaterial &material) |
| Gets a renderer material instance for the given material resource. | |
| Async | prepare (RendererContext &context) |
| Prepares the materials for the rendering of the current frame. | |
| Renderer & | getRenderer () const |
| The renderer that owns this manager instance. | |
| RendererMaterial & | getDefaultMaterial () const |
| The default material to be used as a fallback in case no material is defined by the user. | |
| const GPUBindlessBuffer & | getUniformBuffer () const noexcept |
| The uniform buffer that holds GPU parameters for all materials. | |
Private Types | |
| using | UniformBufferType = GPUDynamicStridedBindlessBufferArray< PBRMaterialParams > |
| The type used to store uniform buffers. | |
Private Attributes | |
| Renderer & | mRenderer |
| The renderer that owns this manager instance. | |
| GPUDevice & | mDevice |
| The device the renderer will render to. | |
| HashMap< HMaterial, WPtr< RendererMaterial > > | mMaterials |
| A list of materials currently registered with the renderer. | |
| SPtr< RendererMaterial > | mDefaultMaterial |
| The default material to be used as a fallback in case no material is defined by the user. | |
| UniformBufferType | mUniformBuffer |
| The uniform buffer that holds GPU parameters for all materials. | |
A manager that controls all materials currently in use by the renderer.
|
private |
The type used to store uniform buffers.
|
explicit |
Creates a new instance of the RendererMaterialManager.
| CeresEngine::RendererMaterialManager::~RendererMaterialManager | ( | ) |
Destroys the RendererMaterialManager and releases all GPU resources managed and allocated by it.
| SPtr< RendererMaterial > CeresEngine::RendererMaterialManager::get | ( | const HMaterial & | material | ) |
Gets a renderer material instance for the given material resource.
If an existing RendererMaterial for the given material resource already exists, a shared instance is returned. If no existing RendererMaterial instance exists for the given material a new one will be created and returned.
Changes done to the underlying Material resource will be automatically tracked by the manager and the renderer material will replicate the changes.
| material | The material resource to locate a new renderer material for. |
RendererMaterial instance for the given material resource.
|
inline |
The default material to be used as a fallback in case no material is defined by the user.
|
inline |
The renderer that owns this manager instance.
|
inlinenoexcept |
The uniform buffer that holds GPU parameters for all materials.
Meant to be used by bindless render passes.
| Async CeresEngine::RendererMaterialManager::prepare | ( | RendererContext & | context | ) |
Prepares the materials for the rendering of the current frame.
This will update uniform buffers and perform any other necessary operations necessary for rendering. All prepared data must be view independent.
| context | A context struct that contains parameters given by the renderer. |
|
private |
The default material to be used as a fallback in case no material is defined by the user.
|
private |
The device the renderer will render to.
Materials will be synchronized and uploaded to this device.
|
private |
A list of materials currently registered with the renderer.
|
private |
The renderer that owns this manager instance.
|
private |
The uniform buffer that holds GPU parameters for all materials.
Meant to be used by bindless render passes.