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