Unravel Engine C++ Reference
Loading...
Searching...
No Matches
light_component_bindings.cpp
Go to the documentation of this file.
2#include "script_bindings.h"
3
4#include "../script_interop.h"
5
7
8namespace unravel
9{
10namespace
11{
12
13//------------------------------
14
15void internal_m2n_light_set_color(entt::entity id, const math::color& color)
16{
17 if(auto comp = safe_get_component<light_component>(id))
18 {
19 auto l = comp->get_light();
20 l.color = color;
21 comp->set_light(l);
22 }
23}
24
25auto internal_m2n_light_get_color(entt::entity id) -> math::color
26{
27 if(auto comp = safe_get_component<light_component>(id))
28 {
29 return comp->get_light().color;
30 }
31
32 return math::color::white();
33}
34
35} // namespace
36
38{
39 APPLOG_TRACE("{}", __func__);
40
41 auto reg = dotnet::internal_call_registry("Unravel.Core.LightComponent");
42 reg.add_internal_call("internal_m2n_light_get_color", dotnet_internal_call(internal_m2n_light_get_color));
43 reg.add_internal_call("internal_m2n_light_set_color", dotnet_internal_call(internal_m2n_light_set_color));
44}
45
46} // namespace unravel
#define APPLOG_TRACE(...)
Definition logging.h:17
void register_light_component_script_bindings()
auto safe_get_component(entt::entity id) -> T *
std::vector< math::color > color
static color white()
Definition color.h:13