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, 552, ::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
117 MCAPI ~PersistentMeshItem();
118 // NOLINTEND
119
120 public:
121 // constructor thunks
122 // NOLINTBEGIN
123 MCAPI void* $ctor(
124 ::BatchKey const& batchKey,
125 ::std::vector<::mce::TexturePtr> textures,
126 ::HashedString const& materialNameHash,
127 uint numInstances
128 );
129 // NOLINTEND
130
131 public:
132 // destructor thunk
133 // NOLINTBEGIN
134 MCAPI void $dtor();
135 // NOLINTEND
136 };
137
138public:
139 // member variables
140 // NOLINTBEGIN
141 ::ll::TypedStorage<8, 8, ::IClientInstance&> mClient;
142 ::ll::TypedStorage<8, 8, ::ScreenContext&> mScreenContext;
143 ::ll::TypedStorage<8, 32, ::MinecraftUIMeasureStrategy> mMeasureStrategy;
144 ::ll::TypedStorage<4, 4, float> mTextAlpha;
145 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::IUIRepository>> mUIRepository;
146 ::ll::TypedStorage<8, 16, ::std::shared_ptr<::mce::TextureGroup>> mTextureGroup;
147 ::ll::TypedStorage<8, 24, ::Bedrock::NotNullNonOwnerPtr<::mce::TextureGroup>> mStoreCacheTextures;
148 ::ll::TypedStorage<8, 24, ::std::vector<::MinecraftUIRenderContext::TextItem>> mTextToDraw;
149 ::ll::TypedStorage<8, 24, ::std::vector<::MinecraftUIRenderContext::ImageItem>> mImagesToDraw;
150 ::ll::TypedStorage<8, 24, ::std::vector<::std::unique_ptr<::MinecraftUIRenderContext::PersistentMeshItem>>>
151 mPersistentMeshes;
152 ::ll::TypedStorage<1, 1, uchar> mStencilRef;
153 ::ll::TypedStorage<4, 4, int> mCurrentPersistentMeshItemIdx;
154 ::ll::TypedStorage<8, 80, ::FontHandle> mDebugTextFontHandle;
155 ::ll::TypedStorage<8, 8, ::UIScene const&> mCurrentScene;
156 ::ll::TypedStorage<4, 20, ::std::optional<::glm::vec4>> mSavedOriginalClippingRectangle;
157 // NOLINTEND
158
159public:
160 // prevent constructor by default
161 MinecraftUIRenderContext& operator=(MinecraftUIRenderContext const&);
162 MinecraftUIRenderContext(MinecraftUIRenderContext const&);
163 MinecraftUIRenderContext();
164
165public:
166 // virtual functions
167 // NOLINTBEGIN
168 virtual ~MinecraftUIRenderContext() /*override*/;
169
170 virtual int getLineLength(::Font& font, ::std::string const& text, float fontSize, bool showColorSymbol) const
171 /*override*/;
172
173 virtual float getTextAlpha() const /*override*/;
174
175 virtual void setTextAlpha(float alpha) /*override*/;
176
177 virtual void drawDebugText(
178 ::RectangleArea const& rect,
179 ::std::string&& text,
180 ::mce::Color const& color,
181 float alpha,
182 ::ui::TextAlignment alignment,
183 ::TextMeasureData const& textData,
184 ::CaretMeasureData const& caretData
185 ) /*override*/;
186
187 virtual void drawText(
188 ::Font& font,
189 ::RectangleArea const& rect,
190 ::std::string&& text,
191 ::mce::Color const& color,
192 float alpha,
193 ::ui::TextAlignment alignment,
194 ::TextMeasureData const& textData,
195 ::CaretMeasureData const& caretData
196 ) /*override*/;
197
198 virtual void flushText(float deltaTime, ::std::optional<float> obfuscateSwitchTime) /*override*/;
199
200 virtual void drawImage(
201 ::mce::ClientTexture const& texture,
202 ::glm::vec2 const& position,
203 ::glm::vec2 const& size,
204 ::glm::vec2 const& uv,
205 ::glm::vec2 const& uvSize,
206 bool const colorCorrected
207 ) /*override*/;
208
209 virtual void drawNineslice(::mce::ClientTexture const& texture, ::NinesliceInfo const& info) /*override*/;
210
211 virtual void
212 flushImages(::mce::Color const& color, float alpha, ::HashedString const& materialNameHash) /*override*/;
213
214 virtual ::mce::TexturePtr getTexture(::ResourceLocation const& resourceLocation, bool forceReload) const
215 /*override*/;
216
217 virtual ::mce::TexturePtr getZippedTexture(
218 ::Core::Path const& zippedFolderPath,
219 ::ResourceLocation const& resourceLocation,
220 bool forceReload
221 ) const /*override*/;
222
223 virtual bool unloadTexture(::ResourceLocation const& resourceLocation) /*override*/;
224
225 virtual ::UITextureInfoPtr getUITextureInfo(::ResourceLocation const& resourceLocation, bool forceReload) const
226 /*override*/;
227
228 virtual void touchTexture(::ResourceLocation const& resourceLocation) /*override*/;
229
230 virtual void beginSharedMeshBatch(::ComponentRenderBatch& renderBatch) /*override*/;
231
232 virtual void endSharedMeshBatch(::ComponentRenderBatch& renderBatch) /*override*/;
233
234 virtual void reserveSharedMeshBatch(uint64 vertexCount) /*override*/;
235
236 virtual uint64 getSharedMeshBatchVertexCount() const /*override*/;
237
238 virtual void
239 drawRectangle(::RectangleArea const& rect, ::mce::Color const& color, float alpha, int thickness) /*override*/;
240
241 virtual void fillRectangle(::RectangleArea const& rect, ::mce::Color const& color, float alpha) /*override*/;
242
243 virtual void increaseStencilRef() /*override*/;
244
245 virtual void decreaseStencilRef() /*override*/;
246
247 virtual void resetStencilRef() /*override*/;
248
249 virtual void fillRectangleStencil(::RectangleArea const& rect) /*override*/;
250
251 virtual void enableScissorTest(::RectangleArea const& rect) /*override*/;
252
253 virtual void disableScissorTest() /*override*/;
254
255 virtual void setClippingRectangle(::RectangleArea const& rect) /*override*/;
256
257 virtual void setFullClippingRectangle() /*override*/;
258
259 virtual void saveCurrentClippingRectangle() /*override*/;
260
261 virtual void restoreSavedClippingRectangle() /*override*/;
262
263 virtual ::RectangleArea getFullClippingRectangle() const /*override*/;
264
265 virtual void cleanup() /*override*/;
266
267 virtual void removePersistentMeshes() /*override*/;
268
269 virtual ::UIMeasureStrategy& getMeasureStrategy() /*override*/;
270
271 virtual void snapImageSizeToGrid(::glm::vec2& size) const /*override*/;
272
273 virtual void snapImagePositionToGrid(::glm::vec2& position) const /*override*/;
274
275 virtual void notifyImageEstimate(uint64 imageCount) /*override*/;
276
277 virtual bool updateCustom(::gsl::not_null<::CustomRenderComponent*> customRenderer) /*override*/;
278
279 virtual void renderCustom(::gsl::not_null<::CustomRenderComponent*> customRenderer, int pass) /*override*/;
280 // NOLINTEND
281
282public:
283 // member functions
284 // NOLINTBEGIN
285 MCAPI
286 MinecraftUIRenderContext(::IClientInstance& client, ::ScreenContext& screenContext, ::UIScene const& currentScene);
287
288 MCAPI float _getTextAlignmentOffset(::MinecraftUIRenderContext::TextItem const& textItem, float lineLength) const;
289
290 MCAPI float _getTextAlignmentPosition(::MinecraftUIRenderContext::TextItem const& textItem) const;
291
292 MCAPI void
293 _renderTextAligned(::MinecraftUIRenderContext::TextItem const& textItem, float tx, float ty, bool forceUseCache);
294
295 MCAPI void
296 _splitTextItemText(::MinecraftUIRenderContext::TextItem const& textItem, ::std::vector<::std::string>& lines) const;
297
298 MCFOLD ::ScreenContext& getScreenContext();
299 // NOLINTEND
300
301public:
302 // constructor thunks
303 // NOLINTBEGIN
304 MCAPI void* $ctor(::IClientInstance& client, ::ScreenContext& screenContext, ::UIScene const& currentScene);
305 // NOLINTEND
306
307public:
308 // destructor thunk
309 // NOLINTBEGIN
310 MCAPI void $dtor();
311 // NOLINTEND
312
313public:
314 // virtual function thunks
315 // NOLINTBEGIN
316 MCAPI int $getLineLength(::Font& font, ::std::string const& text, float fontSize, bool showColorSymbol) const;
317
318 MCFOLD float $getTextAlpha() const;
319
320 MCFOLD void $setTextAlpha(float alpha);
321
322 MCAPI void $drawDebugText(
323 ::RectangleArea const& rect,
324 ::std::string&& text,
325 ::mce::Color const& color,
326 float alpha,
327 ::ui::TextAlignment alignment,
328 ::TextMeasureData const& textData,
329 ::CaretMeasureData const& caretData
330 );
331
332 MCAPI void $drawText(
333 ::Font& font,
334 ::RectangleArea const& rect,
335 ::std::string&& text,
336 ::mce::Color const& color,
337 float alpha,
338 ::ui::TextAlignment alignment,
339 ::TextMeasureData const& textData,
340 ::CaretMeasureData const& caretData
341 );
342
343 MCAPI void $flushText(float deltaTime, ::std::optional<float> obfuscateSwitchTime);
344
345 MCAPI void $drawImage(
346 ::mce::ClientTexture const& texture,
347 ::glm::vec2 const& position,
348 ::glm::vec2 const& size,
349 ::glm::vec2 const& uv,
350 ::glm::vec2 const& uvSize,
351 bool const colorCorrected
352 );
353
354 MCAPI void $drawNineslice(::mce::ClientTexture const& texture, ::NinesliceInfo const& info);
355
356 MCAPI void $flushImages(::mce::Color const& color, float alpha, ::HashedString const& materialNameHash);
357
358 MCAPI ::mce::TexturePtr $getTexture(::ResourceLocation const& resourceLocation, bool forceReload) const;
359
360 MCAPI ::mce::TexturePtr $getZippedTexture(
361 ::Core::Path const& zippedFolderPath,
362 ::ResourceLocation const& resourceLocation,
363 bool forceReload
364 ) const;
365
366 MCAPI bool $unloadTexture(::ResourceLocation const& resourceLocation);
367
368 MCAPI ::UITextureInfoPtr $getUITextureInfo(::ResourceLocation const& resourceLocation, bool forceReload) const;
369
370 MCAPI void $touchTexture(::ResourceLocation const& resourceLocation);
371
372 MCAPI void $beginSharedMeshBatch(::ComponentRenderBatch& renderBatch);
373
374 MCAPI void $endSharedMeshBatch(::ComponentRenderBatch& renderBatch);
375
376 MCAPI void $reserveSharedMeshBatch(uint64 vertexCount);
377
378 MCAPI uint64 $getSharedMeshBatchVertexCount() const;
379
380 MCAPI void $drawRectangle(::RectangleArea const& rect, ::mce::Color const& color, float alpha, int thickness);
381
382 MCAPI void $fillRectangle(::RectangleArea const& rect, ::mce::Color const& color, float alpha);
383
384 MCAPI void $increaseStencilRef();
385
386 MCAPI void $decreaseStencilRef();
387
388 MCAPI void $resetStencilRef();
389
390 MCAPI void $fillRectangleStencil(::RectangleArea const& rect);
391
392 MCAPI void $enableScissorTest(::RectangleArea const& rect);
393
394 MCAPI void $disableScissorTest();
395
396 MCAPI void $setClippingRectangle(::RectangleArea const& rect);
397
398 MCAPI void $setFullClippingRectangle();
399
400 MCAPI void $saveCurrentClippingRectangle();
401
402 MCAPI void $restoreSavedClippingRectangle();
403
404 MCAPI ::RectangleArea $getFullClippingRectangle() const;
405
406 MCAPI void $cleanup();
407
408 MCAPI void $removePersistentMeshes();
409
410 MCFOLD ::UIMeasureStrategy& $getMeasureStrategy();
411
412 MCAPI void $snapImageSizeToGrid(::glm::vec2& size) const;
413
414 MCAPI void $snapImagePositionToGrid(::glm::vec2& position) const;
415
416 MCAPI void $notifyImageEstimate(uint64 imageCount);
417
418 MCAPI bool $updateCustom(::gsl::not_null<::CustomRenderComponent*> customRenderer);
419
420 MCAPI void $renderCustom(::gsl::not_null<::CustomRenderComponent*> customRenderer, int pass);
421 // NOLINTEND
422
423public:
424 // vftables
425 // NOLINTBEGIN
426 MCNAPI static void** $vftable();
427 // NOLINTEND
428};
Definition ComponentRenderBatch.h:5
Definition Path.h:12
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:7
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