Skip to content
LeviMC
English
AutoLightDark
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, 40, ::std::variant<::std::string, ::std::string_view>> mText;
54 ::ll::TypedStorage<4, 16, ::mce::Color> mColor;
55 ::ll::TypedStorage<4, 4, int> mCaretLocation;
56 ::ll::TypedStorage<4, 4, float> mFontScale;
57 ::ll::TypedStorage<4, 4, float> mLinePadding;
58 ::ll::TypedStorage<4, 4, ::ui::TextAlignment> mAlignment;
59 ::ll::TypedStorage<1, 1, bool> mShadow;
60 ::ll::TypedStorage<1, 1, bool> mShowColorSymbol;
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 drawText(
151 ::Font& font,
152 ::RectangleArea const& rect,
153 ::std::string_view text,
154 ::mce::Color const& color,
155 float alpha,
156 ::ui::TextAlignment alignment,
157 ::TextMeasureData const& textData,
158 ::CaretMeasureData const& caretData
159 ) /*override*/;
160
161 virtual void flushText(float deltaTime, ::std::optional<float> obfuscateSwitchTime) /*override*/;
162
163 virtual void drawImage(
164 ::mce::ClientTexture const& texture,
165 ::glm::vec2 const& position,
166 ::glm::vec2 const& size,
167 ::glm::vec2 const& uv,
168 ::glm::vec2 const& uvSize,
169 bool const colorCorrected
170 ) /*override*/;
171
172 virtual void drawNineslice(::mce::ClientTexture const& texture, ::NinesliceInfo const& info) /*override*/;
173
174 virtual void
175 flushImages(::mce::Color const& color, float alpha, ::HashedString const& materialNameHash) /*override*/;
176
177 virtual ::mce::TexturePtr getTexture(::ResourceLocation const& resourceLocation, bool forceReload) const
178 /*override*/;
179
180 virtual ::mce::TexturePtr getZippedTexture(
181 ::Core::Path const& zippedFolderPath,
182 ::ResourceLocation const& resourceLocation,
183 bool forceReload
184 ) const /*override*/;
185
186 virtual bool unloadTexture(::ResourceLocation const& resourceLocation) /*override*/;
187
188 virtual ::UITextureInfoPtr getUITextureInfo(::ResourceLocation const& resourceLocation, bool forceReload) const
189 /*override*/;
190
191 virtual void touchTexture(::ResourceLocation const& resourceLocation) /*override*/;
192
193 virtual void beginSharedMeshBatch(::ComponentRenderBatch& renderBatch) /*override*/;
194
195 virtual void endSharedMeshBatch(::ComponentRenderBatch& renderBatch) /*override*/;
196
197 virtual void reserveSharedMeshBatch(uint64 vertexCount) /*override*/;
198
199 virtual uint64 getSharedMeshBatchVertexCount() const /*override*/;
200
201 virtual void
202 drawRectangle(::RectangleArea const& rect, ::mce::Color const& color, float alpha, int thickness) /*override*/;
203
204 virtual void fillRectangle(::RectangleArea const& rect, ::mce::Color const& color, float alpha) /*override*/;
205
206 virtual void increaseStencilRef() /*override*/;
207
208 virtual void decreaseStencilRef() /*override*/;
209
210 virtual void resetStencilRef() /*override*/;
211
212 virtual void fillRectangleStencil(::RectangleArea const& rect) /*override*/;
213
214 virtual void enableScissorTest(::RectangleArea const& rect) /*override*/;
215
216 virtual void disableScissorTest() /*override*/;
217
218 virtual void setClippingRectangle(::RectangleArea const& rect) /*override*/;
219
220 virtual void setFullClippingRectangle() /*override*/;
221
222 virtual void saveCurrentClippingRectangle() /*override*/;
223
224 virtual void restoreSavedClippingRectangle() /*override*/;
225
226 virtual ::RectangleArea getFullClippingRectangle() const /*override*/;
227
228 virtual void cleanup() /*override*/;
229
230 virtual void removePersistentMeshes() /*override*/;
231
232 virtual ::UIMeasureStrategy& getMeasureStrategy() /*override*/;
233
234 virtual void snapImageSizeToGrid(::glm::vec2& size) const /*override*/;
235
236 virtual void snapImagePositionToGrid(::glm::vec2& position) const /*override*/;
237
238 virtual void notifyImageEstimate(uint64 imageCount) /*override*/;
239
240 virtual bool updateCustom(::gsl::not_null<::CustomRenderComponent*> customRenderer) /*override*/;
241
242 virtual void renderCustom(::gsl::not_null<::CustomRenderComponent*> customRenderer, int pass) /*override*/;
243 // NOLINTEND
244
245public:
246 // member functions
247 // NOLINTBEGIN
248 MCAPI
249 MinecraftUIRenderContext(::IClientInstance& client, ::ScreenContext& screenContext, ::UIScene const& currentScene);
250 // NOLINTEND
251
252public:
253 // static functions
254 // NOLINTBEGIN
255 MCNAPI static ::std::unique_ptr<::MinecraftUIPersistentMeshItem>
256 _createPersistentMesh(::ComponentRenderBatch const& renderBatch, ::mce::TextureGroup& textureGroup);
257
258 MCNAPI static bool _endSharedMeshBatch(
259 ::ComponentRenderBatch& renderBatch,
260 ::MinecraftUIPersistentMeshItem& persistentMeshItem,
261 ::ScreenContext& screenContext,
262 ::OffscreenCaptureDescription const& capture
263 );
264 // NOLINTEND
265
266public:
267 // constructor thunks
268 // NOLINTBEGIN
269 MCAPI void* $ctor(::IClientInstance& client, ::ScreenContext& screenContext, ::UIScene const& currentScene);
270 // NOLINTEND
271
272public:
273 // destructor thunk
274 // NOLINTBEGIN
275 MCAPI void $dtor();
276 // NOLINTEND
277
278public:
279 // virtual function thunks
280 // NOLINTBEGIN
281 MCNAPI int $getLineLength(::Font& font, ::std::string const& text, float fontSize, bool showColorSymbol) const;
282
283 MCNAPI float $getTextAlpha() const;
284
285 MCNAPI void $setTextAlpha(float alpha);
286
287 MCNAPI void $drawDebugText(
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 MCNAPI void $drawText(
298 ::Font& font,
299 ::RectangleArea const& rect,
300 ::std::string&& text,
301 ::mce::Color const& color,
302 float alpha,
303 ::ui::TextAlignment alignment,
304 ::TextMeasureData const& textData,
305 ::CaretMeasureData const& caretData
306 );
307
308 MCNAPI void $drawText(
309 ::Font& font,
310 ::RectangleArea const& rect,
311 ::std::string_view text,
312 ::mce::Color const& color,
313 float alpha,
314 ::ui::TextAlignment alignment,
315 ::TextMeasureData const& textData,
316 ::CaretMeasureData const& caretData
317 );
318
319 MCAPI void $flushText(float deltaTime, ::std::optional<float> obfuscateSwitchTime);
320
321 MCNAPI void $drawImage(
322 ::mce::ClientTexture const& texture,
323 ::glm::vec2 const& position,
324 ::glm::vec2 const& size,
325 ::glm::vec2 const& uv,
326 ::glm::vec2 const& uvSize,
327 bool const colorCorrected
328 );
329
330 MCNAPI void $drawNineslice(::mce::ClientTexture const& texture, ::NinesliceInfo const& info);
331
332 MCNAPI void $flushImages(::mce::Color const& color, float alpha, ::HashedString const& materialNameHash);
333
334 MCNAPI ::mce::TexturePtr $getTexture(::ResourceLocation const& resourceLocation, bool forceReload) const;
335
336 MCNAPI ::mce::TexturePtr $getZippedTexture(
337 ::Core::Path const& zippedFolderPath,
338 ::ResourceLocation const& resourceLocation,
339 bool forceReload
340 ) const;
341
342 MCNAPI bool $unloadTexture(::ResourceLocation const& resourceLocation);
343
344 MCNAPI ::UITextureInfoPtr $getUITextureInfo(::ResourceLocation const& resourceLocation, bool forceReload) const;
345
346 MCNAPI void $touchTexture(::ResourceLocation const& resourceLocation);
347
348 MCAPI void $beginSharedMeshBatch(::ComponentRenderBatch& renderBatch);
349
350 MCAPI void $endSharedMeshBatch(::ComponentRenderBatch& renderBatch);
351
352 MCNAPI void $reserveSharedMeshBatch(uint64 vertexCount);
353
354 MCNAPI uint64 $getSharedMeshBatchVertexCount() const;
355
356 MCNAPI void $drawRectangle(::RectangleArea const& rect, ::mce::Color const& color, float alpha, int thickness);
357
358 MCNAPI void $fillRectangle(::RectangleArea const& rect, ::mce::Color const& color, float alpha);
359
360 MCNAPI void $increaseStencilRef();
361
362 MCNAPI void $decreaseStencilRef();
363
364 MCNAPI void $resetStencilRef();
365
366 MCNAPI void $fillRectangleStencil(::RectangleArea const& rect);
367
368 MCNAPI void $enableScissorTest(::RectangleArea const& rect);
369
370 MCNAPI void $disableScissorTest();
371
372 MCNAPI void $setClippingRectangle(::RectangleArea const& rect);
373
375
377
379
381
382 MCNAPI void $cleanup();
383
385
387
388 MCNAPI void $snapImageSizeToGrid(::glm::vec2& size) const;
389
390 MCNAPI void $snapImagePositionToGrid(::glm::vec2& position) const;
391
392 MCNAPI void $notifyImageEstimate(uint64 imageCount);
393
394 MCNAPI bool $updateCustom(::gsl::not_null<::CustomRenderComponent*> customRenderer);
395
396 MCNAPI void $renderCustom(::gsl::not_null<::CustomRenderComponent*> customRenderer, int pass);
397 // NOLINTEND
398};
Definition ComponentRenderBatch.h:5
Definition Path.h:10
Definition CustomRenderComponent.h:5
Definition Font.h:5
Definition HashedString.h:5
Definition IClientInstance.h:5
Definition IUIRepository.h:5
Definition MinecraftUIRenderContext.h:5
MCAPI void $drawNineslice(::mce::ClientTexture const &texture, ::NinesliceInfo const &info)
MCAPI void $flushImages(::mce::Color const &color, float alpha, ::HashedString const &materialNameHash)
MCAPI::mce::TexturePtr $getTexture(::ResourceLocation const &resourceLocation, bool forceReload) const
MCAPI void $drawRectangle(::RectangleArea const &rect, ::mce::Color const &color, float alpha, int thickness)
MCAPI void $notifyImageEstimate(uint64 imageCount)
MCAPI void $drawDebugText(::RectangleArea const &rect, ::std::string &&text, ::mce::Color const &color, float alpha, ::ui::TextAlignment alignment, ::TextMeasureData const &textData, ::CaretMeasureData const &caretData)
static MCAPI bool _endSharedMeshBatch(::ComponentRenderBatch &renderBatch, ::MinecraftUIPersistentMeshItem &persistentMeshItem, ::ScreenContext &screenContext, ::OffscreenCaptureDescription const &capture)
MCAPI void $decreaseStencilRef()
MCAPI void $resetStencilRef()
MCAPI::mce::TexturePtr $getZippedTexture(::Core::Path const &zippedFolderPath, ::ResourceLocation const &resourceLocation, bool forceReload) const
MCAPI void $increaseStencilRef()
MCAPI void $setFullClippingRectangle()
MCAPI void $reserveSharedMeshBatch(uint64 vertexCount)
MCAPI::RectangleArea $getFullClippingRectangle() const
MCAPI void $fillRectangle(::RectangleArea const &rect, ::mce::Color const &color, float alpha)
MCAPI bool $unloadTexture(::ResourceLocation const &resourceLocation)
MCAPI::UITextureInfoPtr $getUITextureInfo(::ResourceLocation const &resourceLocation, bool forceReload) const
MCAPI::UIMeasureStrategy & $getMeasureStrategy()
MCAPI void $snapImageSizeToGrid(::glm::vec2 &size) const
MCAPI void $setTextAlpha(float alpha)
MCAPI uint64 $getSharedMeshBatchVertexCount() const
MCAPI int $getLineLength(::Font &font, ::std::string const &text, float fontSize, bool showColorSymbol) const
MCAPI void $fillRectangleStencil(::RectangleArea const &rect)
MCAPI void $renderCustom(::gsl::not_null<::CustomRenderComponent * > customRenderer, int pass)
MCAPI bool $updateCustom(::gsl::not_null<::CustomRenderComponent * > customRenderer)
MCAPI void $snapImagePositionToGrid(::glm::vec2 &position) const
MCAPI void $removePersistentMeshes()
MCAPI void $disableScissorTest()
MCAPI void $enableScissorTest(::RectangleArea const &rect)
MCAPI void $touchTexture(::ResourceLocation const &resourceLocation)
MCAPI void $drawText(::Font &font, ::RectangleArea const &rect, ::std::string &&text, ::mce::Color const &color, float alpha, ::ui::TextAlignment alignment, ::TextMeasureData const &textData, ::CaretMeasureData const &caretData)
static MCAPI ::std::unique_ptr<::MinecraftUIPersistentMeshItem > _createPersistentMesh(::ComponentRenderBatch const &renderBatch, ::mce::TextureGroup &textureGroup)
MCAPI void $restoreSavedClippingRectangle()
MCAPI float $getTextAlpha() const
MCAPI void $saveCurrentClippingRectangle()
MCAPI void $setClippingRectangle(::RectangleArea const &rect)
MCAPI void $drawImage(::mce::ClientTexture const &texture, ::glm::vec2 const &position, ::glm::vec2 const &size, ::glm::vec2 const &uv, ::glm::vec2 const &uvSize, bool const colorCorrected)
Definition Path.h:16
Definition RectangleArea.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
STL namespace.
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