Skip to content
LeviMC
English
AutoLightDark
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/PointLightShadowParameters.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, 144, ::mce::framebuilder::PointLightShadowParameters> mLastParameters;
84 ::ll::TypedStorage<4, 4, int> mLastMaxPointLights;
85 ::ll::TypedStorage<8, 24, ::std::vector<::AABB>> mBlockRegionChanges;
86 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::dragon::atlas::IAtlasHandle>> mShadowAtlas;
87 ::ll::TypedStorage<8, 40, ::PointLighting::PointLightShadowProbeManager::ProbeDebugStats> mLastFrameStats;
88 // NOLINTEND
89
90public:
91 // virtual functions
92 // NOLINTBEGIN
93 virtual ~PointLightShadowProbeManager() /*override*/ = default;
94
95 virtual bool atCapacity() const /*override*/;
96
97 virtual bool canReserve(::BlockPos const&) const /*override*/;
98
99 virtual bool
100 acquired(::BlockPos const&, ::mce::PointLightParameters const&, ::PointLighting::AnalyticLightResources&) const
101 /*override*/;
102
103 virtual void beginTransition(
104 ::BlockPos const&,
105 ::mce::PointLightParameters const&,
106 float const,
107 ::PointLighting::AnalyticLightResources&
108 ) /*override*/;
109
110 virtual void release(::BlockPos const&, ::PointLighting::AnalyticLightResources&) /*override*/;
111
112 virtual void advance(::BlockPos const&, ::PointLighting::AnalyticLightResources&, float) /*override*/;
113
114 virtual void refresh(
115 ::BlockPos const&,
116 ::mce::PointLightParameters const&,
117 ::PointLighting::AnalyticLightResources&
118 ) /*override*/;
119
120 virtual void finalize(::BlockPos const&, ::PointLighting::AnalyticLightResources&) /*override*/;
121 // NOLINTEND
122
123public:
124 // member functions
125 // NOLINTBEGIN
127 ::PointLighting::PointLightShadowProbe& probe,
128 ::dragon::rendering::TextureCubeFace face,
129 ushort dimension
130 );
131
132 MCNAPI void _freeProbeTiles(::PointLighting::PointLightShadowProbe& probe);
133
134 MCNAPI void
135 _invalidateProbeTile(::PointLighting::PointLightShadowProbe& probe, ::dragon::rendering::TextureCubeFace face);
136
137 MCNAPI bool _isProbeRendered(::PointLighting::PointLightShadowProbe const& probe) const;
138
139 MCNAPI void _processProbes(
140 ::mce::framebuilder::PointLightShadowParameters const& pointLightParameters,
141 ::glm::vec3 const& worldOrigin,
142 ::FrustumCuller const& frustumCuller,
143 ::glm::vec3 const& cameraForward
144 );
145
146 MCNAPI void _reconfigureAtlasIfNeeded(::mce::framebuilder::PointLightShadowParameters const& pointLightParameters);
147
148 MCNAPI bool _resizeProbeFace(
149 ::PointLighting::PointLightShadowProbe& probe,
150 ::dragon::rendering::TextureCubeFace face,
151 ushort targetDim,
152 uint64 nowMs
153 );
154
155 MCNAPI ::mce::framebuilder::ShadowAtlasFrameDescription
156 getShadowFrameData(::mce::framebuilder::PointLightShadowParameters const& pointLightParameters);
157
158 MCNAPI void onBlockChanged(
159 ::BlockSource& source,
160 ::BlockPos const& blockPos,
161 ::Block const& block,
162 ::Block const& oldBlock,
163 ::mce::framebuilder::PointLightShadowParameters const& pointLightParameters
164 );
165
166 MCNAPI ::std::vector<::mce::framebuilder::ActiveShadowTileInfo> prepareActiveTiles(::glm::vec3 const& worldOrigin);
167 // NOLINTEND
168};
169
170} // namespace PointLighting
Definition AABB.h:18
Definition BlockPos.h:14
Definition BlockSource.h:72
Definition Block.h:42
Definition FrustumCuller.h:5
Definition PointLightShadowProbeManager.h:7
MCAPI bool _resizeProbeFace(::PointLighting::PointLightShadowProbe &probe, ::dragon::rendering::TextureCubeFace face, ushort targetDim, uint64 nowMs)
MCAPI ::std::vector<::mce::framebuilder::ActiveShadowTileInfo > prepareActiveTiles(::glm::vec3 const &worldOrigin)
MCAPI void _freeProbeTiles(::PointLighting::PointLightShadowProbe &probe)
MCAPI void _processProbes(::mce::framebuilder::PointLightShadowParameters const &pointLightParameters, ::glm::vec3 const &worldOrigin, ::FrustumCuller const &frustumCuller, ::glm::vec3 const &cameraForward)
MCAPI::mce::framebuilder::ShadowAtlasFrameDescription getShadowFrameData(::mce::framebuilder::PointLightShadowParameters const &pointLightParameters)
MCAPI bool _isProbeRendered(::PointLighting::PointLightShadowProbe const &probe) const
MCAPI void _invalidateProbeTile(::PointLighting::PointLightShadowProbe &probe, ::dragon::rendering::TextureCubeFace face)
MCAPI void _allocateProbeTile(::PointLighting::PointLightShadowProbe &probe, ::dragon::rendering::TextureCubeFace face, ushort dimension)
MCAPI void onBlockChanged(::BlockSource &source, ::BlockPos const &blockPos, ::Block const &block, ::Block const &oldBlock, ::mce::framebuilder::PointLightShadowParameters const &pointLightParameters)
MCAPI void _reconfigureAtlasIfNeeded(::mce::framebuilder::PointLightShadowParameters const &pointLightParameters)
Definition PointLightShadowProbe.h:7
Definition IAtlasHandle.h:7
Definition IAtlasUserOperations.h:7
STL namespace.
Definition AnalyticLightResources.h:7
Definition PointLightShadowProbeManager.h:18
Definition PointLightShadowProbeManager.h:16
Definition PointLightParameters.h:7
Definition ActiveShadowTileInfo.h:7
Definition ShadowAtlasFrameDescription.h:7