载入中...
搜索中...
未找到
RenderControl.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5#include "common/Result.h"
6#include "graphics/GBuffer.h"
8
9#include <string>
10#include <unordered_map>
11#include <vector>
12
13namespace eve::graphics {
14
15class Graphics;
16
69public:
73 ~RenderControl() = default;
74
75 RenderControl(const RenderControl &) = delete;
77
79 void attach(Graphics *gfx);
81 Graphics *getGraphics() const { return gfx_; }
82
84 bool supports(const std::string &feature) const;
86 void enable(const std::string &feature);
88 void disable(const std::string &feature);
90 bool isEnabled(const std::string &feature) const;
91
98 [[nodiscard]] Result<void> setLightingMode(LightingMode mode);
103 [[nodiscard]] Result<void> setLightingMode(const std::string& name);
105 LightingMode getLightingMode() const { return lightingMode_; }
110 LightingMode getEffectiveLightingMode() const { return effectiveLightingMode_; }
115 bool isDeferredLightingAvailable() const;
121 bool hasHybridLightingFallback() const { return hybridLightingFallback_; }
122
129 [[nodiscard]] Result<void> applyLightingPreset(LightingPreset preset);
134 [[nodiscard]] Result<void> applyLightingPreset(const std::string& name);
139 [[nodiscard]] Result<void> applySuggestedLightingPreset();
141 LightingPreset getLightingPreset() const { return lightingPreset_; }
142
147 void setReflectionQuality(const std::string &quality);
149 std::string getReflectionQuality() const { return reflectionQuality_; }
151 void setPostProcessQuality(const std::string &quality) { setReflectionQuality(quality); }
153 std::string getPostProcessQuality() const { return reflectionQuality_; }
154
156 void compile();
158 bool isCompiled() const { return compiled_ && !dirty_; }
160 bool isDirty() const { return dirty_; }
161
163 int getPassCount() const { return int(passes_.size()); }
165 std::string getPassName(int index) const;
167 bool hasPass(const std::string &name) const;
168
170 GBuffer *getGBuffer() { return &gbuffer_; }
172 const GBuffer *getGBuffer() const { return &gbuffer_; }
173
175 void ensureCompiled();
176
177private:
178 void setFeature(const std::string &feature, bool enabled);
179 void syncClusteredDeferredFeature();
180
181 Graphics *gfx_ = nullptr;
182 std::unordered_map<std::string, bool> features_;
183 std::vector<std::string> passes_;
184 std::string reflectionQuality_ = "high";
185 GBuffer gbuffer_;
186 LightingMode lightingMode_ = LightingMode::ForwardPlus;
187 LightingMode effectiveLightingMode_ = LightingMode::ForwardPlus;
188 LightingPreset lightingPreset_ = LightingPreset::Desktop;
189 bool hybridLightingFallback_ = false;
190 bool dirty_ = true;
191 bool compiled_ = false;
192};
193
194} // namespace eve::graphics
#define EVENGINE_API_BACKENDS
Definition Export.h:108
std::string name
Move-only, checked operation results for the common layer.
uint32_t index
Move-only operation result carrying either a value or Status.
Definition Result.h:155
Screen-space buffers for mid/post effects and Hybrid deferred lighting.
Definition GBuffer.h:28
Declarative, compilable 3D render control.
LightingMode getLightingMode() const
Return the caller-requested lighting mode (may differ from effective).
void setPostProcessQuality(const std::string &quality)
Set the unified post-process quality for TAA, RTGI and SSR.
Graphics * getGraphics() const
Returns the graphics.
bool isCompiled() const
True when compiled.
int getPassCount() const
Returns the pass count.
RenderControl & operator=(const RenderControl &)=delete
std::string getReflectionQuality() const
Return the shared TAA/RTGI/SSR quality preset.
~RenderControl()=default
Renders control.
bool isDirty() const
True when dirty.
LightingPreset getLightingPreset() const
Last applied lighting preset (defaults to Desktop before any apply).
std::string getPostProcessQuality() const
Return the unified post-process quality for TAA, RTGI and SSR.
bool hasHybridLightingFallback() const
True after compile() when Hybrid was requested but could not run (deferred lighting unavailable or GB...
GBuffer * getGBuffer()
Returns the g buffer.
RenderControl(const RenderControl &)=delete
const GBuffer * getGBuffer() const
Returns the g buffer.
LightingMode getEffectiveLightingMode() const
Return the mode actually compiled into the pass list. @lifetime Valid after a successful compile(); e...
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
LightingMode
3D lighting strategy for opaque geometry.
LightingPreset
Platform lighting quality preset (does not replace an explicit setLightingMode).
bool enabled