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