Rendering Engine 0.2.0
Modular Graphics Rendering Engine | v0.2.0
Loading...
Searching...
No Matches
i_render_resources.hpp
Go to the documentation of this file.
1// This file is part of the Rendering Engine project.
2// Author: Alexander Obzherin <alexanderobzherin@gmail.com>
3// Copyright (c) 2025 Alexander Obzherin
4// Distributed under the terms of the zlib License. See LICENSE.md for details.
5
6#pragma once
7
8namespace rendering_engine
9{
10
14class Material;
15class MeshDataGpu;
16class TextureCache;
17
18/**
19 * @brief Interface for rendering backend resource aggregation and submission.
20 *
21 * Implementations of this interface aggregate all GPU-side objects and logic
22 * required to render a drawable entity.
23 * The interface is backend-agnostic and can be implemented for any graphics API.
24 *
25 * The interface is designed to work with shared resource caches (material, mesh, texture),
26 * typically owned elsewhere and passed to Initialize().
27 *
28 * @note Lifetime management of Material, MeshDataGpu, and TextureCache must be handled externally.
29 */
31{
32public:
33 /**
34 * @brief Virtual destructor.
35 */
36 virtual ~IRenderResources() = default;
37
38 /**
39 * @brief Initializes GPU-side resources using provided material, mesh, and texture cache.
40 *
41 * @param material Pointer to the Material describing the shader and its parameters.
42 * @param meshData Pointer to MeshDataGpu containing vertex and index buffers.
43 * @param textureCache Pointer to the TextureCache containing all loaded textures.
44 *
45 * @note Ownership of parameters is not transferred; caller must ensure they remain valid.
46 */
47 virtual void Initialize(Material* material, MeshDataGpu* meshData, TextureCache* textureCache) = 0;
48
49 /**
50 * @brief Updates GPU resources and issues a draw call for a 2D object.
51 *
52 * @param transformations Transformation data (2D).
53 * @param materialParameters Packed structure with material parameters for the draw call.
54 */
55 virtual void SubmitResources(Transformations2D& transformations, const PackedMaterialData& materialParameters) = 0;
56
57 /**
58 * @brief Updates GPU resources and issues a draw call for a 3D object.
59 *
60 * @param transformations Transformation data (3D).
61 * @param materialParameters Packed structure with material parameters for the draw call.
62 */
63 virtual void SubmitResources(Transformations3D& transformations, const PackedMaterialData& materialParameters) = 0;
64
65 /**
66 * @brief Releases all allocated GPU resources for this object.
67 */
68 virtual void Shutdown() = 0;
69};
70
71} // namespace rendering_engine
Interface for rendering backend resource aggregation and submission.
virtual ~IRenderResources()=default
Virtual destructor.
virtual void SubmitResources(Transformations2D &transformations, const PackedMaterialData &materialParameters)=0
Updates GPU resources and issues a draw call for a 2D object.
virtual void SubmitResources(Transformations3D &transformations, const PackedMaterialData &materialParameters)=0
Updates GPU resources and issues a draw call for a 3D object.
virtual void Shutdown()=0
Releases all allocated GPU resources for this object.
virtual void Initialize(Material *material, MeshDataGpu *meshData, TextureCache *textureCache)=0
Initializes GPU-side resources using provided material, mesh, and texture cache.
Represents a material instance with parameter values, texture bindings, and rendering configuration.
Definition material.hpp:30
Manages mesh data in RAM and GPU, including upload and release operations.
Manages texture loading, GPU uploading, and caching for reuse.
Contains the raw buffer data and layout metadata of packed material parameters.
Contains transformation matrices for 2D rendering.
Contains model, view, and projection matrices for 3D rendering.