Photon Editor Library 2.0.0-beta
A physically based renderer.
Loading...
Searching...
No Matches
GraphicsObjectManager.h
Go to the documentation of this file.
1#pragma once
2
5
6#include <Common/primitive_type.h>
7#include <Math/TVector2.h>
8#include <Math/TVector3.h>
9#include <Utility/TSpan.h>
10
11#include <cstddef>
12#include <string>
13
14namespace ph::editor { class GHIThreadUpdateContext; }
15
16namespace ph::editor::ghi
17{
18
26{
27public:
29
33 [[nodiscard]]
34 virtual TextureHandle createTexture(const TextureDesc& desc) = 0;
35
39 [[nodiscard]]
41 const FramebufferDesc& desc) = 0;
42
46 [[nodiscard]]
48 std::string name,
49 EShadingStage shadingStage,
50 std::string shaderSource) = 0;
51
55 [[nodiscard]]
57 std::string name,
58 const ShaderSetInfo& shaders) = 0;
59
63 [[nodiscard]]
65 std::size_t numVertices,
66 const VertexGroupFormatInfo& format,
67 EStorageUsage usage) = 0;
68
72 [[nodiscard]]
74 std::size_t numIndices,
75 EStorageElement indexType,
76 EStorageUsage usage) = 0;
77
81 [[nodiscard]]
83 TSpanView<VertexStorageHandle> vertexStorages,
84 const MeshVertexLayoutInfo& layout,
85 IndexStorageHandle indexStorage) = 0;
86
90 virtual void uploadPixelData(
91 TextureHandle handle,
92 TSpanView<std::byte> pixelData,
93 EPixelFormat pixelFormat,
94 EPixelComponent pixelComponent) = 0;
95
99 virtual void removeTexture(TextureHandle handle) = 0;
100
104 virtual void removeFramebuffer(FramebufferHandle handle) = 0;
105
109 virtual void removeShader(ShaderHandle handle) = 0;
110
114 virtual void removeShaderProgram(ShaderProgramHandle handle) = 0;
115
119 virtual void removeVertexStorage(VertexStorageHandle handle) = 0;
120
124 virtual void removeIndexStorage(IndexStorageHandle handle) = 0;
125
129 virtual void removeMesh(MeshHandle handle) = 0;
130
133 virtual void onGHILoad() = 0;
134
137 virtual void onGHIUnload() = 0;
138
141 virtual void beginFrameUpdate(const GHIThreadUpdateContext& ctx) = 0;
142
145 virtual void endFrameUpdate(const GHIThreadUpdateContext& ctx) = 0;
146};
147
148}// end namespace ph::editor::ghi
Definition GHIThreadUpdateContext.h:11
Definition ghi_infos.h:124
Manages the creation and deletion of graphics-related resource objects. All create<XXX>() and delete<...
Definition GraphicsObjectManager.h:26
virtual void endFrameUpdate(const GHIThreadUpdateContext &ctx)=0
Called by GHI thread when a frame ends.
virtual ShaderProgramHandle createShaderProgram(std::string name, const ShaderSetInfo &shaders)=0
virtual void onGHIUnload()=0
Called by GHI thread before GHI is unloaded.
virtual MeshHandle createMesh(TSpanView< VertexStorageHandle > vertexStorages, const MeshVertexLayoutInfo &layout, IndexStorageHandle indexStorage)=0
virtual void removeIndexStorage(IndexStorageHandle handle)=0
virtual void removeShader(ShaderHandle handle)=0
virtual void removeTexture(TextureHandle handle)=0
virtual void removeFramebuffer(FramebufferHandle handle)=0
virtual IndexStorageHandle createIndexStorage(std::size_t numIndices, EStorageElement indexType, EStorageUsage usage)=0
virtual void removeVertexStorage(VertexStorageHandle handle)=0
virtual ShaderHandle createShader(std::string name, EShadingStage shadingStage, std::string shaderSource)=0
virtual void removeMesh(MeshHandle handle)=0
virtual void beginFrameUpdate(const GHIThreadUpdateContext &ctx)=0
Called by GHI thread when a frame begins.
virtual void removeShaderProgram(ShaderProgramHandle handle)=0
virtual VertexStorageHandle createVertexStorage(std::size_t numVertices, const VertexGroupFormatInfo &format, EStorageUsage usage)=0
virtual void uploadPixelData(TextureHandle handle, TSpanView< std::byte > pixelData, EPixelFormat pixelFormat, EPixelComponent pixelComponent)=0
virtual TextureHandle createTexture(const TextureDesc &desc)=0
virtual void onGHILoad()=0
Called by GHI thread after GHI is loaded.
virtual FramebufferHandle createFramebuffer(const FramebufferDesc &desc)=0
Definition ghi_infos.h:46
Definition ghi_infos.h:101
Definition PlatformDisplay.h:13
EPixelFormat
Definition ghi_enums.h:31
EStorageElement
Definition ghi_enums.h:70
EShadingStage
Definition ghi_enums.h:104
EStorageUsage
Definition ghi_enums.h:86
EPixelComponent
Definition ghi_enums.h:42
Definition ph_editor.h:10