|
evan 2026.1.4
Evan
|
A Renderable object. It is a simple interface between our core renderer and on-top built objects (such as texts, basic shapes and 3d objects) More...
#include <headers/evan/RenderObject.hpp>


Public Member Functions | |
| RenderObject (std::shared_ptr< DeviceContext > deviceContext, const std::map< uint32_t, utility::graphic::Mesh > &rawObjects, const std::string &pipelineLayer) | |
| Constructor: creates a single renderable object using its meshes and its associated material ID. | |
| ~RenderObject () | |
| Destructor for the RenderObject. | |
| void | destroy (VkDevice device) |
| Destroys the GPU resources associated with this RenderObject, such as the GPUMesh instances. This method should be called when the render object is no longer needed to free up GPU resources and prevent memory leaks. | |
| void | setTransform (const glm::mat4 &transform) |
| Sets the model transform on every mesh of this object. | |
| bool | updateMeshes (const std::map< uint32_t, utility::graphic::Mesh > &rawObjects) |
| Updates the meshes of this object in place. | |
| const std::vector< std::shared_ptr< GPUMesh > > & | getMeshes () const |
| Retrieves the vector of GPUMesh instances associated with this RenderObject. Each GPUMesh represents a mesh that will be rendered as part of this object, and contains the necessary GPU resources for rendering. | |
| std::string | getPipelineLayer () const |
| Retrieves the pipeline layer associated with this RenderObject. The pipeline layer is a string that can be used to determine which shader program and rendering configurations should be applied when rendering this object. It can be used to group render objects with similar rendering requirements together for efficient batching and state management in the rendering process. | |
Protected Attributes | |
| std::vector< std::shared_ptr< GPUMesh > > | _meshes |
| std::string | _pipelineLayer |
A Renderable object. It is a simple interface between our core renderer and on-top built objects (such as texts, basic shapes and 3d objects)
Definition at line 29 of file RenderObject.hpp.
| evan::RenderObject::RenderObject | ( | std::shared_ptr< DeviceContext > | deviceContext, |
| const std::map< uint32_t, utility::graphic::Mesh > & | rawObjects, | ||
| const std::string & | pipelineLayer | ||
| ) |
Constructor: creates a single renderable object using its meshes and its associated material ID.
| deviceContext | A shared pointer to the DeviceContext, which provides access to Vulkan device resources and operations needed for creating GPU resources for the render object. |
| rawObjects | A map of mesh IDs to utility::graphic::Mesh objects, representing the raw mesh data that will be used to create the GPU meshes for this render object. Each entry in the map corresponds to a mesh that will be rendered as part of this object, and the mesh data will be processed and uploaded to the GPU to create the corresponding GPUMesh instances. |
| pipelineLayer | A string representing the pipeline layer associated with this render object, which can be used to determine which shader program and rendering configurations should be applied when rendering this object. The pipeline layer can be used to group render objects with similar rendering requirements together, allowing for efficient batching and state management in the rendering process. |
Destroys the GPU resources associated with this RenderObject, such as the GPUMesh instances. This method should be called when the render object is no longer needed to free up GPU resources and prevent memory leaks.
| device | The Vulkan device used for resource management, which is required to clean up GPU resources associated with the GPUMesh instances. It is assumed that the Vulkan device is properly initialized and can be used to manage GPU resources for cleanup. |
Retrieves the vector of GPUMesh instances associated with this RenderObject. Each GPUMesh represents a mesh that will be rendered as part of this object, and contains the necessary GPU resources for rendering.
| std::string evan::RenderObject::getPipelineLayer | ( | ) | const |
Retrieves the pipeline layer associated with this RenderObject. The pipeline layer is a string that can be used to determine which shader program and rendering configurations should be applied when rendering this object. It can be used to group render objects with similar rendering requirements together for efficient batching and state management in the rendering process.
Sets the model transform on every mesh of this object.
Applies the same model matrix to each GPUMesh owned by this object. The renderer uploads it on every frame, so the transform reaches the vertex shader without touching the vertex data.
| transform | The 4x4 model matrix applied to every mesh. |
| bool evan::RenderObject::updateMeshes | ( | const std::map< uint32_t, utility::graphic::Mesh > & | rawObjects | ) |
Updates the meshes of this object in place.
Re-uses the already-allocated GPU vertex buffers whenever the topology (mesh count, vertex count and index count) is unchanged, avoiding buffer creation and destruction. When the topology differs, returns false so the caller can rebuild the object instead.
| rawObjects | A map of material IDs to the new mesh data, with the same layout used by the constructor. |
|
protected |
A vector of GPUMesh instances representing the meshes associated with this RenderObject. Each GPUMesh contains the necessary GPU resources for rendering a mesh that is part of this object.
Definition at line 140 of file RenderObject.hpp.
|
protected |
A string representing the pipeline layer associated with this RenderObject, which can be used to determine rendering configurations for this object during the rendering process. The pipeline layer can be used to group render objects with similar rendering requirements together for efficient batching and state management in the rendering process.
Definition at line 145 of file RenderObject.hpp.