载入中...
搜索中...
未找到
ShadowScheme.h
浏览该文件的文档.
1#pragma once
2
3#include "common/Export.h"
4#include "common/Result.h"
5#include "graphics/Light.h"
6#include "graphics/Shadow.h"
7
8#include <cstdint>
9#include <string>
10#include <string_view>
11#include <vector>
12#include <glm/glm.hpp>
13
14namespace eve::graphics {
15
22[[nodiscard]] EVENGINE_API_BACKENDS Result<ShadowMethod> parseShadowMethod(std::string_view name);
23
26
33[[nodiscard]] EVENGINE_API_BACKENDS Result<ShadowMethod> resolveShadowMethod(std::string_view lightType,
34 ShadowMethod requested);
35
41 glm::vec3 eye{0.f};
43 glm::mat4 viewProj{1.f};
44 bool valid = false;
45};
46
61 bool enableDirectionalCsm = true;
62 bool enableSpotPerspective = true;
63 bool enablePointCube = false; // GPU atlas path lands later; keep off by default
64 int directionalMapSize = ShadowConfig::kMapSize;
65 int localMapSize = 1024;
67 int maxSpotShadowCasters = ShadowConfig::kLocalSlots;
68 int maxPointShadowCasters = 0;
69 float defaultSpotBias = 0.002f;
70 float defaultPointBias = 0.003f;
71
73 bool enableLocalPaging = true;
78 int maxLocalUpdatesPerFrame = ShadowConfig::kLocalSlots;
80 float hysteresisBonus = 0.35f;
82 float minPageScore = 1e-4f;
83
85 [[nodiscard]] static ShadowSchemeSettings& current();
86};
87
93 Light3D::Data* light = nullptr;
95 int layer = -1; // index into the shadow depth array
96 int lightIndex = -1; // index in the packed Light3D list (0..7)
97 glm::mat4 lightVP{1.f};
98 float bias = 0.002f;
99 float strength = 1.f;
100 float score = 0.f;
102 bool needsUpdate = true;
103};
104
112[[nodiscard]] EVENGINE_API_BACKENDS glm::mat4 buildSpotShadowVP(const glm::vec3& position,
113 const glm::vec3& direction, float range,
114 float outerAngleDeg);
115
123 int faceIndex, float range);
124
133 const ShadowPagingView& view,
135 bool hadSlot);
136
148EVENGINE_API_BACKENDS void selectShadowCasters(const std::vector<Light3D::Data*>& lights,
149 const std::vector<bool>& isPointFlags,
151 const ShadowPagingView& view,
152 Light3D::Data*& directionalCaster,
153 std::vector<LocalShadowSlot>& localSlots);
154
157
158} // namespace eve::graphics
std::uint16_t method
#define EVENGINE_API_BACKENDS
Definition Export.h:108
std::vector< eve::ProcgenProbeDesc > lights
Range range
std::array< float, 3 > position
std::string name
glm::mat4 view
Move-only, checked operation results for the common layer.
RoadLaneDirection direction
double current
Light3D::Data * light
TerrainThermalSettings settings
Move-only operation result carrying either a value or Status.
Definition Result.h:155
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
void selectShadowCasters(const std::vector< Light3D::Data * > &lights, const std::vector< bool > &isPointFlags, const ShadowSchemeSettings &settings, const ShadowPagingView &view, Light3D::Data *&directionalCaster, std::vector< LocalShadowSlot > &localSlots)
Select directional CSM caster + paged local spot slots for one frame.
glm::mat4 buildSpotShadowVP(const glm::vec3 &position, const glm::vec3 &direction, float range, float outerAngleDeg)
Build a perspective light VP for a spot caster (Vulkan RH, ZO depth).
float scoreSpotShadowCandidate(const Light3D::Data &light, const ShadowPagingView &view, const ShadowSchemeSettings &settings, bool hadSlot)
Score a spot caster for local-shadow paging (higher = more important).
void resetShadowLocalPageCache()
Clear sticky local-page cache (tests / scheme resets).
Result< ShadowMethod > resolveShadowMethod(std::string_view lightType, ShadowMethod requested)
Resolve Auto / validate an explicit method for a concrete light type.
const char * shadowMethodName(ShadowMethod method)
Canonical lowercase name for a ShadowMethod (auto, none, csm, …).
Result< glm::mat4 > buildPointShadowFaceVP(const glm::vec3 &position, int faceIndex, float range)
Build one cube-face light VP for a point caster.
ShadowMethod
How a Light3D produces real-time shadows. Auto resolves per light type (dir→CSM, spot→perspective,...
Definition Shadow.h:14
Result< ShadowMethod > parseShadowMethod(std::string_view name)
Parse a script/editor method name into ShadowMethod.
Data public API.
Definition Light.h:200
One allocated local (spot/point-face) shadow slot for the frame. @ownership Ephemeral CPU descriptor;...
bool needsUpdate
When false, skip the shadow pass and keep the cached depth layer.
Camera context used to score local shadow candidates for atlas paging. @ownership Ephemeral; valid on...
glm::mat4 viewProj
Camera view-projection (Vulkan RH, ZO) for soft frustum scoring.
Process-wide defaults for creating shadows per light family.