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