Nameless Engine
Loading...
Searching...
No Matches
ShadowMapArrayIndexManager.h
1#pragma once
2
3// Standard.
4#include <optional>
5#include <variant>
6#include <memory>
7
8// Custom.
9#include "misc/Error.h"
10
11namespace ne {
12 class ShadowMapHandle;
13 class Pipeline;
14 class Renderer;
15 class GpuResourceManager;
16
26 // This class is expected to be used by shadow map manager.
27 friend class ShadowMapManager;
28
29 public:
31
34
36 ShadowMapArrayIndexManager& operator=(ShadowMapArrayIndexManager&&) noexcept = delete;
37
38 virtual ~ShadowMapArrayIndexManager() = default;
39
49 static std::variant<std::unique_ptr<ShadowMapArrayIndexManager>, Error> create(
51 GpuResourceManager* pResourceManager,
52 const std::string& sShaderArrayResourceName);
53
54 protected:
62
70 static void changeShadowMapArrayIndex(ShadowMapHandle* pShadowMapHandle, unsigned int iNewArrayIndex);
71
87 [[nodiscard]] virtual std::optional<Error>
89
97 [[nodiscard]] virtual std::optional<Error>
99
107 [[nodiscard]] virtual std::optional<Error> bindShadowMapsToPipeline(Pipeline* pPipeline) = 0;
108
114 [[nodiscard]] virtual std::optional<Error> bindShadowMapsToAllPipelines() = 0;
115
121 std::string_view getShaderArrayResourceName();
122
130 Renderer* getRenderer() const;
131
132 private:
134 Renderer* const pRenderer = nullptr;
135
137 const std::string sShaderArrayResourceName;
138 };
139}
Definition: Error.h:27
Definition: GpuResourceManager.h:43
Definition: Pipeline.h:20
Definition: Renderer.h:43
Definition: ShadowMapArrayIndexManager.h:25
Renderer * getRenderer() const
Definition: ShadowMapArrayIndexManager.cpp:49
virtual std::optional< Error > registerShadowMapResource(ShadowMapHandle *pShadowMapHandle)=0
virtual std::optional< Error > bindShadowMapsToAllPipelines()=0
virtual std::optional< Error > unregisterShadowMapResource(ShadowMapHandle *pShadowMapHandle)=0
virtual std::optional< Error > bindShadowMapsToPipeline(Pipeline *pPipeline)=0
Renderer *const pRenderer
Definition: ShadowMapArrayIndexManager.h:134
const std::string sShaderArrayResourceName
Definition: ShadowMapArrayIndexManager.h:137
static void changeShadowMapArrayIndex(ShadowMapHandle *pShadowMapHandle, unsigned int iNewArrayIndex)
Definition: ShadowMapArrayIndexManager.cpp:51
std::string_view getShaderArrayResourceName()
Definition: ShadowMapArrayIndexManager.cpp:45
static std::variant< std::unique_ptr< ShadowMapArrayIndexManager >, Error > create(Renderer *pRenderer, GpuResourceManager *pResourceManager, const std::string &sShaderArrayResourceName)
Definition: ShadowMapArrayIndexManager.cpp:18
Definition: ShadowMapHandle.h:23
Definition: ShadowMapManager.h:29