LeviLamina
Loading...
Searching...
No Matches
TextureAtlas.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/client/renderer/ImageResourceManager.h"
7#include "mc/client/renderer/texture/AtlasParameters.h"
8#include "mc/client/renderer/texture/ParsedAtlasData.h"
9#include "mc/client/renderer/texture/TextureAtlasStatus.h"
10#include "mc/deps/core/resource/ResourceLocation.h"
11#include "mc/deps/core/utility/EnableNonOwnerReferences.h"
12#include "mc/deps/core/utility/NonOwnerPointer.h"
13#include "mc/deps/core_graphics/MipMapSupport.h"
14#include "mc/deps/core_graphics/TextureAtlas.h"
15
16// auto generated forward declare list
17// clang-format off
21struct ParsedAtlasNode;
25namespace Json { class Value; }
26namespace cg { class ImageBuffer; }
27namespace cg { class TextureSetImageContainer; }
28namespace mce { class Color; }
29namespace mce { class FileWatcherHandle; }
30namespace mce { class TextureGroup; }
31namespace mce::framebuilder { class PBRTextureDataManager; }
32// clang-format on
33
35public:
36 // TextureAtlas inner types define
37 using SourceImageBuffers = ::std::unordered_map<::ResourceLocation, ::cg::TextureSetImageContainer>;
38
39 using TextureAtlasTiles = ::std::vector<::TextureAtlasTile>;
40
41 using StatusCallback = ::std::function<void(::TextureAtlasStatus const&)>;
42
43 using ImageAtlasFinishedCallback = ::std::function<void()> const;
44
45 using RuntimeImageGenerators = ::std::vector<::std::weak_ptr<::RuntimeImageGeneratorInfo>>;
46
47 using SourceImagesSignature = void(::std::unordered_map<::ResourceLocation, ::cg::TextureSetImageContainer> const&);
48
49public:
50 // member variables
51 // NOLINTBEGIN
52 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::AtlasItemManager>> mAtlasItemManager;
53 ::ll::TypedStorage<8, 240, ::ParsedAtlasData> mParsedAtlasData;
54 ::ll::TypedStorage<4, 4, ::AtlasParameters> mAtlasParameters;
55 ::ll::TypedStorage<8, 16, ::std::set<::ResourceLocation>> mResources;
56 ::ll::TypedStorage<8, 64, ::ImageResourceManager> mResourceManager;
57 ::ll::TypedStorage<8, 24, ::std::vector<::mce::FileWatcherHandle>> mFileWatcherHandle;
58 ::ll::TypedStorage<8, 24, ::std::vector<::std::weak_ptr<::RuntimeImageGeneratorInfo>>> mRuntimeImageGenerators;
59 ::ll::TypedStorage<8, 88, ::cg::TextureAtlas> mTextureAtlas;
60 ::ll::TypedStorage<8, 24, ::Bedrock::NonOwnerPointer<::mce::framebuilder::PBRTextureDataManager>>
61 mPBRTextureDataManager;
62 // NOLINTEND
63
64public:
65 // prevent constructor by default
66 TextureAtlas();
67
68public:
69 // virtual functions
70 // NOLINTBEGIN
71 virtual ~TextureAtlas() /*override*/;
72 // NOLINTEND
73
74public:
75 // member functions
76 // NOLINTBEGIN
77 MCAPI TextureAtlas(
78 ::ResourceLocation const& metaFile,
79 ::Bedrock::NonOwnerPointer<::mce::framebuilder::PBRTextureDataManager> pbrTextureDataManager
80 );
81
82 MCAPI void _addElementCollection(
83 ::ResourcePackManager& resourcePackManager,
84 ::std::shared_ptr<::mce::TextureGroup> textureGroup,
85 ::Json::Value const& texture,
86 ::ParsedAtlasNode& newNode,
87 int atIndex,
88 float mipFadeAmount,
89 ::mce::Color const& mipFadeColor,
90 bool isAdditive
91 );
92
93 MCAPI ::TextureAtlasTile* _addTile(
94 ::std::vector<::TextureAtlasTile>& textureAtlasTiles,
95 bool quad,
96 float fadePerMipAmount,
97 ::ParsedAtlasNodeElement& element
98 );
99
100 MCAPI ::TextureAtlasResourceCallbacks _createAtlas(
101 ::Json::Value const& root,
102 ::std::function<void(::TextureAtlasStatus const&)> statusCallback,
103 ::std::function<void()> imageAtlasFinishedCallback,
104 ::std::shared_ptr<::mce::TextureGroup> textureGroup,
105 ::cg::MipMapSupport mipMapSupport,
106 ::ResourcePackManager& resourcePackManager,
107 ::std::shared_ptr<::cg::ImageBuffer> outCopyOfFinalImage,
108 ::std::shared_ptr<::std::unordered_map<::ResourceLocation, ::cg::TextureSetImageContainer>>
109 outCopyOfSourceImages
110 );
111
112 MCAPI ::std::vector<::TextureAtlasTile> _generateAtlasTileList();
113
114 MCAPI void _loadAtlasNodes(
115 ::ResourcePackManager& resourcePackManager,
116 ::Json::Value const& root,
117 ::std::vector<::ParsedAtlasNode>& atlasNodes,
118 ::std::shared_ptr<::mce::TextureGroup> textureGroup
119 );
120
121 MCAPI void _loadRuntimeImageAtlasNodes(::std::vector<::ParsedAtlasNode>& atlasNodes);
122
123 MCAPI bool _readNode(
124 ::ResourcePackManager& resourcePackManager,
125 ::std::shared_ptr<::mce::TextureGroup> textureGroup,
126 ::Json::Value const& jsonNode,
127 ::ParsedAtlasNode& node,
128 bool isRefreshing
129 );
130
131 MCAPI ::TextureAtlasResourceCallbacks createAtlasFromJson(
132 ::Json::Value const& json,
133 ::ResourcePackManager& resourcePackManager,
134 ::std::function<void(::TextureAtlasStatus const&)> statusCallback,
135 ::std::function<void()> imageAtlasFinishedCallback,
136 ::std::shared_ptr<::mce::TextureGroup> textureGroup,
137 ::cg::MipMapSupport mipMapSupport,
138 ::std::shared_ptr<::cg::ImageBuffer> outCopyOfFinalImage,
139 ::std::shared_ptr<::std::unordered_map<::ResourceLocation, ::cg::TextureSetImageContainer>>
140 outCopyOfSourceImages
141 );
142
143 MCAPI ::TextureAtlasResourceCallbacks createAtlasFromList(
144 ::std::string const& atlasName,
145 ::std::vector<::std::string> const& textures,
146 ::ResourcePackManager& resourcePackManager,
147 ::std::function<void(::TextureAtlasStatus const&)> statusCallback,
148 ::std::function<void()> imageAtlasFinishedCallback,
149 ::std::shared_ptr<::mce::TextureGroup> textureGroup,
150 ::cg::MipMapSupport mipMapSupport,
151 ::std::shared_ptr<::cg::ImageBuffer> outCopyOfFinalImage,
152 ::std::shared_ptr<::std::unordered_map<::ResourceLocation, ::cg::TextureSetImageContainer>>
153 outCopyOfSourceImages
154 );
155
156 MCAPI ::ResourceLocation const& getPathFromName(::std::string const& name) const;
157
158 MCAPI ::TextureAtlasResourceCallbacks loadMetaFile(
159 ::ResourcePackManager& resourcePackManager,
160 ::std::function<void(::TextureAtlasStatus const&)> statusCallback,
161 ::std::function<void()> imageAtlasFinishedCallback,
162 ::std::shared_ptr<::mce::TextureGroup> textureGroup,
163 ::cg::MipMapSupport mipMapSupport,
164 ::std::shared_ptr<::cg::ImageBuffer> outCopyOfFinalImage,
165 ::std::shared_ptr<::std::unordered_map<::ResourceLocation, ::cg::TextureSetImageContainer>>
166 outCopyOfSourceImages
167 );
168
169 MCAPI ::TextureAtlasResourceCallbacks recreateAtlas(
170 ::std::shared_ptr<::mce::TextureGroup> textureGroup,
171 ::std::function<void(::TextureAtlasStatus const&)> statusCallback,
172 ::std::function<void()> imageAtlasFinishedCallback,
173 ::cg::MipMapSupport mipMapSupport,
174 ::std::shared_ptr<::cg::ImageBuffer> outCopyOfFinalImage,
175 ::std::shared_ptr<::std::unordered_map<::ResourceLocation, ::cg::TextureSetImageContainer>>
176 outCopyOfSourceImages
177 );
178 // NOLINTEND
179
180public:
181 // constructor thunks
182 // NOLINTBEGIN
183 MCAPI void* $ctor(
184 ::ResourceLocation const& metaFile,
185 ::Bedrock::NonOwnerPointer<::mce::framebuilder::PBRTextureDataManager> pbrTextureDataManager
186 );
187 // NOLINTEND
188
189public:
190 // destructor thunk
191 // NOLINTBEGIN
192 MCAPI void $dtor();
193 // NOLINTEND
194
195public:
196 // vftables
197 // NOLINTBEGIN
198 MCNAPI static void** $vftable();
199 // NOLINTEND
200};
Definition AtlasItemManager.h:5
Definition EnableNonOwnerReferences.h:7
Definition Value.h:16
Definition ResourcePackManager.h:30
Definition TextureAtlasTile.h:5
Definition TextureAtlas.h:5
static MCAPI void ** $vftable()
Definition ImageBuffer.h:16
Definition TextureSetImageContainer.h:20
Definition Color.h:13
Definition FileWatcherHandle.h:12
Definition TextureGroup.h:7
Definition PBRTextureDataManager.h:7
Definition ParsedAtlasNodeElement.h:5
Definition ParsedAtlasNode.h:5
Definition RuntimeImageGeneratorInfo.h:5
Definition TextureAtlasResourceCallbacks.h:5