LeviLamina
Loading...
Searching...
No Matches
TextureAtlas.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/client/renderer/ImageResourceManager.h"
7#include "mc/client/renderer/texture/AtlasParameters.h"
8#include "mc/client/renderer/texture/ParsedAtlasData.h"
9#include "mc/client/renderer/texture/TextureAtlasStatus.h"
10#include "mc/deps/core/resource/ResourceLocation.h"
11#include "mc/deps/core/utility/EnableNonOwnerReferences.h"
12#include "mc/deps/core/utility/NonOwnerPointer.h"
13#include "mc/deps/core_graphics/MipMapSupport.h"
14#include "mc/deps/core_graphics/TextureAtlas.h"
15
16// auto generated forward declare list
17// clang-format off
23struct ParsedAtlasNode;
28namespace Json { class Value; }
29namespace cg { class ImageBuffer; }
30namespace cg { class TextureSetImageContainer; }
31namespace mce { class Color; }
32namespace mce { class FileWatcherHandle; }
33namespace mce { class TextureGroup; }
34namespace mce::framebuilder { class PBRTextureDataManager; }
35// clang-format on
36
38public:
39 // TextureAtlas inner types define
40 using SourceImageBuffers = ::std::unordered_map<::ResourceLocation, ::cg::TextureSetImageContainer>;
41
42 using TextureAtlasTiles = ::std::vector<::TextureAtlasTile>;
43
44 using StatusCallback = ::std::function<void(::TextureAtlasStatus const&)>;
45
46 using ImageAtlasFinishedCallback = ::std::function<void()> const;
47
48 using RuntimeImageGenerators = ::std::vector<::std::weak_ptr<::RuntimeImageGeneratorInfo>>;
49
50 using SourceImagesSignature = void(::std::unordered_map<::ResourceLocation, ::cg::TextureSetImageContainer> const&);
51
52public:
53 // member variables
54 // NOLINTBEGIN
55 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::AtlasItemManager>> mAtlasItemManager;
56 ::ll::TypedStorage<8, 240, ::ParsedAtlasData> mParsedAtlasData;
57 ::ll::TypedStorage<4, 4, ::AtlasParameters> mAtlasParameters;
58 ::ll::TypedStorage<8, 16, ::std::set<::ResourceLocation>> mResources;
59 ::ll::TypedStorage<8, 64, ::ImageResourceManager> mResourceManager;
60 ::ll::TypedStorage<8, 24, ::std::vector<::mce::FileWatcherHandle>> mFileWatcherHandle;
61 ::ll::TypedStorage<8, 24, ::std::vector<::std::weak_ptr<::RuntimeImageGeneratorInfo>>> mRuntimeImageGenerators;
62 ::ll::TypedStorage<8, 88, ::cg::TextureAtlas> mTextureAtlas;
63 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::mce::framebuilder::PBRTextureDataManager>>
64 mPBRTextureDataManager;
65 // NOLINTEND
66
67public:
68 // prevent constructor by default
69 TextureAtlas();
70
71public:
72 // virtual functions
73 // NOLINTBEGIN
74 virtual ~TextureAtlas() /*override*/;
75 // NOLINTEND
76
77public:
78 // member functions
79 // NOLINTBEGIN
80 MCAPI TextureAtlas(
81 ::ResourceLocation const& metaFile,
82 ::Bedrock::NonOwnerPointer<::mce::framebuilder::PBRTextureDataManager> pbrTextureDataManager
83 );
84
85 MCAPI void _addElementCollection(
86 ::ResourcePackManager& resourcePackManager,
87 ::std::shared_ptr<::mce::TextureGroup> textureGroup,
88 ::Json::Value const& texture,
89 ::ParsedAtlasNode& newNode,
90 int atIndex,
91 float mipFadeAmount,
92 ::mce::Color const& mipFadeColor,
93 bool isAdditive
94 );
95
96 MCAPI ::TextureAtlasTile* _addTile(
97 ::std::vector<::TextureAtlasTile>& textureAtlasTiles,
98 bool quad,
99 float fadePerMipAmount,
100 ::ParsedAtlasNodeElement& element
101 );
102
103 MCAPI void _calculateAtlasTilesDimensions(
104 ::AbstractTextureAccessor& textureAccessor,
105 ::std::vector<::TextureAtlasTile>& textureAtlasTiles,
106 uint maxTileDimension
107 );
108
109 MCAPI ::TextureAtlasResourceCallbacks _createAtlas(
110 ::Json::Value const& root,
111 ::std::function<void(::TextureAtlasStatus const&)> statusCallback,
112 ::std::function<void()> imageAtlasFinishedCallback,
113 ::std::shared_ptr<::mce::TextureGroup> textureGroup,
114 ::cg::MipMapSupport mipMapSupport,
115 ::ResourcePackManager& resourcePackManager,
116 ::std::shared_ptr<::cg::ImageBuffer> outCopyOfFinalImage,
117 ::std::shared_ptr<::std::unordered_map<::ResourceLocation, ::cg::TextureSetImageContainer>>
118 outCopyOfSourceImages
119 );
120
121 MCAPI ::std::vector<::TextureAtlasTile> _generateAtlasTileList();
122
123 MCAPI void _loadAtlasNodes(
124 ::ResourcePackManager& resourcePackManager,
125 ::Json::Value const& root,
126 ::std::vector<::ParsedAtlasNode>& atlasNodes,
127 ::std::shared_ptr<::mce::TextureGroup> textureGroup
128 );
129
130 MCAPI void _loadRuntimeImageAtlasNodes(::std::vector<::ParsedAtlasNode>& atlasNodes);
131
132 MCAPI bool _readNode(
133 ::ResourcePackManager& resourcePackManager,
134 ::std::shared_ptr<::mce::TextureGroup> textureGroup,
135 ::Json::Value const& jsonNode,
136 ::ParsedAtlasNode& node,
137 bool isRefreshing
138 );
139
140 MCAPI void addRuntimeImageGenerator(::std::weak_ptr<::RuntimeImageGeneratorInfo> info);
141
142 MCAPI ::TextureAtlasResourceCallbacks createAtlasFromJson(
143 ::Json::Value const& json,
144 ::ResourcePackManager& resourcePackManager,
145 ::std::function<void(::TextureAtlasStatus const&)> statusCallback,
146 ::std::function<void()> imageAtlasFinishedCallback,
147 ::std::shared_ptr<::mce::TextureGroup> textureGroup,
148 ::cg::MipMapSupport mipMapSupport,
149 ::std::shared_ptr<::cg::ImageBuffer> outCopyOfFinalImage,
150 ::std::shared_ptr<::std::unordered_map<::ResourceLocation, ::cg::TextureSetImageContainer>>
151 outCopyOfSourceImages
152 );
153
154 MCAPI ::TextureAtlasResourceCallbacks createAtlasFromList(
155 ::std::string const& atlasName,
156 ::std::vector<::std::string> const& textures,
157 ::ResourcePackManager& resourcePackManager,
158 ::std::function<void(::TextureAtlasStatus const&)> statusCallback,
159 ::std::function<void()> imageAtlasFinishedCallback,
160 ::std::shared_ptr<::mce::TextureGroup> textureGroup,
161 ::cg::MipMapSupport mipMapSupport,
162 ::std::shared_ptr<::cg::ImageBuffer> outCopyOfFinalImage,
163 ::std::shared_ptr<::std::unordered_map<::ResourceLocation, ::cg::TextureSetImageContainer>>
164 outCopyOfSourceImages
165 );
166
167 MCAPI uint getColorMipCount() const;
168
169 MCAPI ::ResourceLocation const& getPathFromName(::std::string const& name) const;
170
171 MCAPI ::TextureAtlasItem const& getTextureItem(::std::string const& textureName) const;
172
173 MCAPI ::TextureAtlasItemTextureSetTranslation const& getTextureItemTextureSetTranslation(int index) const;
174
175 MCAPI uint64 getUsedMemory() const;
176
177 MCAPI ::TextureAtlasResourceCallbacks loadMetaFile(
178 ::ResourcePackManager& resourcePackManager,
179 ::std::function<void(::TextureAtlasStatus const&)> statusCallback,
180 ::std::function<void()> imageAtlasFinishedCallback,
181 ::std::shared_ptr<::mce::TextureGroup> textureGroup,
182 ::cg::MipMapSupport mipMapSupport,
183 ::std::shared_ptr<::cg::ImageBuffer> outCopyOfFinalImage,
184 ::std::shared_ptr<::std::unordered_map<::ResourceLocation, ::cg::TextureSetImageContainer>>
185 outCopyOfSourceImages
186 );
187
188 MCAPI ::TextureAtlasResourceCallbacks recreateAtlas(
189 ::std::shared_ptr<::mce::TextureGroup> textureGroup,
190 ::std::function<void(::TextureAtlasStatus const&)> statusCallback,
191 ::std::function<void()> imageAtlasFinishedCallback,
192 ::cg::MipMapSupport mipMapSupport,
193 ::std::shared_ptr<::cg::ImageBuffer> outCopyOfFinalImage,
194 ::std::shared_ptr<::std::unordered_map<::ResourceLocation, ::cg::TextureSetImageContainer>>
195 outCopyOfSourceImages
196 );
197 // NOLINTEND
198
199public:
200 // constructor thunks
201 // NOLINTBEGIN
202 MCAPI void* $ctor(
203 ::ResourceLocation const& metaFile,
204 ::Bedrock::NonOwnerPointer<::mce::framebuilder::PBRTextureDataManager> pbrTextureDataManager
205 );
206 // NOLINTEND
207
208public:
209 // destructor thunk
210 // NOLINTBEGIN
211 MCAPI void $dtor();
212 // NOLINTEND
213
214public:
215 // vftables
216 // NOLINTBEGIN
217 MCNAPI static void** $vftable();
218 // NOLINTEND
219};
Definition AbstractTextureAccessor.h:5
Definition AtlasItemManager.h:5
Definition EnableNonOwnerReferences.h:7
Definition Value.h:16
Definition ResourcePackManager.h:35
Definition TextureAtlasItem.h:5
Definition TextureAtlasTile.h:5
Definition TextureAtlas.h:5
static MCAPI void ** $vftable()
Definition ImageBuffer.h:16
Definition TextureSetImageContainer.h:20
Definition Color.h:13
Definition FileWatcherHandle.h:12
Definition TextureGroup.h:7
Definition PBRTextureDataManager.h:7
Definition ParsedAtlasNodeElement.h:5
Definition ParsedAtlasNode.h:5
Definition RuntimeImageGeneratorInfo.h:5
Definition TextureAtlasItemTextureSetTranslation.h:5
Definition TextureAtlasResourceCallbacks.h:5