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 coordIndex, uint& subChunkIndex);
75
76 MCAPI ::SubChunk* _getAbsorption(
77 ::SubChunkLightIndex coordIndex,
78 uchar& absorption,
79 uint& subChunkIndex,
80 bool shouldCheckSkyLightInclusion
81 );
82
83 MCAPI ::SubChunk*
84 _getBlock(::SubChunkLightIndex coordIndex, ::Block const*& block, ::Block const*& extraBlock) const;
85
86 MCAPI ::SubChunk* _getBlock(
87 ::SubChunkLightIndex coordIndex,
88 ::Block const*& block,
89 ::Block const*& extraBlock,
90 uint& subChunkIndex
91 ) const;
92
93 MCAPI void _propagateBlockLight();
94
95 MCAPI void _propagateBlockLight(::SubChunkLightIndex coordIndex, uchar brightness);
96
97 MCAPI void _propagateSkyLight();
98
99 MCAPI void _propagateSkyLight(::SubChunkLightIndex coordIndex, uchar brightness);
100
101 MCAPI void _propagateSubtractiveBlockLight();
102
103 MCAPI void _propagateSubtractiveBlockLight(::SubChunkLightIndex coordIndex, uchar effectiveBrightness);
104
105 MCAPI void _propagateSubtractiveSkyLight(bool shouldCheckForIgnoredAbsorptionValues);
106
107 MCAPI void _propagateSubtractiveSkyLight(::SubChunkLightIndex coordIndex, uchar effectiveBrightness);
108
109 MCAPI void _setLightHelper(
110 ::SubChunkLightIndex coordIndex,
111 ::Brightness oldBrightness,
112 ::Brightness newBrightness,
113 ::Brightness oldAbsorption,
114 ::Brightness newAbsorption,
115 uint lightType,
116 uint subChunkIndex
117 );
118
119 MCAPI void _setPropagatedBlockLightValue(::SubChunkLightIndex coordIndex, uchar brightness);
120
121 MCAPI void _setPropagatedSkyLightValue(::SubChunkLightIndex coordIndex, uchar brightness);
122
123 MCAPI void _setSkyLight(
124 ::SubChunkLightIndex coordIndex,
125 ::Brightness oldBrightness,
126 ::Brightness newBrightness,
127 ::Brightness oldAbsorption,
128 ::Brightness newAbsorption
129 );
130
131 MCAPI void getBlock(::Pos const& pos, ::Block const*& block, ::Block const*& extraBlock);
132
133 MCAPI ::Pos getCentralSubchunkOrigin();
134
135 MCAPI ::SubChunkBrightnessStorage::LightPair getLightPair(::Pos const& coord) const;
136
137 MCAPI ::SubChunkBrightnessStorage::LightPair getLightPairWithPlaceholderCheck(
138 ::Pos const& coord,
139 ::SubChunkBrightnessStorage::LightPair const& defaultLightPairIfPlaceholderSubChunk
140 ) const;
141
142 MCAPI void getTouchedSubChunks(::std::vector<::Pos>& subChunkPosList);
143
144 MCAPI void relightSubChunk(
145 ::LevelChunk const& levelChunk,
146 ::std::vector<::SubChunkLightUpdate> const& alteredBlockList,
147 ::std::vector<::BlockPos>& brightnessChangedList
148 );
149
150 MCAPI void setBlockLight(
151 ::Pos const& pos,
152 ::Brightness oldBrightness,
153 ::Brightness newBrightness,
154 ::Brightness oldAbsorption,
155 ::Brightness newAbsorption
156 );
157
158 MCAPI void setSkyLight(
159 ::Pos const& pos,
160 ::Brightness oldBrightness,
161 ::Brightness newBrightness,
162 ::Brightness oldAbsorption,
163 ::Brightness newAbsorption
164 );
165
166 MCAPI void update(::BlockPos const&, uint64);
167
168 MCAPI ~SubChunkRelighter();
169 // NOLINTEND
170
171public:
172 // static functions
173 // NOLINTBEGIN
174 MCAPI static void initializeStatics();
175
176 MCAPI static void shutdownStatics();
177 // NOLINTEND
178
179public:
180 // static variables
181 // NOLINTBEGIN
182 MCAPI static ::std::bitset<196608>& mAllSubChunkBorderBitsExceptTheOuterEdgeOfComputationBits();
183
184 MCAPI static ::std::bitset<196608>& mOuterEdgeOfComputationBits();
185
186 MCAPI static ::SpinLockImpl& sDarkSpinLock();
187
188 MCAPI static ::std::unique_ptr<::SubChunk>& sFullyDarkSubChunk();
189
190 MCAPI static ::std::unique_ptr<::SubChunk>& sFullyLitSubChunk();
191
192 MCAPI static ::SpinLockImpl& sLitSpinLock();
193 // NOLINTEND
194
195public:
196 // constructor thunks
197 // NOLINTBEGIN
198 MCAPI void* $ctor(
199 ::IBlockSource& source,
200 uint64 centerSubChunkIndex,
201 ::ChunkPos const& centerChunkPos,
202 bool isClientSide,
203 bool originalLighting,
204 bool useFullyDarkSubchunk
205 );
206 // NOLINTEND
207
208public:
209 // destructor thunk
210 // NOLINTBEGIN
211 MCAPI void $dtor();
212 // NOLINTEND
213};
Definition BlockPos.h:21
Definition Block.h:69
Definition ChunkPos.h:11
Definition IBlockSource.h:38
Definition LevelChunk.h:87
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:28
Definition SubtractiveLightInfo.h:9