LeviLamina
Loading...
Searching...
No Matches
MinecraftUIRenderContext.h
1#pragma once
2
3#include "mc/_HeaderOutputPredefine.h"
4
5// auto generated inclusion list
6#include "mc/client/gui/FontHandle.h"
7#include "mc/client/gui/TextAlignment.h"
8#include "mc/client/gui/controls/UIRenderContext.h"
9#include "mc/client/renderer/screen/MinecraftUIMeasureStrategy.h"
10#include "mc/deps/core/math/Color.h"
11#include "mc/deps/core/utility/NonOwnerPointer.h"
12#include "mc/deps/input/RectangleArea.h"
13
14// auto generated forward declare list
15// clang-format off
18class Font;
19class HashedString;
20class IClientInstance;
21class IUIRepository;
23class ScreenContext;
25class UIScene;
27struct CaretMeasureData;
29struct NinesliceInfo;
31struct TextMeasureData;
32namespace Core { class Path; }
33namespace mce { class TextureGroup; }
34namespace mce { class TexturePtr; }
35namespace mce { struct ClientTexture; }
36// clang-format on
37
39public:
40 // MinecraftUIRenderContext inner types declare
41 // clang-format off
42 struct TextItem;
43 struct ImageItem;
44 // clang-format on
45
46 // MinecraftUIRenderContext inner types define
47 struct TextItem {
48 public:
49 // member variables
50 // NOLINTBEGIN
51 ::ll::TypedStorage<8, 8, ::Font&> mFont;
52 ::ll::TypedStorage<4, 16, ::RectangleArea> mArea;
53 ::ll::TypedStorage<8, 32, ::std::string> mText;
54 ::ll::TypedStorage<4, 16, ::mce::Color> mColor;
55 ::ll::TypedStorage<1, 1, bool> mShadow;
56 ::ll::TypedStorage<1, 1, bool> mShowColorSymbol;
57 ::ll::TypedStorage<4, 4, int> mCaretLocation;
58 ::ll::TypedStorage<4, 4, float> mFontScale;
59 ::ll::TypedStorage<4, 4, float> mLinePadding;
60 ::ll::TypedStorage<4, 4, ::ui::TextAlignment> mAlignment;
61 // NOLINTEND
62
63 public:
64 // prevent constructor by default
65 TextItem& operator=(TextItem const&);
66 TextItem(TextItem const&);
67 TextItem();
68 };
69
70 struct ImageItem {
71 public:
72 // member variables
73 // NOLINTBEGIN
74 ::ll::TypedStorage<8, 8, ::mce::ClientTexture const&> mTexture;
75 ::ll::TypedStorage<4, 8, ::glm::vec2> mPosition;
76 ::ll::TypedStorage<4, 8, ::glm::vec2> mSize;
77 ::ll::TypedStorage<4, 8, ::glm::vec2> mUV;
78 ::ll::TypedStorage<4, 8, ::glm::vec2> mUVSize;
79 ::ll::TypedStorage<1, 1, bool> mColorCorrected;
80 // NOLINTEND
81
82 public:
83 // prevent constructor by default
84 ImageItem& operator=(ImageItem const&);
85 ImageItem(ImageItem const&);
86 ImageItem();
87 };
88
89 using PersistentMeshItem = ::MinecraftUIPersistentMeshItem;
90
91public:
92 // member variables
93 // NOLINTBEGIN
94 ::ll::TypedStorage<8, 8, ::IClientInstance&> mClient;
95 ::ll::TypedStorage<8, 8, ::ScreenContext&> mScreenContext;
96 ::ll::TypedStorage<8, 32, ::MinecraftUIMeasureStrategy> mMeasureStrategy;
97 ::ll::TypedStorage<4, 4, float> mTextAlpha;
98 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::IUIRepository>> mUIRepository;
99 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::mce::TextureGroup>> mTextureGroup;
100 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::mce::TextureGroup>> mStoreCacheTextures;
101 ::ll::TypedStorage<8, 24, ::std::vector<::MinecraftUIRenderContext::TextItem>> mTextToDraw;
102 ::ll::TypedStorage<8, 24, ::std::vector<::MinecraftUIRenderContext::ImageItem>> mImagesToDraw;
103 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::MinecraftUIPersistentMeshItem>>> mPersistentMeshes;
104 ::ll::TypedStorage<1, 1, uchar> mStencilRef;
105 ::ll::TypedStorage<4, 4, int> mCurrentPersistentMeshItemIdx;
106 ::ll::TypedStorage<8, 80, ::FontHandle> mDebugTextFontHandle;
107 ::ll::TypedStorage<8, 8, ::UIScene const&> mCurrentScene;
108 ::ll::TypedStorage<4, 20, ::std::optional<::glm::vec4>> mSavedOriginalClippingRectangle;
109 // NOLINTEND
110
111public:
112 // prevent constructor by default
113 MinecraftUIRenderContext& operator=(MinecraftUIRenderContext const&);
114 MinecraftUIRenderContext(MinecraftUIRenderContext const&);
115 MinecraftUIRenderContext();
116
117public:
118 // virtual functions
119 // NOLINTBEGIN
120 virtual ~MinecraftUIRenderContext() /*override*/;
121
122 virtual int getLineLength(::Font& font, ::std::string const& text, float fontSize, bool showColorSymbol) const
123 /*override*/;
124
125 virtual float getTextAlpha() const /*override*/;
126
127 virtual void setTextAlpha(float alpha) /*override*/;
128
129 virtual void drawDebugText(
130 ::RectangleArea const& rect,
131 ::std::string&& text,
132 ::mce::Color const& color,
133 float alpha,
134 ::ui::TextAlignment alignment,
135 ::TextMeasureData const& textData,
136 ::CaretMeasureData const& caretData
137 ) /*override*/;
138
139 virtual void drawText(
140 ::Font& font,
141 ::RectangleArea const& rect,
142 ::std::string&& text,
143 ::mce::Color const& color,
144 float alpha,
145 ::ui::TextAlignment alignment,
146 ::TextMeasureData const& textData,
147 ::CaretMeasureData const& caretData
148 ) /*override*/;
149
150 virtual void flushText(float deltaTime, ::std::optional<float> obfuscateSwitchTime) /*override*/;
151
152 virtual void drawImage(
153 ::mce::ClientTexture const& texture,
154 ::glm::vec2 const& position,
155 ::glm::vec2 const& size,
156 ::glm::vec2 const& uv,
157 ::glm::vec2 const& uvSize,
158 bool const colorCorrected
159 ) /*override*/;
160
161 virtual void drawNineslice(::mce::ClientTexture const& texture, ::NinesliceInfo const& info) /*override*/;
162
163 virtual void
164 flushImages(::mce::Color const& color, float alpha, ::HashedString const& materialNameHash) /*override*/;
165
166 virtual ::mce::TexturePtr getTexture(::ResourceLocation const& resourceLocation, bool forceReload) const
167 /*override*/;
168
169 virtual ::mce::TexturePtr getZippedTexture(
170 ::Core::Path const& zippedFolderPath,
171 ::ResourceLocation const& resourceLocation,
172 bool forceReload
173 ) const /*override*/;
174
175 virtual bool unloadTexture(::ResourceLocation const& resourceLocation) /*override*/;
176
177 virtual ::UITextureInfoPtr getUITextureInfo(::ResourceLocation const& resourceLocation, bool forceReload) const
178 /*override*/;
179
180 virtual void touchTexture(::ResourceLocation const& resourceLocation) /*override*/;
181
182 virtual void beginSharedMeshBatch(::ComponentRenderBatch& renderBatch) /*override*/;
183
184 virtual void endSharedMeshBatch(::ComponentRenderBatch& renderBatch) /*override*/;
185
186 virtual void reserveSharedMeshBatch(uint64 vertexCount) /*override*/;
187
188 virtual uint64 getSharedMeshBatchVertexCount() const /*override*/;
189
190 virtual void
191 drawRectangle(::RectangleArea const& rect, ::mce::Color const& color, float alpha, int thickness) /*override*/;
192
193 virtual void fillRectangle(::RectangleArea const& rect, ::mce::Color const& color, float alpha) /*override*/;
194
195 virtual void increaseStencilRef() /*override*/;
196
197 virtual void decreaseStencilRef() /*override*/;
198
199 virtual void resetStencilRef() /*override*/;
200
201 virtual void fillRectangleStencil(::RectangleArea const& rect) /*override*/;
202
203 virtual void enableScissorTest(::RectangleArea const& rect) /*override*/;
204
205 virtual void disableScissorTest() /*override*/;
206
207 virtual void setClippingRectangle(::RectangleArea const& rect) /*override*/;
208
209 virtual void setFullClippingRectangle() /*override*/;
210
211 virtual void saveCurrentClippingRectangle() /*override*/;
212
213 virtual void restoreSavedClippingRectangle() /*override*/;
214
215 virtual ::RectangleArea getFullClippingRectangle() const /*override*/;
216
217 virtual void cleanup() /*override*/;
218
219 virtual void removePersistentMeshes() /*override*/;
220
221 virtual ::UIMeasureStrategy& getMeasureStrategy() /*override*/;
222
223 virtual void snapImageSizeToGrid(::glm::vec2& size) const /*override*/;
224
225 virtual void snapImagePositionToGrid(::glm::vec2& position) const /*override*/;
226
227 virtual void notifyImageEstimate(uint64 imageCount) /*override*/;
228
229 virtual bool updateCustom(::gsl::not_null<::CustomRenderComponent*> customRenderer) /*override*/;
230
231 virtual void renderCustom(::gsl::not_null<::CustomRenderComponent*> customRenderer, int pass) /*override*/;
232 // NOLINTEND
233
234public:
235 // member functions
236 // NOLINTBEGIN
237 MCAPI
238 MinecraftUIRenderContext(::IClientInstance& client, ::ScreenContext& screenContext, ::UIScene const& currentScene);
239 // NOLINTEND
240
241public:
242 // static functions
243 // NOLINTBEGIN
244 MCAPI static ::std::unique_ptr<::MinecraftUIPersistentMeshItem>
245 _createPersistentMesh(::ComponentRenderBatch const& renderBatch, ::mce::TextureGroup& textureGroup);
246
247 MCAPI static bool _endSharedMeshBatch(
248 ::ComponentRenderBatch& renderBatch,
249 ::MinecraftUIPersistentMeshItem& persistentMeshItem,
250 ::ScreenContext& screenContext,
251 ::OffscreenCaptureDescription const& capture
252 );
253 // NOLINTEND
254
255public:
256 // constructor thunks
257 // NOLINTBEGIN
258 MCAPI void* $ctor(::IClientInstance& client, ::ScreenContext& screenContext, ::UIScene const& currentScene);
259 // NOLINTEND
260
261public:
262 // destructor thunk
263 // NOLINTBEGIN
264 MCAPI void $dtor();
265 // NOLINTEND
266
267public:
268 // virtual function thunks
269 // NOLINTBEGIN
270 MCAPI int $getLineLength(::Font& font, ::std::string const& text, float fontSize, bool showColorSymbol) const;
271
272 MCFOLD float $getTextAlpha() const;
273
274 MCAPI void $setTextAlpha(float alpha);
275
276 MCAPI void $drawDebugText(
277 ::RectangleArea const& rect,
278 ::std::string&& text,
279 ::mce::Color const& color,
280 float alpha,
281 ::ui::TextAlignment alignment,
282 ::TextMeasureData const& textData,
283 ::CaretMeasureData const& caretData
284 );
285
286 MCAPI void $drawText(
287 ::Font& font,
288 ::RectangleArea const& rect,
289 ::std::string&& text,
290 ::mce::Color const& color,
291 float alpha,
292 ::ui::TextAlignment alignment,
293 ::TextMeasureData const& textData,
294 ::CaretMeasureData const& caretData
295 );
296
297 MCAPI void $flushText(float deltaTime, ::std::optional<float> obfuscateSwitchTime);
298
299 MCAPI void $drawImage(
300 ::mce::ClientTexture const& texture,
301 ::glm::vec2 const& position,
302 ::glm::vec2 const& size,
303 ::glm::vec2 const& uv,
304 ::glm::vec2 const& uvSize,
305 bool const colorCorrected
306 );
307
308 MCAPI void $drawNineslice(::mce::ClientTexture const& texture, ::NinesliceInfo const& info);
309
310 MCAPI void $flushImages(::mce::Color const& color, float alpha, ::HashedString const& materialNameHash);
311
312 MCAPI ::mce::TexturePtr $getTexture(::ResourceLocation const& resourceLocation, bool forceReload) const;
313
314 MCAPI ::mce::TexturePtr $getZippedTexture(
315 ::Core::Path const& zippedFolderPath,
316 ::ResourceLocation const& resourceLocation,
317 bool forceReload
318 ) const;
319
320 MCAPI bool $unloadTexture(::ResourceLocation const& resourceLocation);
321
322 MCAPI ::UITextureInfoPtr $getUITextureInfo(::ResourceLocation const& resourceLocation, bool forceReload) const;
323
324 MCAPI void $touchTexture(::ResourceLocation const& resourceLocation);
325
326 MCAPI void $beginSharedMeshBatch(::ComponentRenderBatch& renderBatch);
327
328 MCAPI void $endSharedMeshBatch(::ComponentRenderBatch& renderBatch);
329
330 MCAPI void $reserveSharedMeshBatch(uint64 vertexCount);
331
332 MCAPI uint64 $getSharedMeshBatchVertexCount() const;
333
334 MCAPI void $drawRectangle(::RectangleArea const& rect, ::mce::Color const& color, float alpha, int thickness);
335
336 MCAPI void $fillRectangle(::RectangleArea const& rect, ::mce::Color const& color, float alpha);
337
338 MCAPI void $increaseStencilRef();
339
340 MCAPI void $decreaseStencilRef();
341
342 MCAPI void $resetStencilRef();
343
344 MCAPI void $fillRectangleStencil(::RectangleArea const& rect);
345
346 MCAPI void $enableScissorTest(::RectangleArea const& rect);
347
348 MCAPI void $disableScissorTest();
349
350 MCAPI void $setClippingRectangle(::RectangleArea const& rect);
351
352 MCAPI void $setFullClippingRectangle();
353
354 MCAPI void $saveCurrentClippingRectangle();
355
356 MCAPI void $restoreSavedClippingRectangle();
357
358 MCAPI ::RectangleArea $getFullClippingRectangle() const;
359
360 MCAPI void $cleanup();
361
362 MCAPI void $removePersistentMeshes();
363
364 MCFOLD ::UIMeasureStrategy& $getMeasureStrategy();
365
366 MCAPI void $snapImageSizeToGrid(::glm::vec2& size) const;
367
368 MCAPI void $snapImagePositionToGrid(::glm::vec2& position) const;
369
370 MCAPI void $notifyImageEstimate(uint64 imageCount);
371
372 MCAPI bool $updateCustom(::gsl::not_null<::CustomRenderComponent*> customRenderer);
373
374 MCAPI void $renderCustom(::gsl::not_null<::CustomRenderComponent*> customRenderer, int pass);
375 // NOLINTEND
376};
Definition ComponentRenderBatch.h:5
Definition Path.h:11
Definition CustomRenderComponent.h:5
Definition Font.h:5
Definition HashedString.h:5
Definition IClientInstance.h:5
Definition IUIRepository.h:5
Definition MinecraftUIRenderContext.h:5
Definition ResourceLocation.h:15
Definition ScreenContext.h:5
Definition UIMeasureStrategy.h:5
Definition UIRenderContext.h:5
Definition UIScene.h:5
Definition UITextureInfoPtr.h:5
Definition TextureGroup.h:7
Definition TexturePtr.h:7
Definition CaretMeasureData.h:5
Definition MinecraftUIPersistentMeshItem.h:5
Definition MinecraftUIRenderContext.h:16
Definition MinecraftUIRenderContext.h:14
Definition NinesliceInfo.h:5
Definition OffscreenCaptureDescription.h:5
Definition TextMeasureData.h:5
Definition ClientTexture.h:7