Rendering Engine 0.2.0
Modular Graphics Rendering Engine | v0.2.0
Loading...
Searching...
No Matches
i_mesh_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
9
10#include <string>
11#include <vector>
12
13namespace rendering_engine
14{
15
16/**
17 * @brief Interface for GPU mesh resource management.
18 *
19 * This interface abstracts the creation, management, and destruction of mesh-related GPU resources.
20 * It supports multiple vertex types, index buffers, and provides utilities for buffer state and size queries.
21 */
23{
24public:
25 /**
26 * @brief Virtual destructor.
27 */
28 virtual ~IMeshRenderResources() = default;
29
30 /**
31 * @brief Create a GPU vertex buffer from 2D vertex data.
32 * @param vertices Vector of 2D vertex data.
33 */
34 virtual void CreateVertexBuffer(std::vector<Vertex2D> vertices) = 0;
35
36 /**
37 * @brief Create a GPU vertex buffer from 3D unlit vertex data.
38 * @param vertices Vector of VertexPositionTextureColor data.
39 */
40 virtual void CreateVertexBuffer(std::vector<VertexPositionColorTexture> vertices) = 0;
41
42 /**
43 * @brief Create a GPU vertex buffer from 3D lit vertex data.
44 * @param vertices Vector of VertexPositionTextureColorNormalTangent data.
45 */
46 virtual void CreateVertexBuffer(std::vector<VertexPositionColorTextureNormalTangent> vertices) = 0;
47
48 /**
49 * @brief Create a GPU index buffer.
50 * @param indices Vector of indices.
51 */
52 virtual void CreateIndexBuffer(std::vector<uint32_t> indices) = 0;
53
54 /**
55 * @brief Check if the buffers are currently resident on the GPU.
56 * @return True if the buffers are allocated on the GPU, false otherwise.
57 */
58 virtual bool IsOnGPU() const = 0;
59
60
61 /**
62 * @brief Release all GPU resources associated with this mesh.
63 */
64 virtual void Shutdown() = 0;
65
66 /**
67 * @brief Get the size (in bytes) of the GPU vertex buffer.
68 * @return Size in bytes of the vertex buffer.
69 */
70 virtual size_t GetVertexBufferSize() const = 0;
71
72 /**
73 * @brief Get the size (in bytes) of the GPU index buffer.
74 * @return Size in bytes of the index buffer.
75 */
76 virtual size_t GetIndexBufferSize() const = 0;
77};
78
79} // namespace rendering_engine
Interface for GPU mesh resource management.
virtual ~IMeshRenderResources()=default
Virtual destructor.
virtual size_t GetVertexBufferSize() const =0
Get the size (in bytes) of the GPU vertex buffer.
virtual void CreateVertexBuffer(std::vector< Vertex2D > vertices)=0
Create a GPU vertex buffer from 2D vertex data.
virtual bool IsOnGPU() const =0
Check if the buffers are currently resident on the GPU.
virtual void CreateVertexBuffer(std::vector< VertexPositionColorTextureNormalTangent > vertices)=0
Create a GPU vertex buffer from 3D lit vertex data.
virtual void Shutdown()=0
Release all GPU resources associated with this mesh.
virtual void CreateVertexBuffer(std::vector< VertexPositionColorTexture > vertices)=0
Create a GPU vertex buffer from 3D unlit vertex data.
virtual void CreateIndexBuffer(std::vector< uint32_t > indices)=0
Create a GPU index buffer.
virtual size_t GetIndexBufferSize() const =0
Get the size (in bytes) of the GPU index buffer.