LeviLamina
Loading...
Searching...
No Matches
TextureGroup.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/client/model/models/AsyncCachedTextureLoader.h"
7#include "mc/client/renderer/ImageBufferResourceManager.h"
8#include "mc/client/renderer/ImageCacheMode.h"
9#include "mc/client/renderer/TextureLoadMode.h"
10#include "mc/deps/core/resource/ResourceFileSystem.h"
11#include "mc/deps/core/resource/ResourceLocation.h"
12#include "mc/deps/core/threading/Async.h"
13#include "mc/deps/core/threading/CountTracker.h"
14#include "mc/deps/core/threading/SharedAsync.h"
15#include "mc/deps/core/utility/EnableNonOwnerReferences.h"
16#include "mc/deps/core/utility/NonOwnerPointer.h"
17#include "mc/deps/core_graphics/ImageBuffer.h"
18#include "mc/deps/core_graphics/TextureSetLayerType.h"
19#include "mc/deps/minecraft_renderer/renderer/IsMissingTexture.h"
20#include "mc/deps/minecraft_renderer/renderer/TextureGroupBase.h"
21#include "mc/resources/ResourceLoadType.h"
22#include "mc/util/texture_set_helpers/TextureSetDefinitionLoader.h"
23
24// auto generated forward declare list
25// clang-format off
26class BedrockTexture;
31namespace cg { class TextureSetDefinition; }
32namespace cg { class TextureSetImageDescription; }
33namespace mce { class ImageResourceLoader; }
34namespace mce { class LRUCache; }
35namespace mce { class TextureContainer; }
36namespace mce { class TexturePtr; }
37namespace mce { struct TextureDescription; }
38namespace mce { struct TextureResourceService; }
39// clang-format on
40
41namespace mce {
42
43class TextureGroup : public ::Bedrock::EnableNonOwnerReferences, public ::mce::TextureGroupBase {
44public:
45 // TextureGroup inner types define
46 using LoadResult = ::Bedrock::Threading::Async<void>;
47
48 using TextureMap = ::std::map<::ResourceLocation, ::BedrockTexture>;
49
50 using TextureLoadKey = ::std::pair<::ResourceLocation, ::TextureLoadMode>;
51
52public:
53 // member variables
54 // NOLINTBEGIN
55 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::IAdvancedGraphicsOptions>> mAdvancedGraphicsOptions;
56 ::ll::TypedStorage<8, 352, ::AsyncCachedTextureLoader> mAsyncTextureLoader;
57 ::ll::TypedStorage<8, 16, ::std::map<::ResourceLocation, ::BedrockTexture>> mLoadedTextures;
58 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::ResourceLoadManager>> mResourceLoadManager;
59 ::ll::TypedStorage<8, 8, ::mce::TextureResourceService&> mResourceService;
60 ::ll::TypedStorage<8, 48, ::cg::ImageBuffer const> mMissingTexture;
61 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::mce::ImageResourceLoader>> mImageResourceLoader;
62 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::TextureSetHelpers::TextureSetDefinitionLoader::ResourceHelper>>
63 mTextureSetResourceHelper;
64 ::ll::TypedStorage<8, 16, ::std::map<::ResourceLocation, ::std::optional<uint>>> mTouchedTextures;
65 ::ll::TypedStorage<8, 16, ::ImageBufferResourceManager> mImageBufferCache;
66 ::ll::TypedStorage<8, 8, ::std::unique_ptr<::mce::LRUCache>> mLRUCache;
67 ::ll::TypedStorage<
68 8,
69 16,
70 ::std::map<::std::pair<::ResourceLocation, ::TextureLoadMode>, ::Bedrock::Threading::SharedAsync<void>>>
71 mLoadQueueResults;
72 ::ll::TypedStorage<8, 16, ::Bedrock::Threading::Async<void>> mQueueLoadResultCoroutine;
73 ::ll::TypedStorage<8, 16, ::Bedrock::Threading::CountTracker> mPendingLoadTaskCounter;
74 ::ll::TypedStorage<8, 8, ::std::atomic<uint64>> mOutstandingTaskMemory;
75 ::ll::TypedStorage<8, 8, ::std::atomic<uint64>> mOutstandingTaskCount;
76 // NOLINTEND
77
78public:
79 // prevent constructor by default
80 TextureGroup& operator=(TextureGroup const&);
81 TextureGroup(TextureGroup const&);
82 TextureGroup();
83
84public:
85 // virtual functions
86 // NOLINTBEGIN
87 virtual ~TextureGroup() /*override*/;
88
89 virtual ::mce::TexturePtr getTexture(
90 ::ResourceLocation const& resourceLocation,
91 bool const forceReload,
92 ::std::optional<uint> optLoadOrder,
93 ::cg::TextureSetLayerType const textureType
94 ) /*override*/;
95 // NOLINTEND
96
97public:
98 // member functions
99 // NOLINTBEGIN
100 MCAPI TextureGroup(
101 ::Bedrock::NotNullNonOwnerPtr<::IAdvancedGraphicsOptions> advancedGraphicsOptions,
102 ::Bedrock::NotNullNonOwnerPtr<::ResourceLoadManager> resourceLoadManager,
103 ::mce::TextureResourceService& textureResourceService
104 );
105
106 MCAPI TextureGroup(
107 ::Bedrock::NotNullNonOwnerPtr<::IAdvancedGraphicsOptions> advancedGraphicsOptions,
108 ::Bedrock::NotNullNonOwnerPtr<::ResourceLoadManager> resourceLoadManager,
109 ::mce::TextureResourceService& textureResourceService,
110 ::std::shared_ptr<::mce::ImageResourceLoader> imageResourceLoader
111 );
112
113 MCAPI void _loadTextureAsyncUrgentlyIfTouched(
114 ::std::pair<::ResourceLocation, ::TextureLoadMode> const& textureLoadKey,
115 ::std::optional<::ResourceLoadType> optionalLoadType
116 );
117
118 MCAPI void _loadTexturesAsync(
119 ::gsl::span<::ResourceLocationPair> locationPairs,
120 ::std::optional<::ResourceLoadType> resourceLoadType
121 );
122
123 MCAPI void _loadTexturesSync(::gsl::span<::ResourceLocation> locations);
124
125 MCAPI void _unloadFileSystem(::ResourceFileSystem fileSystem);
126
127 MCAPI void addEmptyTexture(::ResourceLocation const& resourceLocation, int width, int height);
128
129 MCAPI void clearCPUStorage();
130
131 MCAPI void enableLRUCache(uint64 cacheSize);
132
133 MCAPI uint64 estimateMemoryUsage() const;
134
135 MCFOLD void frameUpdate();
136
137 MCAPI ::BedrockTextureData const* getBedrockTextureData(::ResourceLocation const& resourceLocation) const;
138
139 MCAPI ::cg::ImageBuffer* getCachedImage(::ResourceLocation const& resourceLocation) const;
140
141 MCAPI ::cg::ImageBuffer* getCachedImageOrLoadAsync(::ResourceLocation const& imageToLoad);
142
143 MCAPI ::cg::ImageBuffer* getCachedImageOrLoadSync(::ResourceLocation const& resourceLocation, bool forceReload);
144
145 MCAPI ::ImageBufferResourceManager getImageBufferResourceManagerCopy() const;
146
147 MCFOLD ::cg::ImageBuffer const& getMissingImageBuffer() const;
148
149 MCAPI ::cg::ImageBuffer*
150 insertImageIntoCache(::ResourceLocation const& resourceLocation, ::cg::ImageBuffer&& imageBuffer);
151
152 MCAPI bool isLoaded(
153 ::ResourceLocation const& resourceLocation,
154 bool ignoreCreation,
155 ::cg::TextureSetLayerType textureType
156 ) const;
157
158 MCAPI ::IsMissingTexture isMissingTexture(::ResourceLocation const& resourceLocation) const;
159
160 MCAPI bool isReloading() const;
161
162 MCAPI ::nonstd::expected<void, ::std::error_condition>
163 loadImageSyncAndInsertIntoCache(::ResourceLocation const& resourceLocation, bool splitAsArray);
164
165 MCAPI ::Bedrock::Threading::Async<void> loadTextureAsync(
166 ::ResourceLocation const& resourceLocation,
167 ::TextureLoadMode textureLoadMode,
168 ::std::optional<::ResourceLoadType> resourceLoadType,
169 ::std::optional<uint> optLoadOrder
170 );
171
172 MCAPI void
173 loadTexturesAsync(::gsl::span<::ResourceLocation> locations, ::std::optional<::ResourceLoadType> resourceLoadType);
174
175 MCAPI void reloadAllTextures();
176
177 MCAPI void reloadImages(
178 ::gsl::span<::ResourceLocationPair> imagesToLoadAsync,
179 ::gsl::span<::ResourceLocation> imagesToImmediatelyLoad,
180 ::std::vector<::ResourceLocation> texturesToKeep,
181 ::ImageCacheMode
182 );
183
184 MCAPI void
185 setTextureMetadata(::ResourceLocation const& resourceLocation, ::mce::TextureDescription const& textureDescription);
186
187 MCAPI void setTextureMetadata(
188 ::ResourceLocation const& resourceLocation,
189 ::gsl::not_null<::std::shared_ptr<::cg::TextureSetDefinition>> textureSetDefinition
190 );
191
192 MCAPI void setTextureMetadata(
193 ::ResourceLocation const& resourceLocation,
194 ::cg::TextureSetImageDescription const& textureSetImageDescription
195 );
196
197 MCAPI bool shouldLoadPBRResources() const;
198
199 MCAPI void touchTextureInLRUCache(::ResourceLocation const& resourceLocation);
200
201 MCAPI void trimLRUCache();
202
203 MCAPI void unloadAllTextures();
204
205 MCAPI bool unloadTexture(::ResourceLocation const& resourceLocation, bool assertOnFailure);
206
207 MCAPI ::BedrockTexture& uploadTexture(::ResourceLocation const& resourceLocation, ::cg::ImageBuffer imageBuffer);
208
209 MCAPI ::BedrockTexture& uploadTexture(
210 ::ResourceLocation const& resourceLocation,
211 ::gsl::not_null<::std::shared_ptr<::cg::TextureSetDefinition>> textureSetDefinition
212 );
213
214 MCAPI ::BedrockTexture& uploadTexture(
215 ::ResourceLocation const& resourceLocation,
216 ::mce::TextureContainer&& textureContainer,
217 ::std::string_view optionalIdentifier
218 );
219 // NOLINTEND
220
221public:
222 // constructor thunks
223 // NOLINTBEGIN
224 MCAPI void* $ctor(
225 ::Bedrock::NotNullNonOwnerPtr<::IAdvancedGraphicsOptions> advancedGraphicsOptions,
226 ::Bedrock::NotNullNonOwnerPtr<::ResourceLoadManager> resourceLoadManager,
227 ::mce::TextureResourceService& textureResourceService
228 );
229
230 MCAPI void* $ctor(
231 ::Bedrock::NotNullNonOwnerPtr<::IAdvancedGraphicsOptions> advancedGraphicsOptions,
232 ::Bedrock::NotNullNonOwnerPtr<::ResourceLoadManager> resourceLoadManager,
233 ::mce::TextureResourceService& textureResourceService,
234 ::std::shared_ptr<::mce::ImageResourceLoader> imageResourceLoader
235 );
236 // NOLINTEND
237
238public:
239 // destructor thunk
240 // NOLINTBEGIN
241 MCAPI void $dtor();
242 // NOLINTEND
243
244public:
245 // virtual function thunks
246 // NOLINTBEGIN
247 MCAPI ::mce::TexturePtr $getTexture(
248 ::ResourceLocation const& resourceLocation,
249 bool const forceReload,
250 ::std::optional<uint> optLoadOrder,
251 ::cg::TextureSetLayerType const textureType
252 );
253 // NOLINTEND
254
255public:
256 // vftables
257 // NOLINTBEGIN
258 MCNAPI static void** $vftableForTextureGroupBase();
259
261 // NOLINTEND
262};
263
264} // namespace mce
Definition BedrockTexture.h:5
Definition IAdvancedGraphicsOptions.h:16
Definition ResourceLoadManager.h:19
Definition ResourceLocationPair.h:9
Definition TextureSetDefinition.h:20
Definition TextureSetImageDescription.h:18
Definition ImageResourceLoader.h:18
Definition LRUCache.h:7
Definition TextureContainer.h:7
Definition TextureGroup.h:7
static MCAPI void ** $vftableForEnableNonOwnerReferences()
static MCAPI void ** $vftableForTextureGroupBase()
Definition TexturePtr.h:7
Definition BedrockTextureData.h:5
Definition TextureDescription.h:7
Definition TextureResourceService.h:7