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/ResourceLocation.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/IsMissingTexture.h"
19#include "mc/deps/minecraft_renderer/renderer/TextureGroupBase.h"
20#include "mc/resources/ResourceLoadType.h"
21#include "mc/util/texture_set_helpers/TextureSetDefinitionLoader.h"
22
23// auto generated forward declare list
24// clang-format off
25class BedrockTexture;
30namespace cg { class TextureSetDefinition; }
31namespace mce { class ImageResourceLoader; }
32namespace mce { class LRUCache; }
33namespace mce { class TextureContainer; }
34namespace mce { class TexturePtr; }
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&);
78 TextureGroup(TextureGroup const&);
79 TextureGroup();
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 _loadTexturesSync(::gsl::span<::ResourceLocation> locations);
116
117 MCAPI bool _textureIsQueuedOrBeingLoaded(::std::pair<::ResourceLocation, ::TextureLoadMode> const& textureLoadKey);
118
119 MCAPI void addEmptyTexture(::ResourceLocation const& resourceLocation, int width, int height);
120
121 MCAPI ::BedrockTextureData const* getBedrockTextureData(::ResourceLocation const& resourceLocation) const;
122
123 MCAPI ::cg::ImageBuffer* getCachedImage(::ResourceLocation const& resourceLocation) const;
124
125 MCAPI ::cg::ImageBuffer* getCachedImageOrLoadAsync(::ResourceLocation const& imageToLoad);
126
127 MCAPI ::cg::ImageBuffer* getCachedImageOrLoadSync(::ResourceLocation const& resourceLocation, bool forceReload);
128
129 MCAPI bool isLoaded(
130 ::ResourceLocation const& resourceLocation,
131 bool ignoreCreation,
132 ::cg::TextureSetLayerType textureType
133 ) const;
134
135 MCAPI ::IsMissingTexture isMissingTexture(::ResourceLocation const& resourceLocation) 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:16
Definition ResourceLoadManager.h:19
Definition ResourceLocationPair.h:11
Definition TextureSetDefinition.h:19
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:19
Definition BedrockTextureData.h:5
Definition TextureResourceService.h:7