LeviLamina
Loading...
Searching...
No Matches
TextureSetDefinitionLoader.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/deps/core/image/ImageFormat.h"
7#include "mc/deps/core/utility/NonOwnerPointer.h"
8#include "mc/deps/core_graphics/TextureSetLayerType.h"
9
10// auto generated forward declare list
11// clang-format off
14namespace cg { class CompressedImageBuffer; }
15namespace cg { class ImageBuffer; }
16namespace cg { class ImageResource; }
17namespace cg { class TextureSetDefinition; }
18namespace cg { class TextureSetLayerDefinition; }
19// clang-format on
20
21namespace TextureSetHelpers {
22
24public:
25 // TextureSetDefinitionLoader inner types declare
26 // clang-format off
27 class ResourceHelper;
28 // clang-format on
29
30 // TextureSetDefinitionLoader inner types define
31 enum class ColorPipeline : int {
32 Classic = 0,
33 Pbr = 1,
34 };
35
36 enum class LoadImageLayerResult : int {
37 Ok = 0,
38 NoFile = 1,
39 NoLayer = 2,
40 ErrorLoading = 3,
41 };
42
43 enum class LoadMode : int {
44 ExplicitDefinitionOnly = 0,
45 ImageDescription = 1,
46 AllLayers = 2,
47 };
48
49 class ResourceHelper {
50 public:
51 // member variables
52 // NOLINTBEGIN
54 // NOLINTEND
55
56 public:
57 // prevent constructor by default
58 ResourceHelper& operator=(ResourceHelper const&);
59 ResourceHelper(ResourceHelper const&);
60 ResourceHelper();
61
62 public:
63 // virtual functions
64 // NOLINTBEGIN
65#ifdef LL_PLAT_S
66 virtual ~ResourceHelper() = default;
67#else // LL_PLAT_C
68 virtual ~ResourceHelper();
69#endif
70
71#ifdef LL_PLAT_S
72 virtual ::ResourceLocation getBackCompatResourceLocation(::ResourceLocation const&) const;
73#else // LL_PLAT_C
74 virtual ::ResourceLocation getBackCompatResourceLocation(::ResourceLocation const& resourceLocation) const;
75#endif
76
77#ifdef LL_PLAT_S
78 virtual ::std::optional<uint> getPackStackIndexOfNoExtensionOrImage(::ResourceLocation const&) const;
79#else // LL_PLAT_C
80 virtual ::std::optional<uint>
81 getPackStackIndexOfNoExtensionOrImage(::ResourceLocation const& resourceLocation) const;
82#endif
83
84#ifdef LL_PLAT_S
85 virtual ::std::optional<uint> getPackStackIndexOfTextureSet(::ResourceLocation const&) const;
86#else // LL_PLAT_C
87 virtual ::std::optional<uint> getPackStackIndexOfTextureSet(::ResourceLocation const& resourceLocation) const;
88#endif
89
90#ifdef LL_PLAT_S
91 virtual bool
92 loadResourceOfExtensions(::ResourceLocationPair const&, ::std::string&, ::gsl::span<::std::string const>) const;
93#else // LL_PLAT_C
94 virtual bool loadResourceOfExtensions(
95 ::ResourceLocationPair const& resourceLocationPair,
96 ::std::string& resourceStream,
97 ::gsl::span<::std::string const> extensions
98 ) const;
99#endif
100
101#ifdef LL_PLAT_S
102 virtual bool loadResource(::ResourceLocation const&, ::std::string&) const;
103#else // LL_PLAT_C
104 virtual bool loadResource(::ResourceLocation const& resourceLocation, ::std::string& resourceStream) const;
105#endif
106
107#ifdef LL_PLAT_S
108 virtual bool loadImageResourceFromMemory(
109 ::std::shared_ptr<::cg::ImageResource>&,
110 ::std::string const&,
112 ::mce::ImageFormat const&
113 ) const;
114#else // LL_PLAT_C
115 virtual bool loadImageResourceFromMemory(
116 ::std::shared_ptr<::cg::ImageResource>& out,
117 ::std::string const& buffer,
118 ::ResourceLocationPair const& resourceLocationPair,
119 ::mce::ImageFormat const& desiredImageFormat
120 ) const;
121#endif
122
123#ifdef LL_PLAT_S
124 virtual bool loadCompressedImageFromMemory(::cg::CompressedImageBuffer&, ::std::string const&) const;
125#else // LL_PLAT_C
126 virtual bool loadCompressedImageFromMemory(::cg::CompressedImageBuffer& out, ::std::string const& buffer) const;
127#endif
128
129 // NOLINTEND
130
131 public:
132 // destructor thunk
133 // NOLINTBEGIN
134 MCNAPI void $dtor();
135 // NOLINTEND
136
137 public:
138 // virtual function thunks
139 // NOLINTBEGIN
140#ifdef LL_PLAT_C
141 MCNAPI ::ResourceLocation $getBackCompatResourceLocation(::ResourceLocation const& resourceLocation) const;
142
143 MCNAPI ::std::optional<uint>
144 $getPackStackIndexOfNoExtensionOrImage(::ResourceLocation const& resourceLocation) const;
145
146 MCNAPI ::std::optional<uint> $getPackStackIndexOfTextureSet(::ResourceLocation const& resourceLocation) const;
147
148 MCNAPI bool $loadResourceOfExtensions(
149 ::ResourceLocationPair const& resourceLocationPair,
150 ::std::string& resourceStream,
151 ::gsl::span<::std::string const> extensions
152 ) const;
153
154 MCNAPI bool $loadResource(::ResourceLocation const& resourceLocation, ::std::string& resourceStream) const;
155
156 MCNAPI bool $loadImageResourceFromMemory(
157 ::std::shared_ptr<::cg::ImageResource>& out,
158 ::std::string const& buffer,
159 ::ResourceLocationPair const& resourceLocationPair,
160 ::mce::ImageFormat const& desiredImageFormat
161 ) const;
162
163 MCNAPI bool $loadCompressedImageFromMemory(::cg::CompressedImageBuffer& out, ::std::string const& buffer) const;
164#endif
165
166
167 // NOLINTEND
168
169 public:
170 // vftables
171 // NOLINTBEGIN
172 MCNAPI static void** $vftable();
173 // NOLINTEND
174 };
175
176public:
177 // static functions
178 // NOLINTBEGIN
179#ifdef LL_PLAT_C
180 MCNAPI static ::TextureSetHelpers::TextureSetDefinitionLoader::LoadImageLayerResult _addImageToLayer(
181 ::std::shared_ptr<::cg::TextureSetDefinition> textureSetDefinition,
182 ::cg::TextureSetLayerType layerType,
183 ::ResourceLocationPair const& resourceLocationPair,
185 );
186
187 MCNAPI static ::TextureSetHelpers::TextureSetDefinitionLoader::LoadImageLayerResult _loadImageLayer(
188 ::std::shared_ptr<::cg::TextureSetDefinition> textureSetDefinition,
189 ::Bedrock::NotNullNonOwnerPtr<::cg::TextureSetLayerDefinition const> layer,
191 );
192
193 MCNAPI static ::TextureSetHelpers::TextureSetDefinitionLoader::LoadImageLayerResult _loadImageLayer(
194 ::std::shared_ptr<::cg::TextureSetDefinition> textureSetDefinition,
195 ::cg::TextureSetLayerType layerType,
197 );
198
199 MCNAPI static bool _loadImageLayers(
200 ::ResourceLocation const& textureSetDefinition,
201 ::std::shared_ptr<::cg::TextureSetDefinition> loadMode,
202 ::TextureSetHelpers::TextureSetDefinitionLoader::LoadMode const& resourceHelper,
203 ::TextureSetHelpers::TextureSetDefinitionLoader::ColorPipeline const&,
205 );
206
207 MCNAPI static ::std::shared_ptr<::cg::TextureSetDefinition> loadOrCreateTextureSetDefinition(
208 ::ResourceLocation const& resourceLocation,
209 ::TextureSetHelpers::TextureSetDefinitionLoader::LoadMode const& loadMode,
210 ::TextureSetHelpers::TextureSetDefinitionLoader::ColorPipeline const& colorMode,
211 ::cg::ImageBuffer const& missingImage,
213 bool needsDecompression
214 );
215
216 MCNAPI static ::std::shared_ptr<::cg::TextureSetDefinition> loadOrCreateTextureSetDefinition(
217 ::ResourceLocationPair const& resourceLocationPair,
218 ::TextureSetHelpers::TextureSetDefinitionLoader::LoadMode const& loadMode,
219 ::TextureSetHelpers::TextureSetDefinitionLoader::ColorPipeline const& colorMode,
220 ::cg::ImageBuffer const* optionalMissingImage,
222 bool needsDecompression
223 );
224
225 MCNAPI static ::std::shared_ptr<::cg::TextureSetDefinition> makeDefinitionFromImageBuffer(
226 ::ResourceLocationPair const& resourceLocationPair,
227 ::cg::ImageBuffer const* optionalImageBuffer,
228 bool isMissingTexture,
229 bool needsDecompression
230 );
231#endif
232 // NOLINTEND
233};
234
235} // namespace TextureSetHelpers
Definition ResourceLocationPair.h:9
Definition ResourceLocation.h:15
Definition TextureSetDefinitionLoader.h:49
Definition TextureSetDefinitionLoader.h:23
Definition CompressedImageBuffer.h:11
Definition ImageBuffer.h:16
Definition ImageResource.h:12
Definition TextureSetDefinition.h:20
Definition TextureSetLayerDefinition.h:14
Definition buffer.h:5
Definition Alias.h:14