Toast Engine
Loading...
Searching...
No Matches
panel_3d.hpp
Go to the documentation of this file.
1
8
9#pragma once
10#include <memory>
11#include <toast/ui/assets.hpp>
13
14// NOLINTNEXTLINE(readability-identifier-naming)
15namespace Rml {
16class Context;
17class ElementDocument;
18}
19
20namespace ui {
21class UIBinds;
22class UIBindStore;
23}
24
25namespace toast {
26
27class TOAST_API [[ToastNode, Icon("Window"), Color("Blue")]] Panel3D : public Node3D {
28public:
29 Panel3D();
30 ~Panel3D() override;
31
32 [[nodiscard]]
33 auto rmlContext() -> Rml::Context* {
34 return m_context;
35 }
36
37 [[nodiscard]]
38 auto rmlDocument() -> Rml::ElementDocument* {
39 return m_document;
40 }
41
42 [[nodiscard]]
43 auto colorScheme() const -> const assets::Handle<assets::ColorScheme>& {
44 return m_color_scheme;
45 }
46
47 [[nodiscard]]
48 auto alwaysOnTop() const noexcept -> bool {
49 return m_always_on_top;
50 }
51
52 [[nodiscard]]
53 auto pixelSize() const -> glm::ivec2;
54
55 [[nodiscard]]
56 auto worldTransformForRender() -> const glm::mat4& {
57 return getWorldTransform();
58 }
59
60 void reloadDocument();
61 void syncContextDimensions();
62
63private:
64 void onReflectedFieldChanged(std::string_view field_name) override;
65 void updateInspectorMessages() override;
66 void init();
67 void begin();
68 void destroy();
69 void onEnable();
70 void onDisable();
71 void tick();
72
74 void setup();
75 void loadDocument();
76 void unloadDocument();
77
78 [[Reflect]]
80
81 [[Reflect]]
83
84 [[Reflect]]
85 std::vector<assets::Handle<assets::Font>> m_fonts;
86
87 [[Reflect, Group("Data"), Name("Table")]]
88 std::vector<assets::Handle<assets::Localization>> m_localizations;
89
90 [[Reflect, Group("Data"), Name("Image table")]]
91 std::vector<assets::Handle<assets::ImageLocalization>> m_image_localizations;
92
94 [[Reflect]]
95 float m_pixels_per_meter = 512.0f;
96 // TODO: We should probably calculate this depending on the distance to the object
97
98 [[Reflect]]
99 bool m_always_on_top = false;
100
101 Rml::Context* m_context = nullptr;
102 Rml::ElementDocument* m_document = nullptr;
103 std::unique_ptr<ui::UIBindStore> m_bind_store;
104 std::unique_ptr<ui::UIBinds> m_binds;
105};
106
107}
Type-safe smart pointer for assets.
Definition core_types.hpp:149
Definition node_3d.hpp:25
Definition reflect.hpp:244
Persistent values shared by Lua and the active RmlUi data model.
Definition ui_binds.hpp:33
Definition ui_binds.hpp:52
Node with 3D spatial transforms.
Aggregate header for the UI asset types.