Skip to content
LeviMC
English
AutoLightDark
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/math/AlphaUsage.h"
8#include "mc/deps/core/utility/NonOwnerPointer.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; }
19namespace mce { class ImageResourceLoader; }
20// clang-format on
21
22namespace TextureSetHelpers {
23
25public:
26 // TextureSetDefinitionLoader inner types declare
27 // clang-format off
28 class ResourceHelper;
29 // clang-format on
30
31 // TextureSetDefinitionLoader inner types define
32 enum class ColorPipeline : int {
33 Classic = 0,
34 Pbr = 1,
35 };
36
37 enum class LoadImageLayerResult : int {
38 Ok = 0,
39 NoFile = 1,
40 NoLayer = 2,
41 ErrorLoading = 3,
42 };
43
44 enum class LoadMode : int {
45 ExplicitDefinitionOnly = 0,
46 ImageDescription = 1,
47 AllLayers = 2,
48 };
49
51 public:
52 // member variables
53 // NOLINTBEGIN
54 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::mce::ImageResourceLoader>> mImageResourceLoader;
55 // NOLINTEND
56
57 public:
58 // virtual functions
59 // NOLINTBEGIN
60#ifdef LL_PLAT_S
61 virtual ~ResourceHelper() = default;
62#else // LL_PLAT_C
63 virtual ~ResourceHelper();
64#endif
65
66 virtual ::ResourceLocation getBackCompatResourceLocation(::ResourceLocation const& resourceLocation) const;
67
68 virtual ::std::optional<uint>
69 getPackStackIndexOfNoExtensionOrImage(::ResourceLocation const& resourceLocation) const;
70
71 virtual ::std::optional<uint> getPackStackIndexOfTextureSet(::ResourceLocation const& resourceLocation) const;
72
73 virtual bool loadResourceOfExtensions(
74 ::ResourceLocationPair const& resourceLocationPair,
75 ::std::string& resourceStream,
76 ::gsl::span<::std::string const> extensions
77 ) const;
78
79 virtual bool loadResource(::ResourceLocation const& resourceLocation, ::std::string& resourceStream) const;
80
81 virtual bool loadImageResourceFromMemory(
82 ::std::shared_ptr<::cg::ImageResource>& out,
83 ::std::string const& buffer,
84 ::ResourceLocationPair const& resourceLocationPair,
85 ::mce::AlphaUsage const alphaUsage,
86 ::mce::ImageFormat const& desiredImageFormat
87 ) const;
88
89 virtual bool loadCompressedImageFromMemory(::cg::CompressedImageBuffer& out, ::std::string const& buffer) const;
90 // NOLINTEND
91
92 public:
93 // destructor thunk
94 // NOLINTBEGIN
95#ifdef LL_PLAT_C
96 MCNAPI void $dtor();
97#endif
98 // NOLINTEND
99
100 public:
101 // virtual function thunks
102 // NOLINTBEGIN
103#ifdef LL_PLAT_C
104 MCNAPI ::ResourceLocation $getBackCompatResourceLocation(::ResourceLocation const& resourceLocation) const;
105
106 MCNAPI ::std::optional<uint>
107 $getPackStackIndexOfNoExtensionOrImage(::ResourceLocation const& resourceLocation) const;
108
109 MCNAPI ::std::optional<uint> $getPackStackIndexOfTextureSet(::ResourceLocation const& resourceLocation) const;
110
111 MCNAPI bool $loadResourceOfExtensions(
112 ::ResourceLocationPair const& resourceLocationPair,
113 ::std::string& resourceStream,
114 ::gsl::span<::std::string const> extensions
115 ) const;
116
117 MCNAPI bool $loadResource(::ResourceLocation const& resourceLocation, ::std::string& resourceStream) const;
118
119 MCNAPI bool $loadImageResourceFromMemory(
120 ::std::shared_ptr<::cg::ImageResource>& out,
121 ::std::string const& buffer,
122 ::ResourceLocationPair const& resourceLocationPair,
123 ::mce::AlphaUsage const alphaUsage,
124 ::mce::ImageFormat const& desiredImageFormat
125 ) const;
126
127 MCNAPI bool $loadCompressedImageFromMemory(::cg::CompressedImageBuffer& out, ::std::string const& buffer) const;
128#endif
129
130
131 // NOLINTEND
132
133 public:
134 // vftables
135 // NOLINTBEGIN
136 MCNAPI static void** $vftable();
137 // NOLINTEND
138 };
139
140public:
141 // static functions
142 // NOLINTBEGIN
143#ifdef LL_PLAT_C
144 MCNAPI static ::TextureSetHelpers::TextureSetDefinitionLoader::LoadImageLayerResult _loadImageLayer(
145 ::std::shared_ptr<::cg::TextureSetDefinition> textureSetDefinition,
146 ::Bedrock::NotNullNonOwnerPtr<::cg::TextureSetLayerDefinition const> layer,
148 );
149
150 MCNAPI static bool _loadImageLayers(
151 ::ResourceLocation const& resourceLocation,
152 ::std::shared_ptr<::cg::TextureSetDefinition> textureSetDefinition,
153 ::TextureSetHelpers::TextureSetDefinitionLoader::LoadMode const& loadMode,
154 ::TextureSetHelpers::TextureSetDefinitionLoader::ColorPipeline const&,
156 );
157
158 MCNAPI static ::std::shared_ptr<::cg::TextureSetDefinition> loadOrCreateTextureSetDefinition(
159 ::ResourceLocation const& resourceLocation,
160 ::TextureSetHelpers::TextureSetDefinitionLoader::LoadMode const& loadMode,
161 ::TextureSetHelpers::TextureSetDefinitionLoader::ColorPipeline const& colorMode,
162 ::cg::ImageBuffer const& missingImage,
164 bool needsDecompression
165 );
166
167 MCNAPI static ::std::shared_ptr<::cg::TextureSetDefinition> loadOrCreateTextureSetDefinition(
168 ::ResourceLocationPair const& resourceLocationPair,
169 ::TextureSetHelpers::TextureSetDefinitionLoader::LoadMode const& loadMode,
170 ::TextureSetHelpers::TextureSetDefinitionLoader::ColorPipeline const& colorMode,
171 ::cg::ImageBuffer const* optionalMissingImage,
173 bool needsDecompression
174 );
175
176 MCNAPI static ::std::shared_ptr<::cg::TextureSetDefinition> makeDefinitionFromImageBuffer(
177 ::ResourceLocationPair const& resourceLocationPair,
178 ::cg::ImageBuffer const* optionalImageBuffer,
179 bool isMissingTexture,
180 bool needsDecompression
181 );
182#endif
183 // NOLINTEND
184};
185
186} // namespace TextureSetHelpers
Definition ResourceLocationPair.h:9
Definition ResourceLocation.h:15
Definition TextureSetDefinitionLoader.h:50
Definition TextureSetDefinitionLoader.h:24
Definition CompressedImageBuffer.h:11
Definition ImageBuffer.h:16
Definition ImageResource.h:15
Definition TextureSetDefinition.h:19
Definition TextureSetLayerDefinition.h:14
Definition ImageResourceLoader.h:19
Definition buffer.h:5