载入中...
搜索中...
未找到
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;
16class IRayTracing;
19
75public:
77 enum class AutoInstancingPath { Auto, Ordinary };
78
86 [[nodiscard]] Result<void> setAutoInstancingPath(AutoInstancingPath path);
88 [[nodiscard]] AutoInstancingPath autoInstancingPath() const { return autoInstancingPath_; }
89
93 ~RenderControl() = default;
94
95 RenderControl(const RenderControl &) = delete;
97
99 void attach(Graphics *gfx);
101 Graphics *getGraphics() const { return gfx_; }
102
104 bool supports(const std::string &feature) const;
111 [[nodiscard]] Result<void> requestFeature(const std::string& feature, bool enabled);
113 void enable(const std::string &feature);
115 void disable(const std::string &feature);
117 bool isEnabled(const std::string &feature) const;
119 bool isPathTracingRequested() const { return pathTracingRequested_; }
121 PathTracingFrameState pathTracingFrameState() const { return pathTracingState_; }
123 std::string pathTracingDiagnostic() const { return pathTracingDiagnostic_; }
124
131 [[nodiscard]] Result<void> setPathTracingSamples(uint32_t samples);
133 uint32_t pathTracingSamples() const { return pathSamples_; }
134
142 [[nodiscard]] Result<void> setLightingMode(LightingMode mode);
147 [[nodiscard]] Result<void> setLightingMode(const std::string& name);
149 LightingMode getLightingMode() const { return lightingMode_; }
154 LightingMode getEffectiveLightingMode() const { return effectiveLightingMode_; }
159 bool isDeferredLightingAvailable() const;
167 bool hasHybridLightingFallback() const { return hybridLightingFallback_; }
168
175 [[nodiscard]] Result<void> applyLightingPreset(LightingPreset preset);
180 [[nodiscard]] Result<void> applyLightingPreset(const std::string& name);
185 [[nodiscard]] Result<void> applySuggestedLightingPreset();
187 LightingPreset getLightingPreset() const { return lightingPreset_; }
188
193 void setReflectionQuality(const std::string &quality);
195 std::string getReflectionQuality() const { return reflectionQuality_; }
197 void setPostProcessQuality(const std::string &quality) { setReflectionQuality(quality); }
199 std::string getPostProcessQuality() const { return reflectionQuality_; }
200
202 void compile();
204 bool isCompiled() const { return compiled_ && !dirty_; }
206 bool isDirty() const { return dirty_; }
207
209 int getPassCount() const { return int(passes_.size()); }
211 std::string getPassName(int index) const;
213 bool hasPass(const std::string &name) const;
214
216 GBuffer *getGBuffer() { return &gbuffer_; }
218 const GBuffer *getGBuffer() const { return &gbuffer_; }
219
221 void ensureCompiled();
222
223private:
224 friend class RenderSystem3D;
225 void setFeature(const std::string &feature, bool enabled);
226 void syncClusteredDeferredFeature();
227
228 Graphics *gfx_ = nullptr;
229 IRayTracing *pathProvider_ = nullptr; // Borrowed static capability provider.
230 bool pathTracingRequested_ = false;
231 bool pathTemporalRequested_ = false;
232 PathTracingFrameState pathTracingState_ = PathTracingFrameState::Disabled;
233 std::string pathTracingDiagnostic_;
234 uint32_t pathSampleIndex_ = 0;
235 uint32_t pathSamples_ = 1;
236 std::unordered_map<std::string, bool> features_;
237 std::vector<std::string> passes_;
238 std::string reflectionQuality_ = "high";
239 GBuffer gbuffer_;
240 AutoInstancingPath autoInstancingPath_ = AutoInstancingPath::Auto;
241 LightingMode lightingMode_ = LightingMode::ForwardPlus;
242 LightingMode effectiveLightingMode_ = LightingMode::ForwardPlus;
243 LightingPreset lightingPreset_ = LightingPreset::Desktop;
244 bool hybridLightingFallback_ = false;
245 bool dirty_ = true;
246 bool compiled_ = false;
247};
248
249} // namespace eve::graphics
std::string name
Definition ECS.cpp:154
#define EVENGINE_API_BACKENDS
Definition Export.h:108
std::string path
Definition PlayHost.cpp:111
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:176
Screen-space buffers for mid/post effects and Hybrid deferred lighting.
Definition GBuffer.h:28
Optional hardware ray-tracing backend (Vulkan KHR RT).
Definition IRayTracing.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.
AutoInstancingPath autoInstancingPath() const
Return the automatic instancing selection; render-thread affine, no callbacks.
uint32_t pathTracingSamples() const
Return the requested per-frame sample count; render-thread affine.
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.
PathTracingFrameState pathTracingFrameState() const
Latest render selection; Active means recorded, not GPU-complete.
~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 pathTracingDiagnostic() const
Owning diagnostic copy explaining the latest raster fallback.
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,...
AutoInstancingPath
Automatic opaque batching route; explicit gpuDriven requests retain priority.
GBuffer * getGBuffer()
Returns the g buffer.
bool isPathTracingRequested() const
True when the pathTracing feature is requested; render-thread query.
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...
EVENGINE_API_BACKENDS public API.
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
LightingMode
3D lighting strategy for opaque geometry.
PathTracingFrameState
Observable result of the latest automatic path-tracing frame selection.
LightingPreset
Platform lighting quality preset (does not replace an explicit setLightingMode).
bool enabled