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