LeviLamina
Loading...
Searching...
No Matches
PointLightShadowProbeManager.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/client/renderer/chunks/point_lighting/ILightLODResourceProvider.h"
7#include "mc/client/renderer/chunks/point_lighting/PointLightShadowAtlasHysteresis.h"
8#include "mc/client/renderer/chunks/point_lighting/PointLightShadowBatchProcessor.h"
9#include "mc/deps/minecraft_renderer/framebuilder/PointLightParameters.h"
10#include "mc/external/render_dragon/rendering/TextureCubeFace.h"
11#include "mc/world/level/BlockPos.h"
12
13// auto generated forward declare list
14// clang-format off
15class AABB;
16class Block;
17class BlockSource;
18class FrustumCuller;
19namespace PointLighting { class PointLightShadowProbe; }
20namespace PointLighting { struct AnalyticLightResources; }
21namespace dragon::atlas { class IAtlasHandle; }
22namespace dragon::atlas { class IAtlasUserOperations; }
23namespace mce { struct PointLightParameters; }
24namespace mce::framebuilder { struct ActiveShadowTileInfo; }
25namespace mce::framebuilder { struct ShadowAtlasFrameDescription; }
26// clang-format on
27
28namespace PointLighting {
29
31: public ::PointLighting::ILightLODResourceProvider<::PointLighting::AnalyticLightResources> {
32public:
33 // PointLightShadowProbeManager inner types declare
34 // clang-format off
35 struct ProbeDebugStats;
36 struct AtlasPressureState;
37 // clang-format on
38
39 // PointLightShadowProbeManager inner types define
40 struct ProbeDebugStats {
41 public:
42 // member variables
43 // NOLINTBEGIN
44 ::ll::TypedStorage<8, 8, uint64> mActiveProbeCount;
45 ::ll::TypedStorage<8, 8, uint64> mAllocatedFaceCount;
46 ::ll::TypedStorage<4, 4, uint> mGrowCount;
47 ::ll::TypedStorage<4, 4, uint> mShrinkCount;
48 ::ll::TypedStorage<4, 4, uint> mInvalidateCount;
49 ::ll::TypedStorage<4, 4, uint> mNewCount;
50 ::ll::TypedStorage<4, 4, uint> mConsecutiveFailureFrames;
51 ::ll::TypedStorage<1, 1, bool> mAtlasFull;
52 // NOLINTEND
53 };
54
55 struct AtlasPressureState {
56 public:
57 // member variables
58 // NOLINTBEGIN
59 ::ll::TypedStorage<4, 4, uint> mConsecutiveFailureFrames;
60 ::ll::TypedStorage<1, 1, bool> mWasFullFlag;
61 ::ll::TypedStorage<1, 1, bool> mFailedThisFrame;
62 // NOLINTEND
63 };
64
65 using ShadowProbeIndex = int;
66
67 using ProbeMap = ::std::unordered_map<::BlockPos, ::PointLighting::PointLightShadowProbe>;
68
69public:
70 // member variables
71 // NOLINTBEGIN
72 ::ll::TypedStorage<8, 16, ::std::weak_ptr<::dragon::atlas::IAtlasUserOperations>> mAtlasOps;
73 ::ll::TypedStorage<8, 64, ::std::unordered_map<::BlockPos, ::PointLighting::PointLightShadowProbe>> mActiveProbes;
74 ::ll::TypedStorage<
75 8,
76 8,
77 ::std::_List_const_iterator<::std::_List_val<
78 ::std::_List_simple_types<::std::pair<::BlockPos const, ::PointLighting::PointLightShadowProbe>>>>>
79 mNextToQueue;
80 ::ll::TypedStorage<8, 88, ::PointLighting::PointLightShadowBatchProcessor> mBatchProcessor;
81 ::ll::TypedStorage<1, 1, ::PointLighting::PointLightShadowAtlasHysteresis> mAtlasHysteresis;
82 ::ll::TypedStorage<4, 8, ::PointLighting::PointLightShadowProbeManager::AtlasPressureState> mAtlasState;
83 ::ll::TypedStorage<8, 136, ::mce::framebuilder::PointLightParameters> mLastParameters;
84 ::ll::TypedStorage<8, 24, ::std::vector<::AABB>> mBlockRegionChanges;
85 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::dragon::atlas::IAtlasHandle>> mShadowAtlas;
86 ::ll::TypedStorage<8, 40, ::PointLighting::PointLightShadowProbeManager::ProbeDebugStats> mLastFrameStats;
87 // NOLINTEND
88
89public:
90 // virtual functions
91 // NOLINTBEGIN
92 virtual ~PointLightShadowProbeManager() /*override*/ = default;
93
94 virtual bool atCapacity() const /*override*/;
95
96 virtual bool canReserve(::BlockPos const&) const /*override*/;
97
98 virtual bool acquired(::BlockPos const&) const /*override*/;
99
100 virtual void reserve(
101 ::BlockPos const&,
102 ::mce::PointLightParameters const&,
103 float const,
104 ::PointLighting::AnalyticLightResources&
105 ) /*override*/;
106
107 virtual void release(::BlockPos const&, ::PointLighting::AnalyticLightResources&) /*override*/;
108
109 virtual void advance(::BlockPos const&, ::PointLighting::AnalyticLightResources&, float) /*override*/;
110
111 virtual void refresh(::BlockPos const&, ::PointLighting::AnalyticLightResources&) /*override*/;
112
113 virtual void finalize(::BlockPos const&, ::PointLighting::AnalyticLightResources&) /*override*/;
114 // NOLINTEND
115
116public:
117 // member functions
118 // NOLINTBEGIN
119 MCAPI void _allocateProbeTile(
120 ::PointLighting::PointLightShadowProbe& probe,
121 ::dragon::rendering::TextureCubeFace face,
122 ushort dimension
123 );
124
125 MCAPI void
126 _invalidateProbeTile(::PointLighting::PointLightShadowProbe& probe, ::dragon::rendering::TextureCubeFace face);
127
128 MCAPI bool _isProbeRendered(::PointLighting::PointLightShadowProbe const& probe) const;
129
130 MCAPI void _processProbes(
131 ::mce::framebuilder::PointLightParameters const& pointLightParameters,
132 ::glm::vec3 const& worldOrigin,
133 ::FrustumCuller const& frustumCuller,
134 ::glm::vec3 const& cameraForward
135 );
136
137 MCAPI void _reconfigureAtlasIfNeeded(::mce::framebuilder::PointLightParameters const& pointLightParameters);
138
139 MCAPI bool _resizeProbeFace(
140 ::PointLighting::PointLightShadowProbe& probe,
141 ::dragon::rendering::TextureCubeFace face,
142 ushort targetDim,
143 uint64 nowMs
144 );
145
146 MCAPI ::mce::framebuilder::ShadowAtlasFrameDescription
147 getShadowFrameData(::mce::framebuilder::PointLightParameters const& pointLightParameters);
148
149 MCAPI void onBlockChanged(
150 ::BlockSource& source,
151 ::BlockPos const& blockPos,
152 ::Block const& block,
153 ::Block const& oldBlock,
154 ::mce::framebuilder::PointLightParameters const& pointLightParameters
155 );
156
157 MCAPI ::std::vector<::mce::framebuilder::ActiveShadowTileInfo> prepareActiveTiles(::glm::vec3 const& worldOrigin);
158 // NOLINTEND
159};
160
161} // namespace PointLighting
Definition AABB.h:18
Definition BlockSource.h:71
Definition Block.h:42
Definition FrustumCuller.h:5
Definition PointLightShadowProbeManager.h:7
Definition PointLightShadowProbe.h:7
Definition IAtlasHandle.h:7
Definition IAtlasUserOperations.h:7
Definition AnalyticLightResources.h:7
Definition PointLightShadowProbeManager.h:18
Definition PointLightShadowProbeManager.h:16
Definition PointLightParameters.h:7
Definition ActiveShadowTileInfo.h:7
Definition ShadowAtlasFrameDescription.h:7