LeviLamina
Loading...
Searching...
No Matches
BlockGraphics.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/client/renderer/texture/IsotropicFaceData.h"
7#include "mc/common/WeakPtr.h"
8#include "mc/world/level/block/BlockRenderLayer.h"
9#include "mc/world/level/block/BlockShape.h"
10#include "mc/world/phys/AABB.h"
11
12// auto generated forward declare list
13// clang-format off
15class Block;
16class BlockPos;
17class BlockSource;
18class BlockType;
19class Experiments;
20class HashedString;
23class SemVersion;
25class Vec3;
26struct TextureItem;
28namespace Bedrock::Threading { class Mutex; }
29namespace BlockGeometry { struct Model; }
30namespace BlockTessellationFallbackUtils { struct TessellationConfigInfo; }
31namespace ClientBlockPipeline { struct TextureUVs; }
32namespace Json { class Value; }
33namespace Json { class ValueIterator; }
34// clang-format on
35
36class BlockGraphics {
37public:
38 // BlockGraphics inner types declare
39 // clang-format off
40 struct ConstructorToken;
41 // clang-format on
42
43 // BlockGraphics inner types define
44 struct ConstructorToken {};
45
46 using BlockDataValuesMap = ::std::unordered_map<::HashedString, ::std::vector<::Json::Value>>;
47
48 using BlockTessellationInfoMap =
49 ::std::unordered_map<::HashedString, ::BlockTessellationFallbackUtils::TessellationConfigInfo>;
50
51public:
52 // member variables
53 // NOLINTBEGIN
54 ::ll::TypedStorage<8, 8, ::Block const*> mBlock;
55 ::ll::TypedStorage<4, 4, ::BlockShape> mBlockShape;
56 ::ll::TypedStorage<4, 4, float> mAmbientOcclusionExponent;
57 ::ll::TypedStorage<1, 1, bool> mFancy;
58 ::ll::TypedStorage<1, 1, bool> mAllowSame;
59 ::ll::TypedStorage<1, 1, ::BlockRenderLayer> mRenderLayer;
60 ::ll::TypedStorage<1, 1, ::IsotropicFaceData> mIsotropicFaceData;
61 ::ll::TypedStorage<8, 32, ::std::string> mSoundType;
62 ::ll::TypedStorage<4, 24, ::AABB> mVisualShape;
63 ::ll::TypedStorage<8, 24, ::std::vector<::TextureItem>> mTextureItems;
64 ::ll::TypedStorage<8, 8, uint64> mIconTextureIndex;
65 // NOLINTEND
66
67public:
68 // prevent constructor by default
69 BlockGraphics();
70
71public:
72 // virtual functions
73 // NOLINTBEGIN
74 virtual ~BlockGraphics();
75
76 virtual ::BlockRenderLayer getRenderLayer(::BlockSource&, ::BlockPos const&) const;
77
78 virtual int getColor(int) const;
79
80 virtual int getColor(::BlockSource&, ::BlockPos const&) const;
81
82 virtual bool isSeasonTinted(::BlockSource&, ::BlockPos const&) const;
83
84 virtual void onGraphicsModeChanged(bool fancy, bool fancyBubbles);
85
86 virtual int getExtraRenderLayers();
87
88 virtual ::TextureUVCoordinateSet const& getCarriedTexture(uint64 textureSlot, int blockVariant) const;
89
90 virtual void setVisualShape(::AABB const& shape);
91
92 virtual void setVisualShape(::Vec3 const& min, ::Vec3 const& max);
93 // NOLINTEND
94
95public:
96 // member functions
97 // NOLINTBEGIN
98 MCAPI explicit BlockGraphics(::std::string const& nameId);
99
100 MCAPI void _logBlockTextureError(::fmt::v11::fstring<char const*> const& error) const;
101
102 MCFOLD float getAmbientOcclusionExponent() const;
103
104 MCAPI ::TextureAtlasItem const& getAtlasItem(uint64 textureSlot) const;
105
106 MCFOLD ::Block const* getBlock() const;
107
108 MCFOLD ::BlockShape getBlockShape() const;
109
110 MCAPI ::std::string const getDefaultTextureName(uint64 textureSlot) const;
111
112 MCAPI ::TextureUVCoordinateSet const& getIconTexture(int blockVariant) const;
113
114 MCFOLD ::BlockRenderLayer getRenderLayer() const;
115
116 MCFOLD ::std::string const& getSoundType() const;
117
118 MCAPI ::TextureUVCoordinateSet const& getTexture(uint64 textureSlot, int blockVariant) const;
119
120 MCAPI ::TextureUVCoordinateSet const& getTexture(::BlockPos const& p, uint64 textureSlot, int blockVariant) const;
121
122 MCAPI ::std::vector<::TextureUVCoordinateSet> const&
123 getTextureDefaultVariations(uint64 textureSlot, int blockVariant) const;
124
125 MCAPI bool isFull() const;
126
127 MCAPI bool isFullAndOpaque() const;
128
129 MCAPI bool isValid() const;
130
131 MCAPI ::BlockGraphics& setCarriedTextureItem(
132 ::std::string const& nameUp,
133 ::std::string const& nameDown,
134 ::std::string const& nameNorth,
135 ::std::string const& nameSouth,
136 ::std::string const& nameWest,
137 ::std::string const& nameEast
138 );
139
140 MCAPI void setDefaultCarriedTextures();
141
142 MCFOLD void setSoundType(::std::string type);
143
144 MCAPI ::BlockGraphics& setTextureItem(
145 ::std::string const& nameUp,
146 ::std::string const& nameDown,
147 ::std::string const& nameNorth,
148 ::std::string const& nameSouth,
149 ::std::string const& nameWest,
150 ::std::string const& nameEast
151 );
152 // NOLINTEND
153
154public:
155 // static functions
156 // NOLINTBEGIN
157 MCAPI static void _extractComplexAliasBlockData(
158 ::HashedString const& blockName,
159 ::Json::Value const& member,
160 ::std::unordered_map<::HashedString, ::std::vector<::Json::Value>>& output,
161 ::std::vector<::WeakPtr<::BlockType>>& blockTypes
162 );
163
164 MCAPI static void _initBlockModels(::ResourcePackManager& packManager);
165
166 MCAPI static ::TextureUVCoordinateSet const&
167 chooseRandomTexture(float random, ::std::vector<::TextureUVCoordinateSet> const& uvsets);
168
169 MCAPI static uint64
170 chooseRandomTextureIndex(float random, ::std::vector<::ClientBlockPipeline::TextureUVs> const& uvsets);
171
172 MCAPI static ::BlockGraphics* createBlockGraphics(::HashedString const& name, ::BlockShape defaultBlockShape);
173
174 MCAPI static void detectAndRegisterTessellationFallbacks(
175 ::std::unordered_map<::HashedString, ::BlockTessellationFallbackUtils::TessellationConfigInfo>&
176 blockTessellationInfoMap
177 );
178
179 MCAPI static void disableBlockType(::BlockType const& blockType);
180
181 MCAPI static ::std::vector<::WeakPtr<::BlockType>> extractBlockDataValues(
182 ::Json::ValueIterator const& memberIterator,
183 ::std::unordered_map<::HashedString, ::std::vector<::Json::Value>>& output,
184 ::SemVersion const& formatVersion
185 );
186
187 MCAPI static void extractBlockDataValuesFromFileContents(
188 ::Experiments const& experiments,
189 ::std::vector<::LoadedResourceData> const& contents,
190 ::std::unordered_map<::HashedString, ::std::vector<::Json::Value>>& blockDataValuesMap,
191 ::std::unordered_map<::HashedString, ::BlockTessellationFallbackUtils::TessellationConfigInfo>&
192 blockTessellationInfoMap
193 );
194
195 MCAPI static ::std::unordered_map<uint, ::BlockGraphics*> const& getBlocks();
196
197 MCAPI static ::BlockGraphics const* getForBlock(::Block const& block);
198
199 MCAPI static ::BlockGraphics const* getForBlock(::BlockType const& block);
200
201 MCAPI static ::BlockGraphics const* getForBlock(uint blockID);
202
203 MCAPI static ::TextureAtlasItem const& getTextureItem(
204 ::std::string const& name,
205 ::std::weak_ptr<::AtlasItemManager> terrainTextureAtlas,
206 ::std::unordered_map<::std::string, ::TextureAtlasItem>& complexTextureItems
207 );
208
209 MCAPI static ::TextureUVCoordinateSet
210 getTextureUVCoordinateSet(::std::string const& name, int blockVariant, int textureVariant);
211
212 MCAPI static bool hasOldTessellationFallback(::Block const& block);
213
214 MCAPI static void initBlocks(::ResourcePackManager& packManager, ::Experiments const& experiments);
215
216 MCAPI static bool isFullAndOpaque(::Block const& block);
217
218 MCAPI static bool isInitialized();
219
220 MCAPI static ::SemVersion loadBlockDataFormatVersion(::Json::Value const& root);
221
222 MCAPI static ::BlockGraphics& registerBlockGraphics(
223 ::std::unordered_map<::HashedString, ::std::vector<::Json::Value>>& blockDataValuesMap,
224 ::HashedString const& name,
225 ::BlockShape defaultBlockShape
226 );
227
228 MCAPI static void
229 registerLooseBlockGraphics(::std::unordered_map<::HashedString, ::std::vector<::Json::Value>>& blockDataValuesMap);
230
231 MCAPI static void setAtlasItemManager(::std::shared_ptr<::AtlasItemManager> atlasItemManager);
232
233 MCAPI static bool setBlockShape(::BlockGraphics& block, ::Json::Value const& blockShapeData);
234
235 MCAPI static bool setCarriedTextures(::BlockGraphics& block, ::Json::Value const& textureData);
236
237 MCAPI static bool setTextures(::BlockGraphics& block, ::Json::Value const& textureData);
238
239 MCAPI static void teardownBlocks();
240 // NOLINTEND
241
242public:
243 // static variables
244 // NOLINTBEGIN
245 MCAPI static ::std::string const& NORMAL_SOUND();
246
247 MCAPI static ::std::unordered_map<::std::string, ::BlockGraphics*>& mBlockLookupMap();
248
249 MCAPI static ::Bedrock::Threading::Mutex& mBlockModelAccess();
250
251 MCAPI static ::std::unordered_map<uint, ::BlockGraphics*>& mBlocks();
252
253 MCAPI static ::std::unique_ptr<::BlockGraphics>& mDummyBlock();
254
255 MCAPI static bool& mInitialized();
256
257 MCAPI static ::std::map<::std::string, ::std::unique_ptr<::BlockGeometry::Model>>& mModels();
258
259 MCAPI static ::std::vector<::std::unique_ptr<::BlockGraphics>>& mOwnedBlocks();
260
261 MCAPI static ::std::weak_ptr<::AtlasItemManager>& mTerrainTextureAtlas();
262
263 MCAPI static ::std::unordered_set<uint>& mVanillaBlocksWithFallbackToOldTessellation();
264
265 MCAPI static ::std::unordered_map<::std::string, ::TextureAtlasItem>& sComplexTextureItems();
266 // NOLINTEND
267
268public:
269 // constructor thunks
270 // NOLINTBEGIN
271 MCAPI void* $ctor(::std::string const& nameId);
272 // NOLINTEND
273
274public:
275 // destructor thunk
276 // NOLINTBEGIN
277 MCAPI void $dtor();
278 // NOLINTEND
279
280public:
281 // virtual function thunks
282 // NOLINTBEGIN
283 MCFOLD ::BlockRenderLayer $getRenderLayer(::BlockSource&, ::BlockPos const&) const;
284
285 MCFOLD int $getColor(int) const;
286
287 MCFOLD int $getColor(::BlockSource&, ::BlockPos const&) const;
288
289 MCFOLD bool $isSeasonTinted(::BlockSource&, ::BlockPos const&) const;
290
291 MCAPI void $onGraphicsModeChanged(bool fancy, bool fancyBubbles);
292
293 MCFOLD int $getExtraRenderLayers();
294
295 MCAPI ::TextureUVCoordinateSet const& $getCarriedTexture(uint64 textureSlot, int blockVariant) const;
296
297 MCAPI void $setVisualShape(::AABB const& shape);
298
299 MCAPI void $setVisualShape(::Vec3 const& min, ::Vec3 const& max);
300 // NOLINTEND
301
302public:
303 // vftables
304 // NOLINTBEGIN
305 MCNAPI static void** $vftable();
306 // NOLINTEND
307};
Definition AtlasItemManager.h:5
Definition Mutex.h:10
Definition BlockGraphics.h:5
static MCAPI void ** $vftable()
Definition BlockPos.h:21
Definition BlockSource.h:73
Definition BlockType.h:84
Definition Block.h:69
Definition Experiments.h:14
Definition HashedString.h:5
Definition ValueIterator.h:16
Definition Value.h:16
Definition LoadedResourceData.h:5
Definition ResourcePackManager.h:35
Definition SemVersion.h:15
Definition TextureAtlasItem.h:5
Definition Vec3.h:10
Definition Model.h:7
Definition BlockGraphics.h:13
Definition TessellationConfigInfo.h:7
Definition TextureUVs.h:7
Definition TextureItem.h:5
Definition TextureUVCoordinateSet.h:5