载入中...
搜索中...
未找到
Shadow.h
浏览该文件的文档.
1#pragma once
2#include "common/Export.h"
3
4
5#include <cstdint>
6#include <glm/glm.hpp>
7
8namespace eve::graphics {
9
14enum class ShadowMethod : std::uint8_t {
15 Auto = 0,
16 None,
20};
21
24 static constexpr int kCascades = 3;
26 static constexpr int kLocalSlots = 4;
27 static constexpr int kTotalLayers = kCascades + kLocalSlots;
28 static constexpr int kMapSize = 2048;
29 static constexpr float kSplitLambda = 0.7f;
32 static constexpr float kMaxDistance = 64.f;
33};
34
36struct ShadowUBO {
38 glm::vec4 splits{0.f}; // xyz = view-space +Z split ends (camera-forward distance); w = strength
39 glm::vec4 bias{0.002f, 0.f, 1.f, 0.02f}; // w=directional source angular radius
40 glm::vec4 cascadeBias{0.f}; // xyz = per-cascade NDC compare bias
41 glm::vec4 cascadeTexel{0.f}; // xyz = world units per shadow texel
45 glm::vec4 localSlot01{-1.f, -1.f, -1.f, -1.f};
46 glm::vec4 localSlot23{-1.f, -1.f, -1.f, -1.f};
48 glm::vec4 localBias{0.002f};
50 glm::vec4 localMeta{0.f, 1.f, 0.f, 0.f};
51};
52
56 bool active = false;
57};
58
68EVENGINE_API_BACKENDS ShadowUpload buildDirectionalCSM(const glm::vec3 &lightDirTowardSurface, const glm::vec3 &eye,
69 const glm::vec3 &target, const glm::vec3 &up, float fovYRad,
70 float aspect, float nearZ, float farZ, float bias,
71 float strength);
72
73} // namespace eve::graphics
LogicalId target
#define EVENGINE_API_BACKENDS
Definition Export.h:108
HexVec3 up
glm::vec3 eye
float bias
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
ShadowUpload buildDirectionalCSM(const glm::vec3 &lightDirTowardSurface, const glm::vec3 &eye, const glm::vec3 &target, const glm::vec3 &up, float fovYRad, float aspect, float nearZ, float farZ, float bias, float strength)
Build 3 cascade light view-proj matrices for a directional light.
Definition Shadow.cpp:83
ShadowMethod
How a Light3D produces real-time shadows. Auto resolves per light type (dir→CSM, spot→perspective,...
Definition Shadow.h:14
ShadowConfig public API.
Definition Shadow.h:23
static constexpr float kSplitLambda
Definition Shadow.h:29
static constexpr int kLocalSlots
Extra depth-array layers for spot (perspective) local shadows.
Definition Shadow.h:26
static constexpr int kMapSize
Definition Shadow.h:28
static constexpr float kMaxDistance
Definition Shadow.h:32
static constexpr int kCascades
Definition Shadow.h:24
static constexpr int kTotalLayers
Definition Shadow.h:27
Per-frame / per-draw CSM + local-spot constants (std140).
Definition Shadow.h:36
glm::vec4 cascadeTexel
Definition Shadow.h:41
glm::vec4 localBias
xyzw = per-local-slot NDC bias.
Definition Shadow.h:48
glm::vec4 localSlot01
Per packed-light local slot index (0..3) or -1; eight floats across two vec4s.
Definition Shadow.h:45
glm::vec4 localMeta
x = local slot count; y = local strength scale; zw unused.
Definition Shadow.h:50
glm::vec4 cascadeBias
Definition Shadow.h:40
glm::mat4 localVP[ShadowConfig::kLocalSlots]
Perspective VPs for local spot slots (layers kCascades .. kTotalLayers-1).
Definition Shadow.h:43
glm::vec4 localSlot23
Definition Shadow.h:46
glm::mat4 lightVP[ShadowConfig::kCascades]
Definition Shadow.h:37
ShadowUpload public API.
Definition Shadow.h:54