载入中...
搜索中...
未找到
ClusteredLight.h
浏览该文件的文档.
1#pragma once
2
3#include "graphics/Light.h"
4
5#include <cstdint>
6#include <vector>
7#include <glm/glm.hpp>
8
9namespace eve::graphics {
10
13 static constexpr int kTilesX = 16;
14 static constexpr int kTilesY = 9;
15 static constexpr int kSlices = 24;
16 static constexpr int kClusterCount = kTilesX * kTilesY * kSlices;
17 static constexpr int kMaxLights = 256;
18 static constexpr int kMaxLightsPerCluster = 32;
19};
20
22
25 uint32_t offset = 0;
26 uint32_t count = 0;
27};
28
34 glm::vec4 ambient{0.12f, 0.12f, 0.14f, 0.f};
37 float(ClusteredLightConfig::kSlices), 0.f}; // w = point light count
38 glm::vec4 clipInfo{0.1f, 100.f, 1.f, 1.f}; // near, far, screenW, screenH
39 glm::mat4 view{1.f};
40 glm::vec4 primaryDir{0.4f, 1.f, 0.3f, 0.f}; // toward surface; w=1 if valid
41 glm::vec4 primaryColor{1.f, 1.f, 1.f, 1.f};
42 std::vector<ClusteredLightGpu> lights; // point lights only (world space)
43 std::vector<ClusterTableEntry> clusterTable; // size = kClusterCount
44 std::vector<uint32_t> lightIndices;
46 uint32_t truncatedLightCount = 0;
51 bool active = false;
52};
53
60 const std::vector<ClusteredLightGpu> &dirs,
61 const glm::mat4 &view, float nearZ, float farZ,
62 int screenW, int screenH, float fovYRad,
63 const glm::vec4 &ambient);
64
65} // namespace eve::graphics
#define EVENGINE_API_BACKENDS
Definition Export.h:108
std::shared_ptr< const std::vector< glm::vec2 > > points
glm::mat4 view
卡牌游戏 UI 工具模块:工厂 + 脚本绑定入口。 功能参考 ycarowr/UiCard:扇形手牌布局、抽牌/洗牌、悬浮放大、拖拽到落牌区、 敌方手牌(背面/偷看)、费用不足置灰,以及可实时调节的布局...
Definition Animation.h:25
ClusteredLightingUpload buildClusteredLighting(const std::vector< ClusteredLightGpu > &points, const std::vector< ClusteredLightGpu > &dirs, const glm::mat4 &view, float nearZ, float farZ, int screenW, int screenH, float fovYRad, const glm::vec4 &ambient)
Build clustered tables for point lights in view space.
ClusterTableEntry public API.
Clustered forward grid (CPU assign, GPU consume).
static constexpr int kMaxLightsPerCluster
CPU-built clustered lighting upload for one frame/camera. Point lights are clustered; directional lig...
uint32_t droppedLightReferenceCount
Total cluster-to-light references removed by per-cluster truncation.
uint32_t overflowClusterCount
Number of clusters whose candidate list exceeded the per-cluster budget.
uint32_t truncatedLightCount
Number of input local lights rejected by the frame-wide 256-light budget.
std::vector< ClusteredLightGpu > lights
std::vector< ClusterTableEntry > clusterTable
GPU light packing for mesh3d / PBR (std140-friendly).
Definition Light.h:161
glm::vec4 ambient