7#include <monopp/mono_exception.h>
8#include <monopp/mono_internal_call.h>
9#include <monopp/mono_jit.h>
10#include <monort/mono_pod_wrapper.h>
11#include <monort/monort.h>
28#include <RmlUi/Core/Element.h>
29#include <RmlUi/Core/ElementDocument.h>
30#include <RmlUi/Core/Variant.h>
31#include <RmlUi/Core/EventListener.h>
32#include <RmlUi/Core/Event.h>
35#include <monopp/mono_method_invoker.h>
50 using converter = mono::managed_interface::converter;
56 const auto pbr = std::static_pointer_cast<pbr_material>(
material);
57 props.
base_color = converter::convert<math::color, mono::managed_interface::color>(pbr->get_base_color());
59 converter::convert<math::color, mono::managed_interface::color>(pbr->get_emissive_color());
60 props.
tiling = converter::convert<math::vec2, mono::managed_interface::vector2>(pbr->get_tiling());
72 using converter = mono::managed_interface::converter;
76 auto pbr = std::static_pointer_cast<pbr_material>(
material);
77 auto base_color = converter::convert<mono::managed_interface::color, math::color>(props.
base_color);
78 pbr->set_base_color(base_color);
80 auto emissive_color = converter::convert<mono::managed_interface::color, math::color>(props.
emissive_color);
81 pbr->set_emissive_color(emissive_color);
83 auto tiling = converter::convert<mono::managed_interface::vector2, math::vec2>(props.
tiling);
84 pbr->set_tiling(tiling);
94 virtual auto get_asset_uuid(
const hpp::uuid& uid)
const -> hpp::uuid = 0;
95 virtual auto get_asset_uuid(
const std::string& key)
const -> hpp::uuid = 0;
99struct mono_asset_impl : mono_asset
101 auto get_asset_uuid(
const hpp::uuid& uid)
const -> hpp::uuid
override
104 auto& am = ctx.get_cached<asset_manager>();
106 auto asset = am.get_asset<T>(uid);
110 auto get_asset_uuid(
const std::string& key)
const -> hpp::uuid
override
113 auto& am = ctx.get_cached<asset_manager>();
115 auto asset = am.get_asset<T>(
key);
120auto get_mono_asset(
size_t type_hash) ->
const mono_asset*
123 static std::map<size_t, std::shared_ptr<mono_asset>> reg =
125 {mono::mono_type::get_hash(
"Unravel.Core.Texture"), std::make_shared<mono_asset_impl<gfx::texture>>()},
126 {mono::mono_type::get_hash(
"Unravel.Core.Material"), std::make_shared<mono_asset_impl<material>>()},
127 {mono::mono_type::get_hash(
"Unravel.Core.Mesh"), std::make_shared<mono_asset_impl<mesh>>()},
128 {mono::mono_type::get_hash(
"Unravel.Core.AnimationClip"), std::make_shared<mono_asset_impl<animation_clip>>()},
129 {mono::mono_type::get_hash(
"Unravel.Core.Prefab"), std::make_shared<mono_asset_impl<prefab>>()},
130 {mono::mono_type::get_hash(
"Unravel.Core.Scene"), std::make_shared<mono_asset_impl<scene_prefab>>()},
131 {mono::mono_type::get_hash(
"Unravel.Core.PhysicsMaterial"), std::make_shared<mono_asset_impl<physics_material>>()},
132 {mono::mono_type::get_hash(
"Unravel.Core.AudioClip"), std::make_shared<mono_asset_impl<audio_clip>>()},
133 {mono::mono_type::get_hash(
"Unravel.Core.Font"), std::make_shared<mono_asset_impl<font>>()}
137 auto it = reg.find(type_hash);
140 return it->second.get();
142 static const mono_asset* empty{};
146auto get_entity_from_id(entt::entity
id) -> entt::handle
148 if(
id == entt::entity(0))
154 auto& ec = ctx.get_cached<ecs>();
156 return ec.get_scene().create_handle(
id);
159void raise_invalid_entity_exception()
161 mono::raise_exception(
"System",
"Exception",
"Entity is invalid.");
165void raise_missing_component_exception()
167 mono::raise_exception(
"System",
169 fmt::format(
"Entity does not have component of type {}.", hpp::type_name_str<T>()));
173auto safe_get_component(entt::entity
id) -> T*
175 auto e = get_entity_from_id(
id);
178 raise_invalid_entity_exception();
181 auto comp =
e.try_get<T>();
185 raise_missing_component_exception<T>();
192void internal_m2n_load_scene(
const std::string& key)
195 delay.on_end.connect(
199 auto& ec = ctx.get_cached<ecs>();
200 auto& am = ctx.get_cached<asset_manager>();
202 ec.get_scene().load_from(am.get_asset<scene_prefab>(key));
208void internal_m2n_load_scene_uid(
const hpp::uuid& uid)
211 delay.on_end.connect(
215 auto& ec = ctx.get_cached<ecs>();
216 auto& am = ctx.get_cached<asset_manager>();
218 ec.get_scene().load_from(am.get_asset<scene_prefab>(uid));
224void internal_m2n_create_scene(
const mono::mono_object& this_ptr)
226 mono::ignore(this_ptr);
229void internal_m2n_destroy_scene(
const mono::mono_object& this_ptr)
231 mono::ignore(this_ptr);
234auto internal_m2n_create_entity(
const std::string&
tag) -> entt::entity
237 auto& ec = ctx.get_cached<ecs>();
239 auto e = ec.get_scene().create_entity(
tag);
244auto internal_m2n_create_entity_from_prefab_uid(
const hpp::uuid& uid) -> entt::entity
247 auto& ec = ctx.get_cached<ecs>();
248 auto& am = ctx.get_cached<asset_manager>();
250 auto pfb = am.get_asset<prefab>(uid);
251 auto e = ec.get_scene().instantiate(pfb);
256auto internal_m2n_create_entity_from_prefab_key(
const std::string& key) -> entt::entity
259 auto& ec = ctx.get_cached<ecs>();
260 auto& am = ctx.get_cached<asset_manager>();
262 auto pfb = am.get_asset<prefab>(
key);
263 auto e = ec.get_scene().instantiate(pfb);
268auto internal_m2n_clone_entity(entt::entity
id) -> entt::entity
270 auto e = get_entity_from_id(
id);
274 auto& ec = ctx.get_cached<ecs>();
276 auto cloned = ec.get_scene().clone_entity(e);
277 return cloned.entity();
284auto internal_m2n_destroy_entity_immediate(entt::entity
id) ->
bool
286 auto e = get_entity_from_id(
id);
295auto internal_m2n_destroy_entity(entt::entity
id,
float seconds) ->
bool
297 seconds = std::max(0.0001f, seconds);
300 auto dur = std::chrono::duration_cast<seq::duration_t>(secs);
303 delay.on_end.connect(
306 internal_m2n_destroy_entity_immediate(
id);
314auto internal_m2n_is_entity_valid(entt::entity
id) ->
bool
316 auto e = get_entity_from_id(
id);
317 bool valid =
e.valid();
321auto internal_m2n_find_entity_by_name(
const std::string&
name) -> entt::entity
324 auto& ec = ctx.get_cached<ecs>();
325 auto& scn = ec.get_scene();
326 auto& registry = *scn.registry;
328 auto view = registry.view<tag_component>();
330 for(
const auto& e : view)
332 if(registry.get<tag_component>(e).name ==
name)
342auto internal_m2n_find_entities_by_name(
const std::string&
name) -> hpp::small_vector<entt::entity>
345 auto& ec = ctx.get_cached<ecs>();
346 auto& scn = ec.get_scene();
347 auto& registry = *scn.registry;
349 auto view = registry.view<tag_component>();
351 hpp::small_vector<entt::entity> result;
352 for(
const auto& e : view)
354 if(registry.get<tag_component>(e).name ==
name)
356 result.emplace_back(e);
363auto internal_m2n_find_entity_by_tag(
const std::string&
tag) -> entt::entity
366 auto& ec = ctx.get_cached<ecs>();
367 auto& scn = ec.get_scene();
368 auto& registry = *scn.registry;
370 auto view = registry.view<tag_component>();
372 for(
const auto& e : view)
374 if(registry.get<tag_component>(e).tag ==
tag)
384auto internal_m2n_find_entities_by_tag(
const std::string&
tag) -> hpp::small_vector<entt::entity>
387 auto& ec = ctx.get_cached<ecs>();
388 auto& scn = ec.get_scene();
389 auto& registry = *scn.registry;
391 auto view = registry.view<tag_component>();
393 hpp::small_vector<entt::entity> result;
394 for(
const auto& e : view)
396 if(registry.get<tag_component>(e).tag ==
tag)
398 result.emplace_back(e);
405struct native_comp_lut
411 std::function<bool(
size_t type_hash, entt::handle e)>
add_native;
412 std::function<bool(
size_t type_hash, entt::handle e)>
has_native;
415 static auto get_registry() -> std::unordered_map<size_t, native_comp_lut>&
417 static std::unordered_map<size_t, native_comp_lut> lut;
421 static auto get_action_table(
size_t type_hash) ->
const native_comp_lut&
423 const auto& registry = get_registry();
424 auto it = registry.find(type_hash);
425 if(it != registry.end())
430 static const native_comp_lut empty;
435 static auto register_native_component(
const std::string&
name)
437 size_t hash = mono::mono_type::get_hash(
name);
439 lut.add_native = [hash](
size_t type_hash, entt::handle
e)
441 if(type_hash == hash)
443 auto& native =
e.get_or_emplace<T>();
450 lut.has_native = [hash](
size_t type_hash, entt::handle
e)
452 if(type_hash == hash)
454 return e.all_of<T>();
460 lut.remove_native = [hash](
size_t type_hash, entt::handle
e)
462 if(type_hash == hash)
464 return e.remove<T>() > 0;
470 get_registry()[hash] = lut;
474int register_componetns = []()
476 native_comp_lut::register_native_component<transform_component>(
"Unravel.Core.TransformComponent");
477 native_comp_lut::register_native_component<id_component>(
"Unravel.Core.IdComponent");
478 native_comp_lut::register_native_component<model_component>(
"Unravel.Core.ModelComponent");
479 native_comp_lut::register_native_component<camera_component>(
"Unravel.Core.CameraComponent");
480 native_comp_lut::register_native_component<light_component>(
"Unravel.Core.LightComponent");
481 native_comp_lut::register_native_component<reflection_probe_component>(
"Unravel.Core.ReflectionProbeComponent");
482 native_comp_lut::register_native_component<physics_component>(
"Unravel.Core.PhysicsComponent");
483 native_comp_lut::register_native_component<animation_component>(
"Unravel.Core.AnimationComponent");
484 native_comp_lut::register_native_component<audio_listener_component>(
"Unravel.Core.AudioListenerComponent");
485 native_comp_lut::register_native_component<audio_source_component>(
"Unravel.Core.AudioSourceComponent");
486 native_comp_lut::register_native_component<bone_component>(
"Unravel.Core.BoneComponent");
487 native_comp_lut::register_native_component<submesh_component>(
"Unravel.Core.SubmeshComponent");
488 native_comp_lut::register_native_component<text_component>(
"Unravel.Core.TextComponent");
489 native_comp_lut::register_native_component<ui_document_component>(
"Unravel.Core.UIDocumentComponent");
494auto internal_add_native_component(
const mono::mono_type&
type, entt::handle e, script_component& script_comp)
499 const auto& type_hash =
type.get_hash();
502 const auto& lut = native_comp_lut::get_action_table(type_hash);
505 add = lut.add_native(type_hash, e);
510 auto comp = script_comp.get_native_component(
type);
514 comp = script_comp.add_native_component(
type);
516 return static_cast<mono::mono_object&
>(comp.scoped->object);
522auto internal_get_native_component_impl(
const mono::mono_type&
type,
524 script_component& script_comp,
525 bool exists) -> mono::mono_object
527 auto comp = script_comp.get_native_component(
type);
532 comp = script_comp.add_native_component(
type);
534 return static_cast<mono::mono_object&
>(comp.scoped->object);
539 script_comp.remove_native_component(comp.scoped->object);
545auto internal_get_native_component(
const mono::mono_type&
type, entt::handle e, script_component& script_comp)
548 const auto& type_hash =
type.get_hash();
554 const auto& lut = native_comp_lut::get_action_table(type_hash);
557 has = lut.has_native(type_hash, e);
563 return internal_get_native_component_impl(
type, e, script_comp, has);
569auto internal_remove_native_component(
const mono::mono_object& obj, entt::handle e, script_component& script_comp)
572 const auto&
type = obj.get_type();
573 const auto& type_hash =
type.get_hash();
577 bool removed =
false;
578 const auto& lut = native_comp_lut::get_action_table(type_hash);
581 removed = lut.remove_native(type_hash, e);
586 return script_comp.remove_native_component(obj);
592auto internal_remove_native_component(
const mono::mono_type&
type, entt::handle e, script_component& script_comp)
595 const auto& type_hash =
type.get_hash();
599 bool removed =
false;
600 const auto& lut = native_comp_lut::get_action_table(type_hash);
603 removed = lut.remove_native(type_hash, e);
608 return script_comp.remove_native_component(
type);
614auto internal_m2n_add_component(entt::entity
id,
const mono::mono_type&
type) -> mono::mono_object
616 auto e = get_entity_from_id(
id);
619 raise_invalid_entity_exception();
622 auto& script_comp =
e.get_or_emplace<script_component>();
624 if(
auto native_comp = internal_add_native_component(
type, e, script_comp))
629 auto component = script_comp.add_script_component(
type);
630 return static_cast<mono::mono_object&
>(component.scoped->object);
633auto internal_m2n_get_component(entt::entity
id,
const mono::mono_type&
type) -> mono::mono_object
635 auto e = get_entity_from_id(
id);
638 raise_invalid_entity_exception();
642 auto& script_comp =
e.get_or_emplace<script_component>();
644 if(
auto native_comp = internal_get_native_component(
type, e, script_comp))
649 auto component = script_comp.get_script_component(
type);
653 return static_cast<mono::mono_object&
>(component.scoped->object);
659auto internal_m2n_get_components(entt::entity
id,
const mono::mono_type&
type) -> std::vector<mono::mono_object>
661 auto e = get_entity_from_id(
id);
664 raise_invalid_entity_exception();
668 auto& script_comp =
e.get_or_emplace<script_component>();
670 if(
auto native_comp = internal_get_native_component(
type, e, script_comp))
672 return {native_comp};
675 return script_comp.get_script_components(
type);
678auto internal_m2n_get_component_in_children(entt::entity
id,
const mono::mono_type&
type) -> mono::mono_object
680 if(
auto comp = safe_get_component<transform_component>(
id))
682 const auto& children = comp->get_children();
683 for(
const auto& child : children)
685 if(
auto result = internal_m2n_get_component(child,
type))
695auto internal_m2n_get_components_in_children(entt::entity
id,
const mono::mono_type&
type)
696 -> hpp::small_vector<mono::mono_object>
698 hpp::small_vector<mono::mono_object> components;
699 if(
auto comp = safe_get_component<transform_component>(
id))
701 const auto& children = comp->get_children();
702 for(
const auto& child : children)
704 auto child_components = internal_m2n_get_components(child,
type);
705 std::move(child_components.begin(), child_components.end(), std::back_inserter(components));
711auto internal_m2n_get_transform_component(entt::entity
id,
const mono::mono_type&
type) -> mono::mono_object
713 auto e = get_entity_from_id(
id);
716 raise_invalid_entity_exception();
720 auto& script_comp =
e.get_or_emplace<script_component>();
721 return internal_get_native_component_impl(
type, e, script_comp,
true);
724auto internal_m2n_get_name(entt::entity
id) ->
const std::string&
726 if(
auto comp = safe_get_component<tag_component>(
id))
731 static const std::string empty;
735void internal_m2n_set_name(entt::entity
id,
const std::string&
name)
737 if(
auto comp = safe_get_component<tag_component>(
id))
743auto internal_m2n_get_tag(entt::entity
id) ->
const std::string&
745 if(
auto comp = safe_get_component<tag_component>(
id))
750 static const std::string empty;
754void internal_m2n_set_tag(entt::entity
id,
const std::string&
tag)
756 if(
auto comp = safe_get_component<tag_component>(
id))
762auto internal_m2n_get_layers(entt::entity
id) ->
int
764 if(
auto comp = safe_get_component<layer_component>(
id))
766 return comp->layers.mask;
772void internal_m2n_set_layers(entt::entity
id,
int mask)
774 if(
auto comp = safe_get_component<layer_component>(
id))
776 comp->layers.mask = mask;
780auto internal_m2n_get_active_global(entt::entity
id) ->
bool
782 if(
auto comp = safe_get_component<transform_component>(
id))
784 return comp->is_active_global();
790auto internal_m2n_get_active_local(entt::entity
id) ->
bool
792 if(
auto comp = safe_get_component<transform_component>(
id))
794 return comp->is_active();
800void internal_m2n_set_active_local(entt::entity
id,
bool active)
802 if(
auto comp = safe_get_component<transform_component>(
id))
804 comp->set_active(active);
808auto internal_m2n_has_component(entt::entity
id,
const mono::mono_type&
type) ->
bool
810 auto comp = internal_m2n_get_component(
id,
type);
815auto internal_m2n_remove_component_instance(entt::entity
id,
const mono::mono_object& comp) ->
bool
817 auto e = get_entity_from_id(
id);
820 raise_invalid_entity_exception();
823 auto& script_comp =
e.get_or_emplace<script_component>();
825 if(internal_remove_native_component(comp, e, script_comp))
830 return script_comp.remove_script_component(comp);
833auto internal_m2n_remove_component_instance_delay(entt::entity
id,
const mono::mono_object& comp,
float seconds_delay)
837 auto dur = std::chrono::duration_cast<seq::duration_t>(secs);
840 delay.on_end.connect(
843 internal_m2n_remove_component_instance(
id, comp);
851auto internal_m2n_remove_component(entt::entity
id,
const mono::mono_type&
type) ->
bool
853 auto e = get_entity_from_id(
id);
856 raise_invalid_entity_exception();
859 auto& script_comp =
e.get_or_emplace<script_component>();
861 if(internal_remove_native_component(
type, e, script_comp))
866 return script_comp.remove_script_component(
type);
869auto internal_m2n_remove_component_delay(entt::entity
id,
const mono::mono_type&
type,
float seconds_delay) ->
bool
872 auto dur = std::chrono::duration_cast<seq::duration_t>(secs);
875 delay.on_end.connect(
878 internal_m2n_remove_component(
id,
type);
900void internal_m2n_log_trace(
const std::string& message,
const std::string& func,
const std::string& file,
int line)
905void internal_m2n_log_info(
const std::string& message,
const std::string& func,
const std::string& file,
int line)
910void internal_m2n_log_warning(
const std::string& message,
const std::string& func,
const std::string& file,
int line)
915void internal_m2n_log_error(
const std::string& message,
const std::string& func,
const std::string& file,
int line)
922void internal_m2n_application_quit()
925 delay.on_end.connect(
929 auto& ev = ctx.get_cached<events>();
930 ev.set_play_mode(ctx,
false);
936void internal_m2n_set_time_scale(
float scale)
939 auto& sim = ctx.get_cached<simulation>();
940 sim.set_time_scale(
scale);
956auto internal_m2n_get_children(entt::entity
id) -> hpp::small_vector<entt::entity>
958 if(
auto comp = safe_get_component<transform_component>(
id))
960 const auto& children = comp->get_children();
961 hpp::small_vector<entt::entity> children_id;
962 children_id.reserve(children.size());
963 for(
const auto& child : children)
965 children_id.emplace_back(child.entity());
980auto internal_m2n_get_child(entt::entity
id,
const std::string& path,
bool recursive) -> entt::entity
982 auto root = get_entity_from_id(
id);
983 if(!root || path.empty())
992 hpp::small_vector<node_candidate> queue;
994 queue.push_back({root, 0});
997 for(
size_t idx = 0; idx < queue.size(); ++idx)
999 auto candidate = queue[idx];
1000 bool advanced =
false;
1003 if(candidate.matched_index < parts.size())
1005 if(
auto tag_comp = safe_get_component<tag_component>(candidate.entity))
1007 if(tag_comp->name == parts[candidate.matched_index])
1009 candidate.matched_index++;
1011 if(candidate.matched_index == parts.size())
1013 return candidate.entity;
1022 bool should_enqueue = recursive ? (candidate.matched_index == 0 || advanced) : (candidate.
matched_index == 0);
1026 if(
auto trans_comp = safe_get_component<transform_component>(candidate.entity))
1028 for(
const auto& child : trans_comp->get_children())
1030 queue.push_back({child.entity(), candidate.matched_index});
1039auto internal_m2n_get_parent(entt::entity
id) -> entt::entity
1041 if(
auto comp = safe_get_component<transform_component>(
id))
1043 return comp->get_parent().entity();
1049void internal_m2n_set_parent(entt::entity
id, entt::entity new_parent,
bool global_stays)
1051 if(
auto comp = safe_get_component<transform_component>(
id))
1053 auto parent = get_entity_from_id(new_parent);
1054 comp->set_parent(parent, global_stays);
1058auto internal_m2n_get_position_global(entt::entity
id) -> math::vec3
1060 if(
auto comp = safe_get_component<transform_component>(
id))
1062 return comp->get_position_global();
1068void internal_m2n_set_position_global(entt::entity
id,
const math::vec3& value)
1070 if(
auto comp = safe_get_component<transform_component>(
id))
1072 comp->set_position_global(value);
1076void internal_m2n_move_by_global(entt::entity
id,
const math::vec3& value)
1078 if(
auto comp = safe_get_component<transform_component>(
id))
1080 comp->move_by_global(value);
1084auto internal_m2n_get_position_local(entt::entity
id) -> math::vec3
1086 if(
auto comp = safe_get_component<transform_component>(
id))
1088 return comp->get_position_local();
1094void internal_m2n_set_position_local(entt::entity
id,
const math::vec3& value)
1096 if(
auto comp = safe_get_component<transform_component>(
id))
1098 comp->set_position_local(value);
1102void internal_m2n_move_by_local(entt::entity
id,
const math::vec3& value)
1104 if(
auto comp = safe_get_component<transform_component>(
id))
1106 comp->move_by_local(value);
1111auto internal_m2n_get_rotation_euler_global(entt::entity
id) -> math::vec3
1113 if(
auto comp = safe_get_component<transform_component>(
id))
1115 return comp->get_rotation_euler_global();
1121void internal_m2n_rotate_by_euler_global(entt::entity
id,
const math::vec3& amount)
1123 if(
auto comp = safe_get_component<transform_component>(
id))
1125 comp->rotate_by_euler_global(amount);
1129void internal_m2n_rotate_axis_global(entt::entity
id,
float degrees,
const math::vec3& axis)
1131 if(
auto comp = safe_get_component<transform_component>(
id))
1133 comp->rotate_axis_global(degrees, axis);
1137auto internal_m2n_transform_vector_global(entt::entity
id,
const math::vec3& coord) -> math::vec3
1139 if(
auto comp = safe_get_component<transform_component>(
id))
1141 const auto& global = comp->get_transform_global();
1142 return global.transform_coord(coord);
1148auto internal_m2n_inverse_transform_vector_global(entt::entity
id,
const math::vec3& coord) -> math::vec3
1150 if(
auto comp = safe_get_component<transform_component>(
id))
1152 const auto& global = comp->get_transform_global();
1153 return global.inverse_transform_coord(coord);
1159auto internal_m2n_transform_direction_global(entt::entity
id,
const math::vec3& direction) -> math::vec3
1161 if(
auto comp = safe_get_component<transform_component>(
id))
1163 const auto& global = comp->get_transform_global();
1164 return global.transform_normal(direction);
1170auto internal_m2n_inverse_transform_direction_global(entt::entity
id,
const math::vec3& direction) -> math::vec3
1172 if(
auto comp = safe_get_component<transform_component>(
id))
1174 const auto& global = comp->get_transform_global();
1175 return global.inverse_transform_normal(direction);
1181void internal_m2n_look_at(entt::entity
id,
const math::vec3&
point,
const math::vec3& up)
1183 if(
auto comp = safe_get_component<transform_component>(
id))
1185 comp->look_at(
point, up);
1189void internal_m2n_set_rotation_euler_global(entt::entity
id,
const math::vec3& value)
1191 if(
auto comp = safe_get_component<transform_component>(
id))
1193 comp->set_rotation_euler_global(value);
1197auto internal_m2n_get_rotation_euler_local(entt::entity
id) -> math::vec3
1199 if(
auto comp = safe_get_component<transform_component>(
id))
1201 return comp->get_rotation_euler_local();
1207void internal_m2n_set_rotation_euler_local(entt::entity
id,
const math::vec3& value)
1209 if(
auto comp = safe_get_component<transform_component>(
id))
1211 comp->set_rotation_euler_local(value);
1215void internal_m2n_rotate_by_euler_local(entt::entity
id,
const math::vec3& amount)
1217 if(
auto comp = safe_get_component<transform_component>(
id))
1219 comp->rotate_by_euler_local(amount);
1223auto internal_m2n_get_rotation_global(entt::entity
id) -> math::quat
1225 if(
auto comp = safe_get_component<transform_component>(
id))
1227 return comp->get_rotation_global();
1233void internal_m2n_set_rotation_global(entt::entity
id,
const math::quat& value)
1235 if(
auto comp = safe_get_component<transform_component>(
id))
1237 comp->set_rotation_global(value);
1241void internal_m2n_rotate_by_global(entt::entity
id,
const math::quat& amount)
1243 if(
auto comp = safe_get_component<transform_component>(
id))
1245 comp->rotate_by_global(amount);
1249auto internal_m2n_get_rotation_local(entt::entity
id) -> math::quat
1251 if(
auto comp = safe_get_component<transform_component>(
id))
1253 return comp->get_rotation_local();
1259void internal_m2n_set_rotation_local(entt::entity
id,
const math::quat& value)
1261 if(
auto comp = safe_get_component<transform_component>(
id))
1263 comp->set_rotation_local(value);
1267void internal_m2n_rotate_by_local(entt::entity
id,
const math::quat& amount)
1269 if(
auto comp = safe_get_component<transform_component>(
id))
1271 comp->rotate_by_local(amount);
1276auto internal_m2n_get_scale_global(entt::entity
id) -> math::vec3
1278 if(
auto comp = safe_get_component<transform_component>(
id))
1280 return comp->get_scale_global();
1286void internal_m2n_set_scale_global(entt::entity
id,
const math::vec3& value)
1288 if(
auto comp = safe_get_component<transform_component>(
id))
1290 comp->set_scale_global(value);
1294void internal_m2n_scale_by_global(entt::entity
id,
const math::vec3& amount)
1296 if(
auto comp = safe_get_component<transform_component>(
id))
1298 comp->scale_by_global(amount);
1302auto internal_m2n_get_scale_local(entt::entity
id) -> math::vec3
1304 if(
auto comp = safe_get_component<transform_component>(
id))
1306 return comp->get_scale_local();
1312void internal_m2n_set_scale_local(entt::entity
id,
const math::vec3& value)
1314 if(
auto comp = safe_get_component<transform_component>(
id))
1316 comp->set_scale_local(value);
1320void internal_m2n_scale_by_local(entt::entity
id,
const math::vec3& amount)
1322 if(
auto comp = safe_get_component<transform_component>(
id))
1324 comp->scale_by_local(amount);
1329auto internal_m2n_get_skew_global(entt::entity
id) -> math::vec3
1331 if(
auto comp = safe_get_component<transform_component>(
id))
1333 return comp->get_skew_global();
1339void internal_m2n_setl_skew_globa(entt::entity
id,
const math::vec3& value)
1341 if(
auto comp = safe_get_component<transform_component>(
id))
1343 comp->set_skew_global(value);
1347auto internal_m2n_get_skew_local(entt::entity
id) -> math::vec3
1349 if(
auto comp = safe_get_component<transform_component>(
id))
1351 return comp->get_skew_local();
1357void internal_m2n_set_skew_local(entt::entity
id,
const math::vec3& value)
1359 if(
auto comp = safe_get_component<transform_component>(
id))
1361 comp->set_skew_local(value);
1367void internal_m2n_physics_apply_explosion_force(entt::entity
id,
1368 float explosion_force,
1369 const math::vec3& explosion_position,
1370 float explosion_radius,
1371 float upwards_modifier,
1374 if(
auto comp = safe_get_component<physics_component>(
id))
1376 comp->apply_explosion_force(explosion_force, explosion_position, explosion_radius, upwards_modifier, mode);
1379void internal_m2n_physics_apply_force(entt::entity
id,
const math::vec3& value,
force_mode mode)
1381 if(
auto comp = safe_get_component<physics_component>(
id))
1383 comp->apply_force(value, mode);
1387void internal_m2n_physics_apply_torque(entt::entity
id,
const math::vec3& value,
force_mode mode)
1389 if(
auto comp = safe_get_component<physics_component>(
id))
1391 comp->apply_torque(value, mode);
1395auto internal_m2n_physics_get_velocity(entt::entity
id) -> math::vec3
1397 if(
auto comp = safe_get_component<physics_component>(
id))
1399 return comp->get_velocity();
1405void internal_m2n_physics_set_velocity(entt::entity
id,
const math::vec3&
velocity)
1407 if(
auto comp = safe_get_component<physics_component>(
id))
1413auto internal_m2n_physics_get_angular_velocity(entt::entity
id) -> math::vec3
1415 if(
auto comp = safe_get_component<physics_component>(
id))
1417 return comp->get_angular_velocity();
1423void internal_m2n_physics_set_angular_velocity(entt::entity
id,
const math::vec3&
velocity)
1425 if(
auto comp = safe_get_component<physics_component>(
id))
1427 comp->set_angular_velocity(
velocity);
1431auto internal_m2n_physics_get_include_layers(entt::entity
id) ->
layer_mask
1433 if(
auto comp = safe_get_component<physics_component>(
id))
1435 return comp->get_collision_include_mask();
1441void internal_m2n_physics_set_include_layers(entt::entity
id,
layer_mask mask)
1443 if(
auto comp = safe_get_component<physics_component>(
id))
1445 comp->set_collision_include_mask(mask);
1449auto internal_m2n_physics_get_exclude_layers(entt::entity
id) ->
layer_mask
1451 if(
auto comp = safe_get_component<physics_component>(
id))
1453 return comp->get_collision_exclude_mask();
1459void internal_m2n_physics_set_exclude_layers(entt::entity
id,
layer_mask mask)
1461 if(
auto comp = safe_get_component<physics_component>(
id))
1463 comp->set_collision_exclude_mask(mask);
1467auto internal_m2n_physics_get_collision_layers(entt::entity
id) ->
layer_mask
1469 if(
auto comp = safe_get_component<physics_component>(
id))
1471 return comp->get_collision_mask();
1478void internal_m2n_animation_blend(entt::entity
id,
int layer, hpp::uuid guid,
float seconds,
bool loop,
bool phase_sync)
1480 if(
auto comp = safe_get_component<animation_component>(
id))
1483 auto& am = ctx.get_cached<asset_manager>();
1485 auto asset = am.get_asset<animation_clip>(guid);
1490void internal_m2n_animation_play(entt::entity
id)
1492 if(
auto comp = safe_get_component<animation_component>(
id))
1494 comp->get_player().play();
1498void internal_m2n_animation_pause(entt::entity
id)
1500 if(
auto comp = safe_get_component<animation_component>(
id))
1502 comp->get_player().pause();
1506void internal_m2n_animation_resume(entt::entity
id)
1508 if(
auto comp = safe_get_component<animation_component>(
id))
1510 comp->get_player().resume();
1514void internal_m2n_animation_stop(entt::entity
id)
1516 if(
auto comp = safe_get_component<animation_component>(
id))
1518 comp->get_player().stop();
1522void internal_m2n_animation_set_speed(entt::entity
id,
float speed)
1524 if(
auto comp = safe_get_component<animation_component>(
id))
1526 comp->set_speed(speed);
1530auto internal_m2n_animation_get_speed(entt::entity
id) ->
float
1532 if(
auto comp = safe_get_component<animation_component>(
id))
1534 return comp->get_speed();
1540auto internal_m2n_camera_screen_point_to_ray(entt::entity
id,
1541 const math::vec2& origin,
1544 if(
auto comp = safe_get_component<camera_component>(
id))
1546 math::vec3 ray_origin{};
1547 math::vec3 ray_dir{};
1548 bool result = comp->get_camera().viewport_to_ray(origin, ray_origin, ray_dir);
1551 using converter = mono::managed_interface::converter;
1552 managed_ray->origin = converter::convert<math::vec3, mono::managed_interface::vector3>(ray_origin);
1553 managed_ray->direction = converter::convert<math::vec3, mono::managed_interface::vector3>(ray_dir);
1561auto internal_m2n_model_get_enabled(entt::entity
id) ->
bool
1563 if(
auto comp = safe_get_component<model_component>(
id))
1565 return comp->is_enabled();
1571void internal_m2n_model_set_enabled(entt::entity
id,
bool enabled)
1573 if(
auto comp = safe_get_component<model_component>(
id))
1575 comp->set_enabled(enabled);
1579auto internal_m2n_model_get_shared_material(entt::entity
id, uint32_t index) -> hpp::uuid
1581 if(
auto comp = safe_get_component<model_component>(
id))
1583 return comp->get_model().get_material(index).uid();
1589auto internal_m2n_model_get_shared_material_count(entt::entity
id) ->
int
1591 if(
auto comp = safe_get_component<model_component>(
id))
1593 return comp->get_model().get_materials().size();
1599auto internal_m2n_model_get_material_instance(entt::entity
id, uint32_t index)
1602 if(
auto comp = safe_get_component<model_component>(
id))
1604 auto instance = comp->get_model().get_material_instance(index);
1605 return get_material_properties(instance);
1611void internal_m2n_model_set_shared_material(entt::entity
id,
const hpp::uuid& uid, uint32_t index)
1613 if(
auto comp = safe_get_component<model_component>(
id))
1616 auto& am = ctx.get_cached<asset_manager>();
1617 auto asset = am.get_asset<
material>(uid);
1619 auto model = comp->get_model();
1620 model.set_material(asset, index);
1621 comp->set_model(model);
1625void internal_m2n_model_set_material_instance(entt::entity
id,
1629 using converter = mono::managed_interface::converter;
1631 if(
auto comp = safe_get_component<model_component>(
id))
1633 auto model = comp->get_model();
1637 auto material = model.get_or_emplace_material_instance(index);
1638 set_material_properties(
material, props);
1639 model.set_material_instance(
material, index);
1643 model.set_material_instance(
nullptr, index);
1645 comp->set_model(model);
1649auto internal_m2n_model_get_material_instance_count(entt::entity
id) ->
int
1651 if(
auto comp = safe_get_component<model_component>(
id))
1653 return comp->get_model().get_material_instances().size();
1660auto internal_m2n_text_get_text(entt::entity
id) ->
const std::string&
1662 if(
auto comp = safe_get_component<text_component>(
id))
1664 return comp->get_text();
1667 static const std::string empty;
1671void internal_m2n_text_set_text(entt::entity
id,
const std::string& text)
1673 if(
auto comp = safe_get_component<text_component>(
id))
1675 comp->set_text(text);
1681 if(
auto comp = safe_get_component<text_component>(
id))
1683 return comp->get_buffer_type();
1691 if(
auto comp = safe_get_component<text_component>(
id))
1693 comp->set_buffer_type(
type);
1699 if(
auto comp = safe_get_component<text_component>(
id))
1701 return comp->get_overflow_type();
1709 if(
auto comp = safe_get_component<text_component>(
id))
1711 comp->set_overflow_type(
type);
1715auto internal_m2n_text_get_font(entt::entity
id) -> hpp::uuid
1717 if(
auto comp = safe_get_component<text_component>(
id))
1719 return comp->get_font().uid();
1725void internal_m2n_text_set_font(entt::entity
id, hpp::uuid uid)
1727 if(
auto comp = safe_get_component<text_component>(
id))
1730 auto& am = ctx.get_cached<asset_manager>();
1732 auto asset = am.get_asset<
font>(uid);
1733 comp->set_font(asset);
1737auto internal_m2n_text_get_font_size(entt::entity
id) -> uint32_t
1739 if(
auto comp = safe_get_component<text_component>(
id))
1741 return comp->get_font_size();
1747void internal_m2n_text_set_font_size(entt::entity
id, uint32_t font_size)
1749 if(
auto comp = safe_get_component<text_component>(
id))
1751 comp->set_font_size(font_size);
1755auto internal_m2n_text_get_render_font_size(entt::entity
id) -> uint32_t
1757 if(
auto comp = safe_get_component<text_component>(
id))
1759 return comp->get_render_font_size();
1765auto internal_m2n_text_get_auto_size(entt::entity
id) ->
bool
1767 if(
auto comp = safe_get_component<text_component>(
id))
1769 return comp->get_auto_size();
1775void internal_m2n_text_set_auto_size(entt::entity
id,
bool auto_size)
1777 if(
auto comp = safe_get_component<text_component>(
id))
1779 comp->set_auto_size(auto_size);
1782auto internal_m2n_text_get_auto_size_range(entt::entity
id) ->
urange32_t
1784 if(
auto comp = safe_get_component<text_component>(
id))
1786 return comp->get_auto_size_range();
1792void internal_m2n_text_set_auto_size_range(entt::entity
id,
urange32_t range)
1794 if(
auto comp = safe_get_component<text_component>(
id))
1796 comp->set_auto_size_range(
range);
1800auto internal_m2n_text_get_area(entt::entity
id) -> math::vec2
1802 if(
auto comp = safe_get_component<text_component>(
id))
1804 auto area = comp->get_area();
1805 return {area.width, area.height};
1811void internal_m2n_text_set_area(entt::entity
id, math::vec2 area)
1813 if(
auto comp = safe_get_component<text_component>(
id))
1815 comp->set_area({area.x, area.y});
1819auto internal_m2n_text_get_render_area(entt::entity
id) -> math::vec2
1821 if(
auto comp = safe_get_component<text_component>(
id))
1823 auto area = comp->get_render_area();
1824 return {area.width, area.height};
1830auto internal_m2n_text_get_is_rich_text(entt::entity
id) ->
bool
1832 if(
auto comp = safe_get_component<text_component>(
id))
1834 return comp->get_is_rich_text();
1840void internal_m2n_text_set_is_rich_text(entt::entity
id,
bool rich)
1842 if(
auto comp = safe_get_component<text_component>(
id))
1844 comp->set_is_rich_text(rich);
1848auto internal_m2n_text_get_alignment(entt::entity
id) -> uint32_t
1850 if(
auto comp = safe_get_component<text_component>(
id))
1852 return comp->get_alignment().flags;
1855 return alignment{}.flags;
1858void internal_m2n_text_set_alignment(entt::entity
id, uint32_t alignment_flags)
1860 if(
auto comp = safe_get_component<text_component>(
id))
1862 comp->set_alignment({alignment_flags});
1866auto internal_m2n_text_get_bounds(entt::entity
id) ->
math::bbox
1868 if(
auto comp = safe_get_component<text_component>(
id))
1870 return comp->get_bounds();
1876auto internal_m2n_text_get_render_bounds(entt::entity
id) ->
math::bbox
1878 if(
auto comp = safe_get_component<text_component>(
id))
1880 return comp->get_render_bounds();
1887void internal_m2n_light_set_color(entt::entity
id,
const math::color& color)
1889 if(
auto comp = safe_get_component<light_component>(
id))
1891 auto l = comp->get_light();
1897auto internal_m2n_light_get_color(entt::entity
id) ->
math::color
1899 if(
auto comp = safe_get_component<light_component>(
id))
1901 return comp->get_light().color;
1908auto internal_m2n_from_euler_rad(
const math::vec3& euler) -> math::quat
1913auto internal_m2n_to_euler_rad(
const math::quat& euler) -> math::vec3
1915 return math::eulerAngles(euler);
1918auto internal_m2n_angle_axis(
float angle,
const math::vec3& axis) -> math::quat
1920 return math::angleAxis(angle, axis);
1923auto internal_m2n_look_rotation(
const math::vec3& forward,
const math::vec3& up) -> math::quat
1928auto internal_m2n_from_to_rotation(
const math::vec3& from,
const math::vec3& to) -> math::quat
1933auto internal_m2n_get_asset_by_uuid(
const hpp::uuid& uid,
const mono::mono_type&
type) -> hpp::uuid
1935 if(
auto asset = get_mono_asset(
type.get_hash()))
1937 return asset->get_asset_uuid(uid);
1943auto internal_m2n_get_asset_by_key(
const std::string& key,
const mono::mono_type&
type) -> hpp::uuid
1945 if(
auto asset = get_mono_asset(
type.get_hash()))
1947 return asset->get_asset_uuid(key);
1955 using converter = mono::managed_interface::converter;
1958 auto& am = ctx.get_cached<asset_manager>();
1961 auto asset = am.get_asset<
material>(uid);
1968 return get_material_properties(
material);
1971auto internal_m2n_audio_clip_get_length(
const hpp::uuid& uid) ->
float
1974 auto& am = ctx.get_cached<asset_manager>();
1976 auto asset = am.get_asset<audio_clip>(uid);
1978 if(asset.is_valid())
1980 if(
auto clip = asset.get())
1982 float secs = clip->get_info().duration.count();
1989auto m2n_test_uuid(
const hpp::uuid& uid) -> hpp::uuid
1991 APPLOG_INFO(
"{}:: From C# {}", __func__, hpp::to_string(uid));
1994 APPLOG_INFO(
"{}:: New C++ {}", __func__, hpp::to_string(newuid));
1999void internal_m2n_gizmos_add_sphere(
const math::color& color,
const math::vec3& position,
float radius)
2002 auto& path = ctx.get_cached<rendering_system>();
2003 path.add_debugdraw_call(
2011 sphere.center.x = position.x;
2012 sphere.center.y = position.y;
2013 sphere.center.z = position.z;
2019void internal_m2n_gizmos_add_ray(
const math::color& color,
2020 const math::vec3& position,
2021 const math::vec3& direction,
2025 auto& path = ctx.get_cached<rendering_system>();
2026 path.add_debugdraw_call(
2027 [color, position, direction, max_distance](
gfx::dd_raii& dd)
2034 ray.pos.x = position.x;
2035 ray.pos.y = position.y;
2036 ray.pos.z = position.z;
2038 ray.dir.x = direction.x;
2039 ray.dir.y = direction.y;
2040 ray.dir.z = direction.z;
2049auto internal_m2n_layers_layer_to_name(
int layer) ->
const std::string&
2052 auto& csettings = ctx.get<settings>();
2054 if(
layer >= csettings.layer.layers.size())
2056 mono::raise_exception(
"System",
"Exception", fmt::format(
"Layer index {} is out of bounds.",
layer));
2058 static const std::string empty;
2061 return csettings.layer.layers[
layer];
2064auto internal_m2n_layers_name_to_layer(
const std::string&
name) ->
int
2067 auto& csettings = ctx.get<settings>();
2069 auto it = std::find(csettings.layer.layers.begin(), csettings.layer.layers.end(),
name);
2070 if(it != csettings.layer.layers.end())
2072 return static_cast<int>(std::distance(csettings.layer.layers.begin(), it));
2078auto internal_m2n_input_get_analog_value(
const std::string&
name) ->
float
2081 auto&
input = ctx.get_cached<input_system>();
2085auto internal_m2n_input_get_digital_value(
const std::string&
name) ->
bool
2088 auto&
input = ctx.get_cached<input_system>();
2092auto internal_m2n_input_is_pressed(
const std::string&
name) ->
bool
2095 auto&
input = ctx.get_cached<input_system>();
2099auto internal_m2n_input_is_released(
const std::string&
name) ->
bool
2102 auto&
input = ctx.get_cached<input_system>();
2106auto internal_m2n_input_is_down(
const std::string&
name) ->
bool
2109 auto&
input = ctx.get_cached<input_system>();
2116 auto&
input = ctx.get_cached<input_system>();
2117 return input.manager.get_keyboard().is_pressed(code);
2123 auto&
input = ctx.get_cached<input_system>();
2124 return input.manager.get_keyboard().is_released(code);
2130 auto&
input = ctx.get_cached<input_system>();
2131 return input.manager.get_keyboard().is_down(code);
2134auto internal_m2n_input_is_mouse_button_pressed(int32_t button) ->
bool
2137 auto&
input = ctx.get_cached<input_system>();
2138 return input.manager.get_mouse().is_pressed(button);
2141auto internal_m2n_input_is_mouse_button_released(int32_t button) ->
bool
2144 auto&
input = ctx.get_cached<input_system>();
2145 return input.manager.get_mouse().is_released(button);
2148auto internal_m2n_input_is_mouse_button_down(int32_t button) ->
bool
2151 auto&
input = ctx.get_cached<input_system>();
2152 return input.manager.get_mouse().is_down(button);
2155auto internal_m2n_input_get_mouse_position() -> math::vec2
2158 auto&
input = ctx.get_cached<input_system>();
2159 auto coord =
input.manager.get_mouse().get_position();
2160 return {coord.x, coord.y};
2166 const math::vec3& origin,
2167 const math::vec3& direction,
2173 auto& physics = ctx.get_cached<physics_system>();
2177 using converter = mono::managed_interface::converter;
2181 hit->entity = ray_hit->entity;
2182 hit->point = converter::convert<math::vec3, mono::managed_interface::vector3>(ray_hit->point);
2183 hit->normal = converter::convert<math::vec3, mono::managed_interface::vector3>(ray_hit->normal);
2184 hit->distance = ray_hit->distance;
2187 return ray_hit.has_value();
2190auto internal_m2n_physics_ray_cast_all(
const math::vec3& origin,
2191 const math::vec3& direction,
2194 bool query_sensors) -> hpp::small_vector<mono::managed_interface::raycast_hit>
2197 auto& physics = ctx.get_cached<physics_system>();
2201 hpp::small_vector<mono::managed_interface::raycast_hit>
hits;
2203 using converter = mono::managed_interface::converter;
2204 for(
const auto& ray_hit : ray_hits)
2206 auto& hit =
hits.emplace_back();
2207 hit.entity = ray_hit.entity;
2208 hit.point = converter::convert<math::vec3, mono::managed_interface::vector3>(ray_hit.point);
2209 hit.normal = converter::convert<math::vec3, mono::managed_interface::vector3>(ray_hit.normal);
2210 hit.distance = ray_hit.distance;
2217 const math::vec3& origin,
2218 const math::vec3& direction,
2225 auto& physics = ctx.get_cached<physics_system>();
2229 using converter = mono::managed_interface::converter;
2233 hit->entity = ray_hit->entity;
2234 hit->point = converter::convert<math::vec3, mono::managed_interface::vector3>(ray_hit->point);
2235 hit->normal = converter::convert<math::vec3, mono::managed_interface::vector3>(ray_hit->normal);
2236 hit->distance = ray_hit->distance;
2239 return ray_hit.has_value();
2242auto internal_m2n_physics_sphere_cast_all(
const math::vec3& origin,
2243 const math::vec3& direction,
2247 bool query_sensors) -> hpp::small_vector<mono::managed_interface::raycast_hit>
2250 auto& physics = ctx.get_cached<physics_system>();
2254 hpp::small_vector<mono::managed_interface::raycast_hit>
hits;
2256 using converter = mono::managed_interface::converter;
2257 for(
const auto& ray_hit : ray_hits)
2259 auto& hit =
hits.emplace_back();
2260 hit.entity = ray_hit.entity;
2261 hit.point = converter::convert<math::vec3, mono::managed_interface::vector3>(ray_hit.point);
2262 hit.normal = converter::convert<math::vec3, mono::managed_interface::vector3>(ray_hit.normal);
2263 hit.distance = ray_hit.distance;
2269auto internal_m2n_physics_sphere_overlap(
const math::vec3& origin,
float radius,
int layer_mask,
bool query_sensors)
2273 auto& physics = ctx.get_cached<physics_system>();
2282auto internal_m2n_audio_source_get_loop(entt::entity
id) ->
bool
2284 if(
auto comp = safe_get_component<audio_source_component>(
id))
2286 return comp->is_looping();
2294void internal_m2n_utils_set_ik_posiiton_ccd(entt::entity
id,
2295 const math::vec3& target,
2296 int num_bones_in_chain,
2300 auto e = get_entity_from_id(
id);
2305void internal_m2n_utils_set_ik_posiiton_fabrik(entt::entity
id,
2306 const math::vec3& target,
2307 int num_bones_in_chain,
2311 auto e = get_entity_from_id(
id);
2316void internal_m2n_utils_set_ik_posiiton_two_bone(entt::entity
id,
2317 const math::vec3& target,
2318 const math::vec3& forward,
2323 auto e = get_entity_from_id(
id);
2328void internal_m2n_utils_set_ik_look_at_posiiton(entt::entity
id,
const math::vec3& target,
float weight)
2330 auto e = get_entity_from_id(
id);
2335void internal_m2n_audio_source_set_loop(entt::entity
id,
bool loop)
2337 if(
auto comp = safe_get_component<audio_source_component>(
id))
2339 comp->set_loop(loop);
2343auto internal_m2n_audio_source_get_volume(entt::entity
id) ->
float
2345 if(
auto comp = safe_get_component<audio_source_component>(
id))
2347 return comp->get_volume();
2353void internal_m2n_audio_source_set_volume(entt::entity
id,
float volume)
2355 if(
auto comp = safe_get_component<audio_source_component>(
id))
2357 comp->set_volume(volume);
2361auto internal_m2n_audio_source_get_pitch(entt::entity
id) ->
float
2363 if(
auto comp = safe_get_component<audio_source_component>(
id))
2365 return comp->get_pitch();
2371void internal_m2n_audio_source_set_pitch(entt::entity
id,
float pitch)
2373 if(
auto comp = safe_get_component<audio_source_component>(
id))
2375 comp->set_pitch(pitch);
2379auto internal_m2n_audio_source_get_volume_rolloff(entt::entity
id) ->
float
2381 if(
auto comp = safe_get_component<audio_source_component>(
id))
2383 return comp->get_volume_rolloff();
2389void internal_m2n_audio_source_set_volume_rolloff(entt::entity
id,
float rolloff)
2391 if(
auto comp = safe_get_component<audio_source_component>(
id))
2393 comp->set_volume_rolloff(rolloff);
2397auto internal_m2n_audio_source_get_min_distance(entt::entity
id) ->
float
2399 if(
auto comp = safe_get_component<audio_source_component>(
id))
2401 return comp->get_range().min;
2407void internal_m2n_audio_source_set_min_distance(entt::entity
id,
float distance)
2409 if(
auto comp = safe_get_component<audio_source_component>(
id))
2411 auto range = comp->get_range();
2413 comp->set_range(
range);
2417auto internal_m2n_audio_source_get_max_distance(entt::entity
id) ->
float
2419 if(
auto comp = safe_get_component<audio_source_component>(
id))
2421 return comp->get_range().max;
2427void internal_m2n_audio_source_set_max_distance(entt::entity
id,
float distance)
2429 if(
auto comp = safe_get_component<audio_source_component>(
id))
2431 auto range = comp->get_range();
2433 comp->set_range(
range);
2437auto internal_m2n_audio_source_get_mute(entt::entity
id) ->
bool
2439 if(
auto comp = safe_get_component<audio_source_component>(
id))
2441 return comp->is_muted();
2447void internal_m2n_audio_source_set_mute(entt::entity
id,
bool mute)
2449 if(
auto comp = safe_get_component<audio_source_component>(
id))
2451 comp->set_mute(mute);
2455auto internal_m2n_audio_source_get_time(entt::entity
id) ->
float
2457 if(
auto comp = safe_get_component<audio_source_component>(
id))
2459 return float(comp->get_playback_position().count());
2465void internal_m2n_audio_source_set_time(entt::entity
id,
float seconds)
2467 if(
auto comp = safe_get_component<audio_source_component>(
id))
2469 comp->set_playback_position(audio::duration_t(seconds));
2473auto internal_m2n_audio_source_is_playing(entt::entity
id) ->
bool
2475 if(
auto comp = safe_get_component<audio_source_component>(
id))
2477 return comp->is_playing();
2483auto internal_m2n_audio_source_is_paused(entt::entity
id) ->
bool
2485 if(
auto comp = safe_get_component<audio_source_component>(
id))
2487 return comp->is_paused();
2493void internal_m2n_audio_source_play(entt::entity
id)
2495 if(
auto comp = safe_get_component<audio_source_component>(
id))
2501void internal_m2n_audio_source_stop(entt::entity
id)
2503 if(
auto comp = safe_get_component<audio_source_component>(
id))
2509void internal_m2n_audio_source_pause(entt::entity
id)
2511 if(
auto comp = safe_get_component<audio_source_component>(
id))
2517void internal_m2n_audio_source_resume(entt::entity
id)
2519 if(
auto comp = safe_get_component<audio_source_component>(
id))
2525auto internal_m2n_audio_source_get_audio_clip(entt::entity
id) -> hpp::uuid
2527 if(
auto comp = safe_get_component<audio_source_component>(
id))
2529 return comp->get_clip().uid();
2535void internal_m2n_audio_source_set_audio_clip(entt::entity
id, hpp::uuid uid)
2537 if(
auto comp = safe_get_component<audio_source_component>(
id))
2540 auto& am = ctx.get_cached<asset_manager>();
2542 auto asset = am.get_asset<audio_clip>(uid);
2543 comp->set_clip(asset);
2563auto internal_m2n_ui_document_get_asset(entt::entity
id) -> hpp::uuid
2565 if(
auto comp = safe_get_component<ui_document_component>(
id))
2567 return comp->asset.uid();
2573void internal_m2n_ui_document_set_asset(entt::entity
id,
const hpp::uuid& uid)
2575 if(
auto comp = safe_get_component<ui_document_component>(
id))
2578 auto& am = ctx.get_cached<asset_manager>();
2580 auto asset = am.get_asset<ui_tree>(uid);
2581 comp->asset = asset;
2585auto internal_m2n_ui_document_is_loaded(entt::entity
id) ->
bool
2587 if(
auto comp = safe_get_component<ui_document_component>(
id))
2589 return comp->is_loaded();
2595auto internal_m2n_ui_document_is_enabled(entt::entity
id) ->
bool
2597 if(
auto comp = safe_get_component<ui_document_component>(
id))
2599 return comp->is_enabled();
2605void internal_m2n_ui_document_set_enabled(entt::entity
id,
bool enabled)
2607 if(
auto comp = safe_get_component<ui_document_component>(
id))
2609 comp->set_enabled(enabled);
2612void internal_m2n_ui_document_close(entt::entity
id)
2614 if(
auto comp = safe_get_component<ui_document_component>(
id))
2618 comp->document->Close();
2619 comp->document =
nullptr;
2624auto internal_m2n_ui_document_get_title(entt::entity
id) ->
const std::string&
2626 if(
auto comp = safe_get_component<ui_document_component>(
id))
2630 return comp->document->GetTitle();
2634 static const std::string empty;
2638void internal_m2n_ui_document_set_title(entt::entity
id,
const std::string& title)
2640 if(
auto comp = safe_get_component<ui_document_component>(
id))
2644 comp->document->SetTitle(title);
2664auto get_ui_element_safe(entt::entity entity_id,
const std::string& element_id) -> Rml::Element*
2666 if(
auto comp = safe_get_component<ui_document_component>(entity_id))
2670 return comp->document->GetElementById(element_id);
2695void dispatch_ui_event_to_manager(
const T& event_data)
2700 auto& script_sys = ctx.get<script_system>();
2701 auto assembly = script_sys.get_engine_assembly();
2704 auto ui_event_manager_type = assembly.get_type(
"Unravel.Core",
"UIEventManager");
2705 if (!ui_event_manager_type.valid())
2707 APPLOG_ERROR(
"UIEventManager type not found in assembly");
2712 auto dispatch_method = ui_event_manager_type.get_method(
"InternalDispatchEvent");
2713 if (!dispatch_method.valid())
2715 APPLOG_ERROR(
"UIEventManager.InternalDispatchEvent method not found");
2720 auto method_invoker = mono::make_method_invoker<void(const T&)>(dispatch_method,
true);
2721 if (method_invoker.valid())
2723 method_invoker(event_data);
2727 APPLOG_ERROR(
"Failed to create method invoker for UIEventManager.InternalDispatchEvent");
2730 catch (
const mono::mono_exception& e)
2732 APPLOG_ERROR(
"Mono exception dispatching UI event: {}",
e.what());
2734 catch (
const std::exception& e)
2743enum class ui_event_type
2754auto get_ui_event_type(
const Rml::Event&
event) -> ui_event_type
2756 const auto event_id =
event.GetId();
2759 if (event_id == Rml::EventId::Keydown || event_id == Rml::EventId::Keyup)
2761 return ui_event_type::key;
2765 if (event_id == Rml::EventId::Textinput)
2767 return ui_event_type::textinput;
2771 if (event_id == Rml::EventId::Click || event_id == Rml::EventId::Mousedown || event_id == Rml::EventId::Mouseup ||
2772 event_id == Rml::EventId::Mousemove || event_id == Rml::EventId::Mouseover || event_id == Rml::EventId::Mouseout ||
2773 event_id == Rml::EventId::Mousescroll || event_id == Rml::EventId::Dblclick || event_id == Rml::EventId::Drag ||
2774 event_id == Rml::EventId::Dragstart || event_id == Rml::EventId::Dragover || event_id == Rml::EventId::Dragdrop)
2776 return ui_event_type::pointer;
2780 if (event_id == Rml::EventId::Change)
2782 auto value_str =
event.GetParameter<std::string>(
"value",
"");
2783 if (!value_str.empty())
2786 if (
auto* element =
event.GetCurrentElement())
2788 if (!element->HasAttribute(
"min") && !element->HasAttribute(
"max"))
2790 return ui_event_type::change;
2795 return ui_event_type::value;
2801 return ui_event_type::unknown;
2807 const Rml::Event&
event,
2808 Rml::Element* target_element,
2809 Rml::Element* current_element)
2817 event_data.
phase =
static_cast<int>(
event.GetPhase());
2821void dispatch_key_event_to_manager(
const Rml::Event&
event,
2822 Rml::Element* target_element,
2823 Rml::Element* current_element)
2828 fill_base_event_data(key_event_data,
event, target_element, current_element);
2831 auto key_identifier =
event.GetParameter<
int>(
"key_identifier", 0);
2833 key_event_data.
ctrl_key =
event.GetParameter<
int>(
"ctrl_key", 0) > 0;
2834 key_event_data.
shift_key =
event.GetParameter<
int>(
"shift_key", 0) > 0;
2835 key_event_data.
alt_key =
event.GetParameter<
int>(
"alt_key", 0) > 0;
2836 key_event_data.
meta_key =
event.GetParameter<
int>(
"meta_key", 0) > 0;
2838 dispatch_ui_event_to_manager(key_event_data);
2842void dispatch_pointer_event_to_manager(
const Rml::Event&
event,
2843 Rml::Element* target_element,
2844 Rml::Element* current_element)
2849 fill_base_event_data(pointer_event_data,
event, target_element, current_element);
2852 pointer_event_data.
x =
event.GetParameter<
float>(
"mouse_x", 0.0f);
2853 pointer_event_data.
y =
event.GetParameter<
float>(
"mouse_y", 0.0f);
2854 pointer_event_data.
button =
event.GetParameter<
int>(
"button", -1);
2855 pointer_event_data.
ctrl_key =
event.GetParameter<
int>(
"ctrl_key", 0) > 0;
2856 pointer_event_data.
shift_key =
event.GetParameter<
int>(
"shift_key", 0) > 0;
2857 pointer_event_data.
alt_key =
event.GetParameter<
int>(
"alt_key", 0) > 0;
2858 pointer_event_data.
meta_key =
event.GetParameter<
int>(
"meta_key", 0) > 0;
2859 pointer_event_data.
delta_x =
event.GetParameter<
float>(
"wheel_delta_x", 0.0f);
2860 pointer_event_data.
delta_y =
event.GetParameter<
float>(
"wheel_delta_y", 0.0f);
2862 dispatch_ui_event_to_manager(pointer_event_data);
2867void dispatch_textinput_event_to_manager(
const Rml::Event&
event,
2868 Rml::Element* target_element,
2869 Rml::Element* current_element)
2873 fill_base_event_data(textinput_event_data,
event, target_element, current_element);
2877 textinput_event_data.
text =
event.GetParameter<std::string>(
"text",
"");
2878 textinput_event_data.
ctrl_key =
event.GetParameter<
int>(
"ctrl_key", 0) > 0;
2879 textinput_event_data.
shift_key =
event.GetParameter<
int>(
"shift_key", 0) > 0;
2880 textinput_event_data.
alt_key =
event.GetParameter<
int>(
"alt_key", 0) > 0;
2881 textinput_event_data.
meta_key =
event.GetParameter<
int>(
"meta_key", 0) > 0;
2884 dispatch_ui_event_to_manager(textinput_event_data);
2888void dispatch_value_event_to_manager(
const Rml::Event&
event,
2889 Rml::Element* target_element,
2890 Rml::Element* current_element)
2895 fill_base_event_data(value_event_data,
event, target_element, current_element);
2898 value_event_data.
value =
event.GetParameter<
float>(
"value", 0);
2900 if(
auto* slider_element =
event.GetCurrentElement())
2902 value_event_data.
min_value = slider_element->GetAttribute<
float>(
"min", 0);
2903 value_event_data.
max_value = slider_element->GetAttribute<
float>(
"max", 0);
2904 value_event_data.
step = slider_element->GetAttribute<
float>(
"step", 0);
2907 dispatch_ui_event_to_manager(value_event_data);
2911void dispatch_change_event_to_manager(
const Rml::Event&
event,
2912 Rml::Element* target_element,
2913 Rml::Element* current_element)
2918 fill_base_event_data(change_event_data,
event, target_element, current_element);
2921 change_event_data.
value =
event.GetParameter<std::string>(
"value",
"");
2923 dispatch_ui_event_to_manager(change_event_data);
2928void dispatch_base_event_to_manager(
const Rml::Event&
event,
2929 Rml::Element* target_element,
2930 Rml::Element* current_element)
2933 fill_base_event_data(event_data,
event, target_element, current_element);
2934 dispatch_ui_event_to_manager(event_data);
2938class ui_global_event_listener :
public Rml::EventListener
2940 Rml::Event* current_event_ =
nullptr;
2942 void ProcessEvent(Rml::Event&
event)
override
2944 current_event_ = &
event;
2948 auto* target_element =
event.GetTargetElement();
2949 if (!target_element)
2954 auto* current_element =
event.GetCurrentElement();
2955 if (!current_element)
2961 const auto event_type = get_ui_event_type(
event);
2965 case ui_event_type::key:
2966 dispatch_key_event_to_manager(
event, target_element, current_element);
2969 case ui_event_type::textinput:
2970 dispatch_textinput_event_to_manager(
event, target_element, current_element);
2973 case ui_event_type::pointer:
2974 dispatch_pointer_event_to_manager(
event, target_element, current_element);
2977 case ui_event_type::change:
2978 dispatch_change_event_to_manager(
event, target_element, current_element);
2981 case ui_event_type::value:
2982 dispatch_value_event_to_manager(
event, target_element, current_element);
2985 case ui_event_type::unknown:
2988 dispatch_base_event_to_manager(
event, target_element, current_element);
2992 catch (
const std::exception& e)
2996 current_event_ =
nullptr;
3000 auto get_current_event() const ->
Rml::Event*
3002 return current_event_;
3007ui_global_event_listener g_ui_global_listener;
3010void internal_m2n_ui_ensure_native_event_listener(std::intptr_t element_ptr,
const std::string& event_type)
3012 if (element_ptr == 0)
3019 auto* element =
reinterpret_cast<Rml::Element*
>(element_ptr);
3023 element->AddEventListener(event_type, &g_ui_global_listener);
3025 APPLOG_TRACE(
"Ensured native UI event listener: element='{}', event='{}'", element->GetId(), event_type);
3027 catch (
const mono::mono_exception& e)
3029 APPLOG_ERROR(
"Mono exception ensuring native UI event listener: {}",
e.what());
3031 catch (
const std::exception& e)
3033 APPLOG_ERROR(
"Error ensuring native UI event listener: {}",
e.what());
3038void internal_m2n_ui_stop_propagation(std::intptr_t native_ptr)
3043 auto* current_event = g_ui_global_listener.get_current_event();
3044 if (current_event && current_event ==
reinterpret_cast<Rml::Event*
>(native_ptr))
3046 current_event->StopPropagation();
3054 catch (
const std::exception& e)
3056 APPLOG_ERROR(
"Error stopping UI event propagation: {}",
e.what());
3061void internal_m2n_ui_stop_immediate_propagation(std::intptr_t native_ptr)
3065 auto* current_event = g_ui_global_listener.get_current_event();
3068 current_event->StopImmediatePropagation();
3072 APPLOG_WARNING(
"No current UI event to stop immediate propagation on");
3075 catch (
const std::exception& e)
3077 APPLOG_ERROR(
"Error stopping UI event immediate propagation: {}",
e.what());
3096auto validate_ui_element_wrapper(std::intptr_t element_ptr) ->
bool
3098 if (element_ptr == 0)
3103 auto* element =
reinterpret_cast<Rml::Element*
>(element_ptr);
3107 auto& ec = ctx.get_cached<ecs>();
3108 auto& scene = ec.get_scene();
3109 auto& registry = *scene.registry;
3111 auto view = registry.view<ui_document_component>();
3114 auto& ui_comp = view.get<ui_document_component>(
entity);
3115 if (ui_comp.document)
3118 if (ui_comp.document->Contains(element))
3129auto validate_ui_document_wrapper(std::intptr_t document_ptr) ->
bool
3131 if (document_ptr == 0)
3136 auto* document =
reinterpret_cast<Rml::ElementDocument*
>(document_ptr);
3140 auto& ec = ctx.get_cached<ecs>();
3141 auto& scene = ec.get_scene();
3142 auto& registry = *scene.registry;
3144 auto view = registry.view<ui_document_component>();
3147 auto& ui_comp = view.get<ui_document_component>(
entity);
3148 if (ui_comp.document && ui_comp.document == document)
3161auto internal_m2n_ui_document_get_wrapper(entt::entity entity_id) -> std::intptr_t
3163 if (
auto comp = safe_get_component<ui_document_component>(entity_id))
3167 return reinterpret_cast<std::intptr_t
>(comp->document);
3173auto internal_m2n_ui_document_get_element_wrapper_by_id(std::intptr_t document_ptr,
const std::string& element_id) -> std::intptr_t
3175 auto* document =
reinterpret_cast<Rml::ElementDocument*
>(document_ptr);
3178 auto* element = document->GetElementById(element_id);
3179 return reinterpret_cast<std::intptr_t
>(element);
3185auto internal_m2n_ui_document_query_selector_wrapper(std::intptr_t document_ptr,
const std::string& selector) -> std::intptr_t
3187 auto* document =
reinterpret_cast<Rml::ElementDocument*
>(document_ptr);
3190 auto element = document->QuerySelector(selector);
3193 return reinterpret_cast<std::intptr_t
>(element);
3201auto internal_m2n_ui_element_wrapper_get_id(std::intptr_t element_ptr) -> std::string
3203 if (!validate_ui_element_wrapper(element_ptr))
3208 auto* element =
reinterpret_cast<Rml::Element*
>(element_ptr);
3209 return element->GetId();
3216auto internal_m2n_ui_document_wrapper_is_valid(std::intptr_t document_ptr) ->
bool
3218 return validate_ui_document_wrapper(document_ptr);
3221auto internal_m2n_ui_document_wrapper_get_title(std::intptr_t document_ptr) -> std::string
3223 if (!validate_ui_document_wrapper(document_ptr))
3228 auto* document =
reinterpret_cast<Rml::ElementDocument*
>(document_ptr);
3229 return document->GetTitle();
3232void internal_m2n_ui_document_wrapper_set_title(std::intptr_t document_ptr,
const std::string& title)
3234 if (!validate_ui_document_wrapper(document_ptr))
3239 auto* document =
reinterpret_cast<Rml::ElementDocument*
>(document_ptr);
3240 document->SetTitle(title);
3243auto internal_m2n_ui_document_wrapper_is_visible(std::intptr_t document_ptr) ->
bool
3245 if (!validate_ui_document_wrapper(document_ptr))
3250 auto* document =
reinterpret_cast<Rml::ElementDocument*
>(document_ptr);
3251 return document->IsVisible();
3254void internal_m2n_ui_document_wrapper_show(std::intptr_t document_ptr)
3256 if (!validate_ui_document_wrapper(document_ptr))
3261 auto* document =
reinterpret_cast<Rml::ElementDocument*
>(document_ptr);
3265void internal_m2n_ui_document_wrapper_hide(std::intptr_t document_ptr)
3267 if (!validate_ui_document_wrapper(document_ptr))
3272 auto* document =
reinterpret_cast<Rml::ElementDocument*
>(document_ptr);
3276void internal_m2n_ui_document_wrapper_close(std::intptr_t document_ptr)
3278 if (!validate_ui_document_wrapper(document_ptr))
3283 auto* document =
reinterpret_cast<Rml::ElementDocument*
>(document_ptr);
3291auto internal_m2n_ui_element_wrapper_is_valid(std::intptr_t element_ptr) ->
bool
3293 return validate_ui_element_wrapper(element_ptr);
3296auto internal_m2n_ui_element_wrapper_get_inner_rml(std::intptr_t element_ptr) -> std::string
3298 if (!validate_ui_element_wrapper(element_ptr))
3303 auto* element =
reinterpret_cast<Rml::Element*
>(element_ptr);
3304 return element->GetInnerRML();
3307void internal_m2n_ui_element_wrapper_set_inner_rml(std::intptr_t element_ptr,
const std::string& rml)
3309 if (!validate_ui_element_wrapper(element_ptr))
3314 auto* element =
reinterpret_cast<Rml::Element*
>(element_ptr);
3315 element->SetInnerRML(rml);
3318auto internal_m2n_ui_element_wrapper_is_visible(std::intptr_t element_ptr) ->
bool
3320 if (!validate_ui_element_wrapper(element_ptr))
3325 auto* element =
reinterpret_cast<Rml::Element*
>(element_ptr);
3326 return element->IsVisible();
3329void internal_m2n_ui_element_wrapper_set_visible(std::intptr_t element_ptr,
bool visible)
3331 if (!validate_ui_element_wrapper(element_ptr))
3336 auto* element =
reinterpret_cast<Rml::Element*
>(element_ptr);
3339 element->SetProperty(
"display",
"block");
3343 element->SetProperty(
"display",
"none");
3347auto internal_m2n_ui_element_wrapper_get_attribute(std::intptr_t element_ptr,
const std::string& attribute_name) -> std::string
3349 if (!validate_ui_element_wrapper(element_ptr))
3354 auto* element =
reinterpret_cast<Rml::Element*
>(element_ptr);
3355 return element->GetAttribute<Rml::String>(attribute_name,
"");
3358void internal_m2n_ui_element_wrapper_set_attribute(std::intptr_t element_ptr,
const std::string& attribute_name,
const std::string& value)
3360 if (!validate_ui_element_wrapper(element_ptr))
3365 auto* element =
reinterpret_cast<Rml::Element*
>(element_ptr);
3366 element->SetAttribute(attribute_name, value);
3369void internal_m2n_ui_element_wrapper_remove_attribute(std::intptr_t element_ptr,
const std::string& attribute_name)
3371 if (!validate_ui_element_wrapper(element_ptr))
3376 auto* element =
reinterpret_cast<Rml::Element*
>(element_ptr);
3377 element->RemoveAttribute(attribute_name);
3380auto internal_m2n_ui_element_wrapper_has_attribute(std::intptr_t element_ptr,
const std::string& attribute_name) ->
bool
3382 if (!validate_ui_element_wrapper(element_ptr))
3387 auto* element =
reinterpret_cast<Rml::Element*
>(element_ptr);
3388 return element->HasAttribute(attribute_name);
3391void internal_m2n_ui_element_wrapper_set_class(std::intptr_t element_ptr,
const std::string& class_name,
bool activate)
3393 if (!validate_ui_element_wrapper(element_ptr))
3398 auto* element =
reinterpret_cast<Rml::Element*
>(element_ptr);
3399 element->SetClass(class_name, activate);
3402auto internal_m2n_ui_element_wrapper_is_class_set(std::intptr_t element_ptr,
const std::string& class_name) ->
bool
3404 if (!validate_ui_element_wrapper(element_ptr))
3409 auto* element =
reinterpret_cast<Rml::Element*
>(element_ptr);
3410 return element->IsClassSet(class_name);
3413void internal_m2n_ui_element_wrapper_focus(std::intptr_t element_ptr)
3415 if (!validate_ui_element_wrapper(element_ptr))
3420 auto* element =
reinterpret_cast<Rml::Element*
>(element_ptr);
3424void internal_m2n_ui_element_wrapper_blur(std::intptr_t element_ptr)
3426 if (!validate_ui_element_wrapper(element_ptr))
3431 auto* element =
reinterpret_cast<Rml::Element*
>(element_ptr);
3435void internal_m2n_ui_element_wrapper_click(std::intptr_t element_ptr)
3437 if (!validate_ui_element_wrapper(element_ptr))
3442 auto* element =
reinterpret_cast<Rml::Element*
>(element_ptr);
3446void internal_m2n_ui_element_wrapper_scroll_into_view(std::intptr_t element_ptr,
bool align_with_top)
3448 if (!validate_ui_element_wrapper(element_ptr))
3453 auto* element =
reinterpret_cast<Rml::Element*
>(element_ptr);
3454 element->ScrollIntoView(align_with_top);
3461auto script_system::bind_internal_calls(
rtti::context& ctx) ->
bool
3463 APPLOG_TRACE(
"{}::{}", hpp::type_name_str(*
this), __func__);
3466 auto reg = mono::internal_call_registry(
"Unravel.Core.Log");
3467 reg.add_internal_call(
"internal_m2n_log_trace", internal_call(internal_m2n_log_trace));
3468 reg.add_internal_call(
"internal_m2n_log_info", internal_call(internal_m2n_log_info));
3469 reg.add_internal_call(
"internal_m2n_log_warning", internal_call(internal_m2n_log_warning));
3470 reg.add_internal_call(
"internal_m2n_log_error", internal_call(internal_m2n_log_error));
3474 auto reg = mono::internal_call_registry(
"Unravel.Core.Scene");
3475 reg.add_internal_call(
"internal_m2n_load_scene", internal_call(internal_m2n_load_scene));
3476 reg.add_internal_call(
"internal_m2n_load_scene_uid", internal_call(internal_m2n_load_scene_uid));
3477 reg.add_internal_call(
"internal_m2n_create_scene", internal_call(internal_m2n_create_scene));
3478 reg.add_internal_call(
"internal_m2n_destroy_scene", internal_call(internal_m2n_destroy_scene));
3479 reg.add_internal_call(
"internal_m2n_create_entity", internal_call(internal_m2n_create_entity));
3480 reg.add_internal_call(
"internal_m2n_create_entity_from_prefab_uid",
3481 internal_call(internal_m2n_create_entity_from_prefab_uid));
3482 reg.add_internal_call(
"internal_m2n_create_entity_from_prefab_key",
3483 internal_call(internal_m2n_create_entity_from_prefab_key));
3484 reg.add_internal_call(
"internal_m2n_clone_entity", internal_call(internal_m2n_clone_entity));
3485 reg.add_internal_call(
"internal_m2n_destroy_entity", internal_call(internal_m2n_destroy_entity));
3486 reg.add_internal_call(
"internal_m2n_destroy_entity_immediate",
3487 internal_call(internal_m2n_destroy_entity_immediate));
3489 reg.add_internal_call(
"internal_m2n_is_entity_valid", internal_call(internal_m2n_is_entity_valid));
3490 reg.add_internal_call(
"internal_m2n_find_entity_by_name", internal_call(internal_m2n_find_entity_by_name));
3491 reg.add_internal_call(
"internal_m2n_find_entities_by_name", internal_call(internal_m2n_find_entities_by_name));
3492 reg.add_internal_call(
"internal_m2n_find_entity_by_tag", internal_call(internal_m2n_find_entity_by_tag));
3493 reg.add_internal_call(
"internal_m2n_find_entities_by_tag", internal_call(internal_m2n_find_entities_by_tag));
3497 auto reg = mono::internal_call_registry(
"Unravel.Core.Entity");
3498 reg.add_internal_call(
"internal_m2n_add_component", internal_call(internal_m2n_add_component));
3499 reg.add_internal_call(
"internal_m2n_get_component", internal_call(internal_m2n_get_component));
3500 reg.add_internal_call(
"internal_m2n_get_component_in_children",
3501 internal_call(internal_m2n_get_component_in_children));
3502 reg.add_internal_call(
"internal_m2n_has_component", internal_call(internal_m2n_has_component));
3503 reg.add_internal_call(
"internal_m2n_get_components", internal_call(internal_m2n_get_components));
3504 reg.add_internal_call(
"internal_m2n_get_components_in_children",
3505 internal_call(internal_m2n_get_components_in_children));
3507 reg.add_internal_call(
"internal_m2n_remove_component_instance",
3508 internal_call(internal_m2n_remove_component_instance));
3509 reg.add_internal_call(
"internal_m2n_remove_component_instance_delay",
3510 internal_call(internal_m2n_remove_component_instance_delay));
3512 reg.add_internal_call(
"internal_m2n_remove_component", internal_call(internal_m2n_remove_component));
3513 reg.add_internal_call(
"internal_m2n_remove_component_delay",
3514 internal_call(internal_m2n_remove_component_delay));
3516 reg.add_internal_call(
"internal_m2n_get_transform_component",
3517 internal_call(internal_m2n_get_transform_component));
3518 reg.add_internal_call(
"internal_m2n_get_name", internal_call(internal_m2n_get_name));
3519 reg.add_internal_call(
"internal_m2n_set_name", internal_call(internal_m2n_set_name));
3520 reg.add_internal_call(
"internal_m2n_get_tag", internal_call(internal_m2n_get_tag));
3521 reg.add_internal_call(
"internal_m2n_set_tag", internal_call(internal_m2n_set_tag));
3522 reg.add_internal_call(
"internal_m2n_get_layers", internal_call(internal_m2n_get_layers));
3523 reg.add_internal_call(
"internal_m2n_set_layers", internal_call(internal_m2n_set_layers));
3525 reg.add_internal_call(
"internal_m2n_get_active_global", internal_call(internal_m2n_get_active_global));
3526 reg.add_internal_call(
"internal_m2n_get_active_local", internal_call(internal_m2n_get_active_local));
3527 reg.add_internal_call(
"internal_m2n_set_active_local", internal_call(internal_m2n_set_active_local));
3531 auto reg = mono::internal_call_registry(
"Unravel.Core.TransformComponent");
3532 reg.add_internal_call(
"internal_m2n_get_children", internal_call(internal_m2n_get_children));
3533 reg.add_internal_call(
"internal_m2n_get_child", internal_call(internal_m2n_get_child));
3534 reg.add_internal_call(
"internal_m2n_get_parent", internal_call(internal_m2n_get_parent));
3535 reg.add_internal_call(
"internal_m2n_set_parent", internal_call(internal_m2n_set_parent));
3537 reg.add_internal_call(
"internal_m2n_get_position_global", internal_call(internal_m2n_get_position_global));
3538 reg.add_internal_call(
"internal_m2n_set_position_global", internal_call(internal_m2n_set_position_global));
3539 reg.add_internal_call(
"internal_m2n_move_by_global", internal_call(internal_m2n_move_by_global));
3541 reg.add_internal_call(
"internal_m2n_get_position_local", internal_call(internal_m2n_get_position_local));
3542 reg.add_internal_call(
"internal_m2n_set_position_local", internal_call(internal_m2n_set_position_local));
3543 reg.add_internal_call(
"internal_m2n_move_by_local", internal_call(internal_m2n_move_by_local));
3546 reg.add_internal_call(
"internal_m2n_get_rotation_euler_global",
3547 internal_call(internal_m2n_get_rotation_euler_global));
3548 reg.add_internal_call(
"internal_m2n_set_rotation_euler_global",
3549 internal_call(internal_m2n_set_rotation_euler_global));
3550 reg.add_internal_call(
"internal_m2n_rotate_by_euler_global",
3551 internal_call(internal_m2n_rotate_by_euler_global));
3553 reg.add_internal_call(
"internal_m2n_get_rotation_euler_local",
3554 internal_call(internal_m2n_get_rotation_euler_local));
3555 reg.add_internal_call(
"internal_m2n_set_rotation_euler_local",
3556 internal_call(internal_m2n_set_rotation_euler_local));
3557 reg.add_internal_call(
"internal_m2n_rotate_by_euler_local", internal_call(internal_m2n_rotate_by_euler_local));
3560 reg.add_internal_call(
"internal_m2n_get_rotation_global", internal_call(internal_m2n_get_rotation_global));
3561 reg.add_internal_call(
"internal_m2n_set_rotation_global", internal_call(internal_m2n_set_rotation_global));
3562 reg.add_internal_call(
"internal_m2n_rotate_by_global", internal_call(internal_m2n_rotate_by_global));
3564 reg.add_internal_call(
"internal_m2n_get_rotation_local", internal_call(internal_m2n_get_rotation_local));
3565 reg.add_internal_call(
"internal_m2n_set_rotation_local", internal_call(internal_m2n_set_rotation_local));
3566 reg.add_internal_call(
"internal_m2n_rotate_by_local", internal_call(internal_m2n_rotate_by_local));
3569 reg.add_internal_call(
"internal_m2n_rotate_axis_global", internal_call(internal_m2n_rotate_axis_global));
3570 reg.add_internal_call(
"internal_m2n_look_at", internal_call(internal_m2n_look_at));
3571 reg.add_internal_call(
"internal_m2n_transform_vector_global",
3572 internal_call(internal_m2n_transform_vector_global));
3573 reg.add_internal_call(
"internal_m2n_inverse_transform_vector_global",
3574 internal_call(internal_m2n_inverse_transform_vector_global));
3576 reg.add_internal_call(
"internal_m2n_transform_direction_global",
3577 internal_call(internal_m2n_transform_direction_global));
3578 reg.add_internal_call(
"internal_m2n_inverse_transform_direction_global",
3579 internal_call(internal_m2n_inverse_transform_direction_global));
3582 reg.add_internal_call(
"internal_m2n_get_scale_global", internal_call(internal_m2n_get_scale_global));
3583 reg.add_internal_call(
"internal_m2n_set_scale_global", internal_call(internal_m2n_set_scale_global));
3584 reg.add_internal_call(
"internal_m2n_scale_by_global", internal_call(internal_m2n_scale_by_local));
3586 reg.add_internal_call(
"internal_m2n_get_scale_local", internal_call(internal_m2n_get_scale_local));
3587 reg.add_internal_call(
"internal_m2n_set_scale_local", internal_call(internal_m2n_set_scale_local));
3588 reg.add_internal_call(
"internal_m2n_scale_by_local", internal_call(internal_m2n_scale_by_local));
3591 reg.add_internal_call(
"internal_m2n_get_skew_global", internal_call(internal_m2n_get_skew_global));
3592 reg.add_internal_call(
"internal_m2n_set_skew_globa", internal_call(internal_m2n_setl_skew_globa));
3593 reg.add_internal_call(
"internal_m2n_get_skew_local", internal_call(internal_m2n_get_skew_local));
3594 reg.add_internal_call(
"internal_m2n_set_skew_local", internal_call(internal_m2n_set_skew_local));
3598 auto reg = mono::internal_call_registry(
"Unravel.Core.PhysicsComponent");
3599 reg.add_internal_call(
"internal_m2n_physics_apply_explosion_force",
3600 internal_call(internal_m2n_physics_apply_explosion_force));
3601 reg.add_internal_call(
"internal_m2n_physics_apply_force", internal_call(internal_m2n_physics_apply_force));
3602 reg.add_internal_call(
"internal_m2n_physics_apply_torque", internal_call(internal_m2n_physics_apply_torque));
3603 reg.add_internal_call(
"internal_m2n_physics_get_velocity", internal_call(internal_m2n_physics_get_velocity));
3604 reg.add_internal_call(
"internal_m2n_physics_set_velocity", internal_call(internal_m2n_physics_set_velocity));
3605 reg.add_internal_call(
"internal_m2n_physics_get_angular_velocity",
3606 internal_call(internal_m2n_physics_get_angular_velocity));
3607 reg.add_internal_call(
"internal_m2n_physics_set_angular_velocity",
3608 internal_call(internal_m2n_physics_set_angular_velocity));
3610 reg.add_internal_call(
"internal_m2n_physics_get_include_layers",
3611 internal_call(internal_m2n_physics_get_include_layers));
3612 reg.add_internal_call(
"internal_m2n_physics_set_include_layers",
3613 internal_call(internal_m2n_physics_set_include_layers));
3614 reg.add_internal_call(
"internal_m2n_physics_get_exclude_layers",
3615 internal_call(internal_m2n_physics_get_exclude_layers));
3616 reg.add_internal_call(
"internal_m2n_physics_set_exclude_layers",
3617 internal_call(internal_m2n_physics_set_exclude_layers));
3618 reg.add_internal_call(
"internal_m2n_physics_get_collision_layers",
3619 internal_call(internal_m2n_physics_get_collision_layers));
3623 auto reg = mono::internal_call_registry(
"Unravel.Core.AnimationComponent");
3624 reg.add_internal_call(
"internal_m2n_animation_blend", internal_call(internal_m2n_animation_blend));
3625 reg.add_internal_call(
"internal_m2n_animation_play", internal_call(internal_m2n_animation_play));
3626 reg.add_internal_call(
"internal_m2n_animation_pause", internal_call(internal_m2n_animation_pause));
3627 reg.add_internal_call(
"internal_m2n_animation_resume", internal_call(internal_m2n_animation_resume));
3628 reg.add_internal_call(
"internal_m2n_animation_stop", internal_call(internal_m2n_animation_stop));
3629 reg.add_internal_call(
"internal_m2n_animation_set_speed", internal_call(internal_m2n_animation_set_speed));
3630 reg.add_internal_call(
"internal_m2n_animation_get_speed", internal_call(internal_m2n_animation_get_speed));
3634 auto reg = mono::internal_call_registry(
"Unravel.Core.CameraComponent");
3635 reg.add_internal_call(
"internal_m2n_camera_screen_point_to_ray",
3636 internal_call(internal_m2n_camera_screen_point_to_ray));
3640 auto reg = mono::internal_call_registry(
"Unravel.Core.ModelComponent");
3641 reg.add_internal_call(
"internal_m2n_model_get_enabled", internal_call(internal_m2n_model_get_enabled));
3642 reg.add_internal_call(
"internal_m2n_model_set_enabled", internal_call(internal_m2n_model_set_enabled));
3643 reg.add_internal_call(
"internal_m2n_model_get_shared_material",
3644 internal_call(internal_m2n_model_get_shared_material));
3645 reg.add_internal_call(
"internal_m2n_model_get_shared_material_count",
3646 internal_call(internal_m2n_model_get_shared_material_count));
3647 reg.add_internal_call(
"internal_m2n_model_set_shared_material",
3648 internal_call(internal_m2n_model_set_shared_material));
3649 reg.add_internal_call(
"internal_m2n_model_set_material_instance",
3650 internal_call(internal_m2n_model_set_material_instance));
3651 reg.add_internal_call(
"internal_m2n_model_get_material_instance",
3652 internal_call(internal_m2n_model_get_material_instance));
3653 reg.add_internal_call(
"internal_m2n_model_get_material_instance_count",
3654 internal_call(internal_m2n_model_get_material_instance_count));
3658 auto reg = mono::internal_call_registry(
"Unravel.Core.TextComponent");
3659 reg.add_internal_call(
"internal_m2n_text_get_text", internal_call(internal_m2n_text_get_text));
3660 reg.add_internal_call(
"internal_m2n_text_set_text", internal_call(internal_m2n_text_set_text));
3661 reg.add_internal_call(
"internal_m2n_text_get_buffer_type", internal_call(internal_m2n_text_get_buffer_type));
3662 reg.add_internal_call(
"internal_m2n_text_set_buffer_type", internal_call(internal_m2n_text_set_buffer_type));
3663 reg.add_internal_call(
"internal_m2n_text_get_overflow_type",
3664 internal_call(internal_m2n_text_get_overflow_type));
3665 reg.add_internal_call(
"internal_m2n_text_set_overflow_type",
3666 internal_call(internal_m2n_text_set_overflow_type));
3667 reg.add_internal_call(
"internal_m2n_text_get_font", internal_call(internal_m2n_text_get_font));
3668 reg.add_internal_call(
"internal_m2n_text_set_font", internal_call(internal_m2n_text_set_font));
3670 reg.add_internal_call(
"internal_m2n_text_get_font_size", internal_call(internal_m2n_text_get_font_size));
3671 reg.add_internal_call(
"internal_m2n_text_set_font_size", internal_call(internal_m2n_text_set_font_size));
3672 reg.add_internal_call(
"internal_m2n_text_get_render_font_size",
3673 internal_call(internal_m2n_text_get_render_font_size));
3675 reg.add_internal_call(
"internal_m2n_text_get_auto_size", internal_call(internal_m2n_text_get_auto_size));
3676 reg.add_internal_call(
"internal_m2n_text_set_auto_size", internal_call(internal_m2n_text_set_auto_size));
3678 reg.add_internal_call(
"internal_m2n_text_get_auto_size_range",
3679 internal_call(internal_m2n_text_get_auto_size_range));
3680 reg.add_internal_call(
"internal_m2n_text_set_auto_size_range",
3681 internal_call(internal_m2n_text_set_auto_size_range));
3683 reg.add_internal_call(
"internal_m2n_text_get_area", internal_call(internal_m2n_text_get_area));
3684 reg.add_internal_call(
"internal_m2n_text_set_area", internal_call(internal_m2n_text_set_area));
3685 reg.add_internal_call(
"internal_m2n_text_get_render_area", internal_call(internal_m2n_text_get_render_area));
3687 reg.add_internal_call(
"internal_m2n_text_get_is_rich_text", internal_call(internal_m2n_text_get_is_rich_text));
3688 reg.add_internal_call(
"internal_m2n_text_set_is_rich_text", internal_call(internal_m2n_text_set_is_rich_text));
3690 reg.add_internal_call(
"internal_m2n_text_get_alignment", internal_call(internal_m2n_text_get_alignment));
3691 reg.add_internal_call(
"internal_m2n_text_set_alignment", internal_call(internal_m2n_text_set_alignment));
3693 reg.add_internal_call(
"internal_m2n_text_get_bounds", internal_call(internal_m2n_text_get_bounds));
3694 reg.add_internal_call(
"internal_m2n_text_get_render_bounds", internal_call(internal_m2n_text_get_bounds));
3698 auto reg = mono::internal_call_registry(
"Unravel.Core.LightComponent");
3699 reg.add_internal_call(
"internal_m2n_light_get_color", internal_call(internal_m2n_light_get_color));
3700 reg.add_internal_call(
"internal_m2n_light_set_color", internal_call(internal_m2n_light_set_color));
3704 auto reg = mono::internal_call_registry(
"Unravel.Core.Assets");
3705 reg.add_internal_call(
"internal_m2n_get_asset_by_uuid", internal_call(internal_m2n_get_asset_by_uuid));
3706 reg.add_internal_call(
"internal_m2n_get_asset_by_key", internal_call(internal_m2n_get_asset_by_key));
3707 reg.add_internal_call(
"internal_m2n_get_material_properties",
3708 internal_call(internal_m2n_get_material_properties));
3712 auto reg = mono::internal_call_registry(
"Unravel.Core.AudioClip");
3713 reg.add_internal_call(
"internal_m2n_audio_clip_get_length", internal_call(internal_m2n_audio_clip_get_length));
3717 auto reg = mono::internal_call_registry(
"Quaternion");
3718 reg.add_internal_call(
"internal_m2n_from_euler_rad", internal_call(internal_m2n_from_euler_rad));
3719 reg.add_internal_call(
"internal_m2n_to_euler_rad", internal_call(internal_m2n_to_euler_rad));
3720 reg.add_internal_call(
"internal_m2n_from_to_rotation", internal_call(internal_m2n_from_to_rotation));
3721 reg.add_internal_call(
"internal_m2n_angle_axis", internal_call(internal_m2n_angle_axis));
3722 reg.add_internal_call(
"internal_m2n_look_rotation", internal_call(internal_m2n_look_rotation));
3726 auto reg = mono::internal_call_registry(
"Unravel.Core.Gizmos");
3727 reg.add_internal_call(
"internal_m2n_gizmos_add_sphere", internal_call(internal_m2n_gizmos_add_sphere));
3728 reg.add_internal_call(
"internal_m2n_gizmos_add_ray", internal_call(internal_m2n_gizmos_add_ray));
3732 auto reg = mono::internal_call_registry(
"Unravel.Core.Tests");
3733 reg.add_internal_call(
"m2n_test_uuid", internal_call(m2n_test_uuid));
3737 auto reg = mono::internal_call_registry(
"Unravel.Core.LayerMask");
3738 reg.add_internal_call(
"internal_m2n_layers_layer_to_name", internal_call(internal_m2n_layers_layer_to_name));
3739 reg.add_internal_call(
"internal_m2n_layers_name_to_layer", internal_call(internal_m2n_layers_name_to_layer));
3743 auto reg = mono::internal_call_registry(
"Unravel.Core.Input");
3744 reg.add_internal_call(
"internal_m2n_input_get_analog_value",
3745 internal_call(internal_m2n_input_get_analog_value));
3746 reg.add_internal_call(
"internal_m2n_input_get_digital_value",
3747 internal_call(internal_m2n_input_get_analog_value));
3748 reg.add_internal_call(
"internal_m2n_input_is_pressed", internal_call(internal_m2n_input_is_pressed));
3749 reg.add_internal_call(
"internal_m2n_input_is_released", internal_call(internal_m2n_input_is_released));
3750 reg.add_internal_call(
"internal_m2n_input_is_down", internal_call(internal_m2n_input_is_down));
3751 reg.add_internal_call(
"internal_m2n_input_is_key_pressed", internal_call(internal_m2n_input_is_key_pressed));
3752 reg.add_internal_call(
"internal_m2n_input_is_key_released", internal_call(internal_m2n_input_is_key_released));
3753 reg.add_internal_call(
"internal_m2n_input_is_key_down", internal_call(internal_m2n_input_is_key_down));
3754 reg.add_internal_call(
"internal_m2n_input_is_mouse_button_pressed",
3755 internal_call(internal_m2n_input_is_mouse_button_pressed));
3756 reg.add_internal_call(
"internal_m2n_input_is_mouse_button_released",
3757 internal_call(internal_m2n_input_is_mouse_button_released));
3758 reg.add_internal_call(
"internal_m2n_input_is_mouse_button_down",
3759 internal_call(internal_m2n_input_is_mouse_button_down));
3760 reg.add_internal_call(
"internal_m2n_input_get_mouse_position",
3761 internal_call(internal_m2n_input_get_mouse_position));
3765 auto reg = mono::internal_call_registry(
"Unravel.Core.Physics");
3766 reg.add_internal_call(
"internal_m2n_physics_ray_cast", internal_call(internal_m2n_physics_ray_cast));
3767 reg.add_internal_call(
"internal_m2n_physics_ray_cast_all", internal_call(internal_m2n_physics_ray_cast_all));
3768 reg.add_internal_call(
"internal_m2n_physics_sphere_cast", internal_call(internal_m2n_physics_sphere_cast));
3769 reg.add_internal_call(
"internal_m2n_physics_sphere_cast_all",
3770 internal_call(internal_m2n_physics_sphere_cast_all));
3771 reg.add_internal_call(
"internal_m2n_physics_sphere_overlap",
3772 internal_call(internal_m2n_physics_sphere_overlap));
3776 auto reg = mono::internal_call_registry(
"Unravel.Core.IK");
3777 reg.add_internal_call(
"internal_m2n_utils_set_ik_posiiton_ccd",
3778 internal_call(internal_m2n_utils_set_ik_posiiton_ccd));
3779 reg.add_internal_call(
"internal_m2n_utils_set_ik_posiiton_fabrik",
3780 internal_call(internal_m2n_utils_set_ik_posiiton_fabrik));
3781 reg.add_internal_call(
"internal_m2n_utils_set_ik_posiiton_two_bone",
3782 internal_call(internal_m2n_utils_set_ik_posiiton_two_bone));
3784 reg.add_internal_call(
"internal_m2n_utils_set_ik_look_at_posiiton",
3785 internal_call(internal_m2n_utils_set_ik_look_at_posiiton));
3789 auto reg = mono::internal_call_registry(
"Unravel.Core.AudioSourceComponent");
3790 reg.add_internal_call(
"internal_m2n_audio_source_get_loop", internal_call(internal_m2n_audio_source_get_loop));
3791 reg.add_internal_call(
"internal_m2n_audio_source_set_loop", internal_call(internal_m2n_audio_source_set_loop));
3792 reg.add_internal_call(
"internal_m2n_audio_source_get_volume",
3793 internal_call(internal_m2n_audio_source_get_volume));
3794 reg.add_internal_call(
"internal_m2n_audio_source_set_volume",
3795 internal_call(internal_m2n_audio_source_set_volume));
3796 reg.add_internal_call(
"internal_m2n_audio_source_get_pitch",
3797 internal_call(internal_m2n_audio_source_get_pitch));
3798 reg.add_internal_call(
"internal_m2n_audio_source_set_pitch",
3799 internal_call(internal_m2n_audio_source_set_pitch));
3800 reg.add_internal_call(
"internal_m2n_audio_source_get_volume_rolloff",
3801 internal_call(internal_m2n_audio_source_get_volume_rolloff));
3802 reg.add_internal_call(
"internal_m2n_audio_source_set_volume_rolloff",
3803 internal_call(internal_m2n_audio_source_set_volume_rolloff));
3804 reg.add_internal_call(
"internal_m2n_audio_source_get_min_distance",
3805 internal_call(internal_m2n_audio_source_get_min_distance));
3806 reg.add_internal_call(
"internal_m2n_audio_source_set_min_distance",
3807 internal_call(internal_m2n_audio_source_set_min_distance));
3808 reg.add_internal_call(
"internal_m2n_audio_source_get_max_distance",
3809 internal_call(internal_m2n_audio_source_get_max_distance));
3810 reg.add_internal_call(
"internal_m2n_audio_source_set_max_distance",
3811 internal_call(internal_m2n_audio_source_set_max_distance));
3812 reg.add_internal_call(
"internal_m2n_audio_source_get_mute", internal_call(internal_m2n_audio_source_get_mute));
3814 reg.add_internal_call(
"internal_m2n_audio_source_set_mute", internal_call(internal_m2n_audio_source_set_mute));
3816 reg.add_internal_call(
"internal_m2n_audio_source_is_playing",
3817 internal_call(internal_m2n_audio_source_is_playing));
3818 reg.add_internal_call(
"internal_m2n_audio_source_is_paused",
3819 internal_call(internal_m2n_audio_source_is_paused));
3820 reg.add_internal_call(
"internal_m2n_audio_source_play", internal_call(internal_m2n_audio_source_play));
3821 reg.add_internal_call(
"internal_m2n_audio_source_stop", internal_call(internal_m2n_audio_source_stop));
3823 reg.add_internal_call(
"internal_m2n_audio_source_pause", internal_call(internal_m2n_audio_source_pause));
3824 reg.add_internal_call(
"internal_m2n_audio_source_resume", internal_call(internal_m2n_audio_source_resume));
3825 reg.add_internal_call(
"internal_m2n_audio_source_get_audio_clip",
3826 internal_call(internal_m2n_audio_source_get_audio_clip));
3827 reg.add_internal_call(
"internal_m2n_audio_source_set_audio_clip",
3828 internal_call(internal_m2n_audio_source_set_audio_clip));
3832 auto reg = mono::internal_call_registry(
"Unravel.Core.UIDocumentComponent");
3833 reg.add_internal_call(
"internal_m2n_ui_document_get_asset", internal_call(internal_m2n_ui_document_get_asset));
3834 reg.add_internal_call(
"internal_m2n_ui_document_set_asset", internal_call(internal_m2n_ui_document_set_asset));
3835 reg.add_internal_call(
"internal_m2n_ui_document_is_loaded", internal_call(internal_m2n_ui_document_is_loaded));
3836 reg.add_internal_call(
"internal_m2n_ui_document_is_enabled", internal_call(internal_m2n_ui_document_is_enabled));
3837 reg.add_internal_call(
"internal_m2n_ui_document_set_enabled", internal_call(internal_m2n_ui_document_set_enabled));
3838 reg.add_internal_call(
"internal_m2n_ui_document_close", internal_call(internal_m2n_ui_document_close));
3839 reg.add_internal_call(
"internal_m2n_ui_document_get_title", internal_call(internal_m2n_ui_document_get_title));
3840 reg.add_internal_call(
"internal_m2n_ui_document_set_title", internal_call(internal_m2n_ui_document_set_title));
3841 reg.add_internal_call(
"internal_m2n_ui_document_get_wrapper", internal_call(internal_m2n_ui_document_get_wrapper));
3846 auto reg = mono::internal_call_registry(
"Unravel.Core.UIDocument");
3847 reg.add_internal_call(
"internal_m2n_ui_document_wrapper_is_valid", internal_call(internal_m2n_ui_document_wrapper_is_valid));
3848 reg.add_internal_call(
"internal_m2n_ui_document_wrapper_get_title", internal_call(internal_m2n_ui_document_wrapper_get_title));
3849 reg.add_internal_call(
"internal_m2n_ui_document_wrapper_set_title", internal_call(internal_m2n_ui_document_wrapper_set_title));
3850 reg.add_internal_call(
"internal_m2n_ui_document_wrapper_is_visible", internal_call(internal_m2n_ui_document_wrapper_is_visible));
3851 reg.add_internal_call(
"internal_m2n_ui_document_wrapper_show", internal_call(internal_m2n_ui_document_wrapper_show));
3852 reg.add_internal_call(
"internal_m2n_ui_document_wrapper_hide", internal_call(internal_m2n_ui_document_wrapper_hide));
3853 reg.add_internal_call(
"internal_m2n_ui_document_wrapper_close", internal_call(internal_m2n_ui_document_wrapper_close));
3854 reg.add_internal_call(
"internal_m2n_ui_document_wrapper_get_element_by_id", internal_call(internal_m2n_ui_document_get_element_wrapper_by_id));
3855 reg.add_internal_call(
"internal_m2n_ui_document_wrapper_query_selector", internal_call(internal_m2n_ui_document_query_selector_wrapper));
3856 reg.add_internal_call(
"internal_m2n_ui_document_wrapper_query_selector_all", internal_call(internal_m2n_ui_document_query_selector_wrapper));
3860 auto reg = mono::internal_call_registry(
"Unravel.Core.UIElement");
3861 reg.add_internal_call(
"internal_m2n_ui_element_wrapper_is_valid", internal_call(internal_m2n_ui_element_wrapper_is_valid));
3862 reg.add_internal_call(
"internal_m2n_ui_element_wrapper_get_inner_rml", internal_call(internal_m2n_ui_element_wrapper_get_inner_rml));
3863 reg.add_internal_call(
"internal_m2n_ui_element_wrapper_set_inner_rml", internal_call(internal_m2n_ui_element_wrapper_set_inner_rml));
3864 reg.add_internal_call(
"internal_m2n_ui_element_wrapper_is_visible", internal_call(internal_m2n_ui_element_wrapper_is_visible));
3865 reg.add_internal_call(
"internal_m2n_ui_element_wrapper_set_visible", internal_call(internal_m2n_ui_element_wrapper_set_visible));
3866 reg.add_internal_call(
"internal_m2n_ui_element_wrapper_get_attribute", internal_call(internal_m2n_ui_element_wrapper_get_attribute));
3867 reg.add_internal_call(
"internal_m2n_ui_element_wrapper_set_attribute", internal_call(internal_m2n_ui_element_wrapper_set_attribute));
3868 reg.add_internal_call(
"internal_m2n_ui_element_wrapper_remove_attribute", internal_call(internal_m2n_ui_element_wrapper_remove_attribute));
3869 reg.add_internal_call(
"internal_m2n_ui_element_wrapper_has_attribute", internal_call(internal_m2n_ui_element_wrapper_has_attribute));
3870 reg.add_internal_call(
"internal_m2n_ui_element_wrapper_set_class", internal_call(internal_m2n_ui_element_wrapper_set_class));
3871 reg.add_internal_call(
"internal_m2n_ui_element_wrapper_is_class_set", internal_call(internal_m2n_ui_element_wrapper_is_class_set));
3872 reg.add_internal_call(
"internal_m2n_ui_element_wrapper_focus", internal_call(internal_m2n_ui_element_wrapper_focus));
3873 reg.add_internal_call(
"internal_m2n_ui_element_wrapper_blur", internal_call(internal_m2n_ui_element_wrapper_blur));
3874 reg.add_internal_call(
"internal_m2n_ui_element_wrapper_click", internal_call(internal_m2n_ui_element_wrapper_click));
3875 reg.add_internal_call(
"internal_m2n_ui_element_wrapper_scroll_into_view", internal_call(internal_m2n_ui_element_wrapper_scroll_into_view));
3876 reg.add_internal_call(
"internal_m2n_ui_element_wrapper_get_id", internal_call(internal_m2n_ui_element_wrapper_get_id));
3880 auto reg = mono::internal_call_registry(
"Unravel.Core.UIEventManager");
3881 reg.add_internal_call(
"internal_m2n_ui_ensure_native_event_listener", internal_call(internal_m2n_ui_ensure_native_event_listener));
3885 auto reg = mono::internal_call_registry(
"Unravel.Core.UIEventBase");
3886 reg.add_internal_call(
"internal_m2n_ui_stop_propagation", internal_call(internal_m2n_ui_stop_propagation));
3887 reg.add_internal_call(
"internal_m2n_ui_stop_immediate_propagation", internal_call(internal_m2n_ui_stop_immediate_propagation));
3891 auto reg = mono::internal_call_registry(
"Unravel.Core.Application");
3892 reg.add_internal_call(
"internal_m2n_application_quit", internal_call(internal_m2n_application_quit));
3896 auto reg = mono::internal_call_registry(
"Unravel.Core.Time");
3897 reg.add_internal_call(
"internal_m2n_set_time_scale", internal_call(internal_m2n_set_time_scale));
unravel::physics_vector< hit_info > hits
animation_clip::seconds_t seconds_t
std::shared_ptr< material > sptr
std::chrono::duration< float > delta_t
#define APPLOG_WARNING(...)
#define APPLOG_ERROR(...)
#define APPLOG_INFO_LOC(FILE_LOC, LINE_LOC, FUNC_LOC,...)
#define APPLOG_WARNING_LOC(FILE_LOC, LINE_LOC, FUNC_LOC,...)
#define APPLOG_ERROR_LOC(FILE_LOC, LINE_LOC, FUNC_LOC,...)
#define APPLOG_TRACE_LOC(FILE_LOC, LINE_LOC, FUNC_LOC,...)
#define APPLOG_TRACE(...)
auto look_rotation(const glm::vec3 &forward, const glm::vec3 &upwards) -> glm::quat
auto from_to_rotation(const glm::vec3 &from, const glm::vec3 &to) -> glm::quat
auto start(seq_action action, const seq_scope_policy &scope_policy, hpp::source_location location) -> seq_id_t
Starts a new action.
auto delay(const duration_t &duration, const sentinel_t &sentinel) -> seq_action
Creates a delay action.
auto tokenize(const std::string &str, const std::string &delimiters) -> string_tokens_t
auto convert_rml_key_to_input(Rml::Input::KeyIdentifier rml_key) -> input::key_code
Convert RmlUi key identifier to engine input key code.
auto ik_set_position_ccd(entt::handle end_effector, const math::vec3 &target, size_t num_bones_in_chain, float threshold, int max_iterations) -> bool
auto generate_uuid() -> hpp::uuid
@ sphere
Sphere type reflection probe.
auto ik_set_position_two_bone(entt::handle end_effector, const math::vec3 &target, const math::vec3 &forward, float weight, float soften, int max_iterations) -> bool
hpp::small_vector< T, SmallSizeCapacity > physics_vector
auto ik_set_position_fabrik(entt::handle end_effector, const math::vec3 &target, size_t num_bones_in_chain, float threshold, int max_iterations) -> bool
auto ik_look_at_position(entt::handle end_effector, const math::vec3 &target, float weight) -> bool
bool is_valid(octet_iterator start, octet_iterator end)
std::function< bool(size_t type_hash, entt::handle e)> has_native
std::function< bool(size_t type_hash, entt::handle e)> remove_native
std::function< bool(size_t type_hash, entt::handle e)> add_native
void draw(const bx::Aabb &_aabb)
void lineTo(float _x, float _y, float _z=0.0f)
void setColor(uint32_t _abgr)
void setWireframe(bool _wireframe)
void moveTo(float _x, float _y, float _z=0.0f)
Storage for box vector values and wraps up common functionality.
static bbox empty
An empty bounding box.
std::string current_element_id
std::intptr_t current_element_ptr
std::string target_element_id
std::intptr_t target_element_ptr
static auto context() -> rtti::context &