Toast Engine
Toggle main menu visibility
Loading...
Searching...
No Matches
lua_types.hpp
Go to the documentation of this file.
1
8
9
#pragma once
10
11
#include <cstdint>
12
#include <format>
13
#include <glm/vec3.hpp>
14
#include <glm/vec4.hpp>
15
#include <string>
16
17
namespace
scripting {
18
22
struct
TypeMarker
{
23
enum class
Kind : uint8_t {
24
node,
25
asset
26
} kind;
27
std::string type_name;
28
29
[[nodiscard]]
30
auto
toString()
const
-> std::string {
31
if
(kind == Kind::node) {
32
return
std::format(
"NodeType({})"
, type_name.empty() ?
"any"
: type_name);
33
}
34
return
std::format(
"AssetType({})"
, type_name.empty() ?
"any"
: type_name);
35
}
36
};
37
44
struct
Color3 {
45
glm::vec3 rgb {0.0f};
46
47
Color3() =
default
;
48
49
Color3(
float
r,
float
g,
float
b) : rgb(r, g, b) { }
50
51
explicit
Color3(
const
glm::vec3& v) : rgb(v) { }
52
53
[[nodiscard]]
54
auto
toString()
const
-> std::string {
55
return
std::format(
"color3({}, {}, {})"
, rgb.r, rgb.g, rgb.b);
56
}
57
};
58
59
// Variant of Color3 but with alpha channel
60
struct
Color4 {
61
glm::vec4 rgba {0.0f};
62
63
Color4() =
default
;
64
65
Color4(
float
r,
float
g,
float
b,
float
a) : rgba(r, g, b, a) { }
66
67
explicit
Color4(
const
glm::vec4& v) : rgba(v) { }
68
69
[[nodiscard]]
70
auto
toString()
const
-> std::string {
71
return
std::format(
"color4({}, {}, {}, {})"
, rgba.r, rgba.g, rgba.b, rgba.a);
72
}
73
};
74
75
}
scripting::TypeMarker
Lua-side placeholder declaring a typed Node or Asset reference.
Definition
lua_types.hpp:22
engine
src
toast
scripting
lua_types.hpp
Generated by
1.17.0