LeviLamina
Loading...
Searching...
No Matches
SubChunkRelighter.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/world/level/ChunkPos.h"
7#include "mc/world/level/chunk/SubChunkBrightnessStorage.h"
8
9// auto generated forward declare list
10// clang-format off
11class Block;
12class BlockPos;
13class IBlockSource;
14class LevelChunk;
15class Pos;
16class SpinLockImpl;
17struct Brightness;
18struct SubChunk;
22// clang-format on
23
24class SubChunkRelighter {
25public:
26 // SubChunkRelighter inner types define
27 enum class SubChunkToDoBitsClearMode : int {
28 AllSubChunkBorderBitsExceptTheOuterEdgeOfComputationBits = 0,
29 SetOuterEdgeOfComputationBits = 1,
30 };
31
33
34public:
35 // member variables
36 // NOLINTBEGIN
37 ::ll::TypedStorage<1, 1, bool> mNeedToResetToDoBits;
38 ::ll::TypedStorage<8, 24576, ::std::bitset<196608>> mToDo;
39 ::ll::TypedStorage<1, 4096, ::std::array<uchar, 4096>> mOldAbsorption;
40 ::ll::TypedStorage<8, 768, ::std::vector<::SubChunkLightIndex>[2][16]> mAdditiveBlocksToProcess;
41 ::ll::TypedStorage<8, 384, ::std::vector<::SubChunkLightIndex>[16]> mEdgeBlocksToProcess;
42 ::ll::TypedStorage<8, 384, ::std::vector<::SubChunkLightIndex>[16]> mBlocksToProcess;
43 ::ll::TypedStorage<8, 24, ::std::vector<::SubChunkLightIndex>> mAbsorptionBlocksToProcess;
44 ::ll::TypedStorage<8, 48, ::std::vector<::SubtractiveLightInfo>[2]> mSubtractiveBlocks;
45 ::ll::TypedStorage<8, 384, ::SubChunk* [3][4][4]> mSubChunkPtrArray;
46 ::ll::TypedStorage<1, 48, bool[3][4][4]> mSubChunkTouched;
47 ::ll::TypedStorage<8, 8, ::ChunkPos> mCenterChunkPos;
48 ::ll::TypedStorage<8, 8, uint64> mCenterSubChunkIndex;
49 ::ll::TypedStorage<1, 1, bool> mOriginalLighting;
50 ::ll::TypedStorage<1, 1, bool> mIsClientSide;
51 ::ll::TypedStorage<1, 1, ::SubChunkBrightnessStorage::LightPair> mDefaultLightPair;
52 // NOLINTEND
53
54public:
55 // prevent constructor by default
56 SubChunkRelighter();
57
58public:
59 // member functions
60 // NOLINTBEGIN
61 MCAPI SubChunkRelighter(
62 ::IBlockSource& source,
63 uint64 centerSubChunkIndex,
64 ::ChunkPos const& centerChunkPos,
65 bool isClientSide,
66 bool originalLighting,
67 bool useFullyDarkSubchunk
68 );
69
70 MCAPI void _checkEdgeForSubtractiveBlockLightProcessing(::SubChunkLightIndex const& coordIndex);
71
72 MCAPI void _checkEdgeForSubtractiveSkyLightProcessing(::SubChunkLightIndex const& coordIndex);
73
74 MCAPI ::SubChunk* _dirtySubChunk(::SubChunkLightIndex const coordIndex, uint& subChunkIndex);
75
76 MCAPI ::SubChunk*
77 _getBlock(::SubChunkLightIndex coordIndex, ::Block const*& block, ::Block const*& extraBlock) const;
78
79 MCAPI ::SubChunk* _getBlock(
80 ::SubChunkLightIndex const coordIndex,
81 ::Block const*& block,
82 ::Block const*& extraBlock,
83 uint& subChunkIndex
84 ) const;
85
86#ifdef LL_PLAT_S
87 MCAPI void _propagateBlockLight();
88
89 MCAPI void _propagateSkyLight();
90
91 MCAPI void _propagateSubtractiveBlockLight();
92
93 MCAPI void _propagateSubtractiveSkyLight(bool shouldCheckForIgnoredAbsorptionValues);
94#endif
95
96 MCAPI void _setLightHelper(
97 ::SubChunkLightIndex coordIndex,
98 ::Brightness oldBrightness,
99 ::Brightness newBrightness,
100 ::Brightness oldAbsorption,
101 ::Brightness newAbsorption,
102 uint lightType,
103 uint subChunkIndex
104 );
105
106 MCAPI void _setPropagatedBlockLightValue(::SubChunkLightIndex coordIndex, uchar brightness);
107
108 MCAPI void _setPropagatedSkyLightValue(::SubChunkLightIndex coordIndex, uchar brightness);
109
110 MCAPI void _setSkyLight(
111 ::SubChunkLightIndex coordIndex,
112 ::Brightness oldBrightness,
113 ::Brightness newBrightness,
114 ::Brightness oldAbsorption,
115 ::Brightness newAbsorption
116 );
117
118 MCAPI ::SubChunkBrightnessStorage::LightPair getLightPair(::Pos const& coord) const;
119
120 MCAPI ::SubChunkBrightnessStorage::LightPair getLightPairWithPlaceholderCheck(
121 ::Pos const& coord,
122 ::SubChunkBrightnessStorage::LightPair const& defaultLightPairIfPlaceholderSubChunk
123 ) const;
124
125#ifdef LL_PLAT_C
126 MCAPI void relightSubChunk(
127 ::LevelChunk const& levelChunk,
128 ::std::vector<::SubChunkLightUpdate> const& alteredBlockList,
129 ::std::vector<::BlockPos>& brightnessChangedList
130 );
131
132 MCAPI void update(::BlockPos const&, uint64);
133#endif
134
135 MCAPI ~SubChunkRelighter();
136 // NOLINTEND
137
138public:
139 // static functions
140 // NOLINTBEGIN
141 MCAPI static void initializeStatics();
142
143 MCAPI static void shutdownStatics();
144 // NOLINTEND
145
146public:
147 // static variables
148 // NOLINTBEGIN
149 MCAPI static ::std::bitset<196608>& mAllSubChunkBorderBitsExceptTheOuterEdgeOfComputationBits();
150
151 MCAPI static ::std::bitset<196608>& mOuterEdgeOfComputationBits();
152
153 MCAPI static ::SpinLockImpl& sDarkSpinLock();
154
155 MCAPI static ::std::unique_ptr<::SubChunk>& sFullyDarkSubChunk();
156
157 MCAPI static ::std::unique_ptr<::SubChunk>& sFullyLitSubChunk();
158
159 MCAPI static ::SpinLockImpl& sLitSpinLock();
160 // NOLINTEND
161
162public:
163 // constructor thunks
164 // NOLINTBEGIN
165 MCAPI void* $ctor(
166 ::IBlockSource& source,
167 uint64 centerSubChunkIndex,
168 ::ChunkPos const& centerChunkPos,
169 bool isClientSide,
170 bool originalLighting,
171 bool useFullyDarkSubchunk
172 );
173 // NOLINTEND
174
175public:
176 // destructor thunk
177 // NOLINTBEGIN
178 MCAPI void $dtor();
179 // NOLINTEND
180};
Definition BlockPos.h:21
Definition Block.h:41
Definition ChunkPos.h:12
Definition IBlockSource.h:39
Definition LevelChunk.h:75
Definition Pos.h:5
Definition SpinLockImpl.h:5
Definition Brightness.h:8
Definition SubChunkBrightnessStorage.h:13
Definition SubChunkLightIndex.h:5
Definition SubChunkLightUpdate.h:9
Definition SubChunk.h:25
Definition SubtractiveLightInfo.h:9