Toast Engine
Toggle main menu visibility
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
>
12
#include <
toast/world/node_3d.hpp
>
13
14
// NOLINTNEXTLINE(readability-identifier-naming)
15
namespace
Rml {
16
class
Context;
17
class
ElementDocument;
18
}
19
20
namespace
ui {
21
class
UIBinds
;
22
class
UIBindStore
;
23
}
24
25
namespace
toast {
26
27
class
TOAST_API [[ToastNode, Icon(
"Window"
), Color(
"Blue"
)]] Panel3D :
public
Node3D
{
28
public
:
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
63
private
:
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
]]
79
assets::Handle<assets::UIElement>
m_element;
80
81
[[
Reflect
]]
82
assets::Handle<assets::ColorScheme>
m_color_scheme;
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
}
assets::Handle
Type-safe smart pointer for assets.
Definition
core_types.hpp:149
toast::Node3D
Definition
node_3d.hpp:25
toast::Reflect
Definition
reflect.hpp:244
ui::UIBindStore
Persistent values shared by Lua and the active RmlUi data model.
Definition
ui_binds.hpp:33
ui::UIBinds
Definition
ui_binds.hpp:52
node_3d.hpp
Node with 3D spatial transforms.
assets.hpp
Aggregate header for the UI asset types.
engine
src
toast
ui
nodes
panel_3d.hpp
Generated by
1.17.0