Unravel Engine C++ Reference
Loading...
Searching...
No Matches
script_interop.cpp
Go to the documentation of this file.
1#include "script_interop.h"
3
5{
6
7template<>
8auto converter::convert(const math::vec2& v) -> dotnetpp_backend::managed_interface::vector2
9{
10 return {v.x, v.y};
11}
12
13template<>
14auto converter::convert(const dotnetpp_backend::managed_interface::vector2& v) -> math::vec2
15{
16 return {v.x, v.y};
17}
18
19template<>
20auto converter::convert(const math::vec3& v) -> dotnetpp_backend::managed_interface::vector3
21{
22 return {v.x, v.y, v.z};
23}
24
25template<>
26auto converter::convert(const dotnetpp_backend::managed_interface::vector3& v) -> math::vec3
27{
28 return {v.x, v.y, v.z};
29}
30
31template<>
32auto converter::convert(const math::vec4& v) -> dotnetpp_backend::managed_interface::vector4
33{
34 return {v.x, v.y, v.z, v.w};
35}
36
37template<>
38auto converter::convert(const dotnetpp_backend::managed_interface::vector4& v) -> math::vec4
39{
40 return {v.x, v.y, v.z, v.w};
41}
42
43template<>
44auto converter::convert(const math::quat& q) -> dotnetpp_backend::managed_interface::quaternion
45{
46 return {q.x, q.y, q.z, q.w};
47}
48
49template<>
50auto converter::convert(const dotnetpp_backend::managed_interface::quaternion& q) -> math::quat
51{
52 return math::quat::wxyz(q.w, q.x, q.y, q.z);
53}
54
55template<>
56auto converter::convert(const math::color& v) -> dotnetpp_backend::managed_interface::color
57{
58 return {v.value.r, v.value.g, v.value.b, v.value.a};
59}
60
61template<>
62auto converter::convert(const dotnetpp_backend::managed_interface::color& v) -> math::color
63{
64 return {v.r, v.g, v.b, v.a};
65}
66
67template<>
68auto converter::convert(const math::bbox& v) -> dotnetpp_backend::managed_interface::bbox
69{
70 return {{v.min.x, v.min.y, v.min.z}, {v.max.x, v.max.y, v.max.z}};
71}
72
73template<>
74auto converter::convert(const dotnetpp_backend::managed_interface::bbox& v) -> math::bbox
75{
76 return {{v.min.x, v.min.y, v.min.z}, {v.max.x, v.max.y, v.max.z}};
77}
78
79} // namespace managed_interface
80
81auto dotnet_converter<dotnetpp_backend::managed_interface::ui_event_base>::create_instance(const std::string& namespace_name,
82 const std::string& type_name)
83 -> dotnet::object
84{
85 auto& ctx = unravel::engine::context();
86 auto app_assembly = ctx.get_cached<unravel::script_system>().get_engine_assembly();
87 auto type = app_assembly.get_type(namespace_name, type_name);
88 return type.new_instance();
89}
texture_job_type type
Storage for box vector values and wraps up common functionality.
Definition bbox.h:21
static auto context() -> rtti::context &
Definition engine.cpp:111