Unravel Engine C++ Reference
Loading...
Searching...
No Matches
inspector_light.cpp
Go to the documentation of this file.
1#include "inspector_light.h"
2#include "inspectors.h"
3
4namespace unravel
5{
7 entt::meta_any& var,
8 const meta_any_proxy& var_proxy,
9 const var_info& info,
10 const entt::meta_custom& custom) -> inspect_result
11{
12 auto result = inspect_var_properties(ctx, var, var_proxy, info, custom);
13 auto& data = var.cast<light_component&>();
14 const auto& light_val = data.get_light();
15
16
17 if(light_val.casts_shadows)
18 {
19 ImGui::AlignTextToFramePadding();
20 if(ImGui::TreeNode("Maps"))
21 {
22 ImGui::TreePush("Maps");
23
24 auto& generator = data.get_shadowmap_generator();
25
26 auto depth_type = generator.get_depth_type();
27
28 ImGui::BeginGroup();
29 auto program = generator.get_depth_render_program(depth_type);
30 program->begin();
32 ImGui::ToTex(generator.get_rt_texture(0), 0, program->native_handle()).id,
33 ImVec2(256, 250));
34
35 if(light_val.type == light_type::directional)
36 {
37 for(uint8_t ii = 1; ii < light_val.directional_shadow_params.num_splits; ++ii)
38 {
39 ImGui::Image(ImGui::ToTex(generator.get_rt_texture(ii),
40 0,
41 program->native_handle())
42 .id,
43 ImVec2(256, 256));
44 }
45 }
46 program->end();
47 ImGui::EndGroup();
48
49 ImGui::TreePop();
50 ImGui::TreePop();
51 }
52
53 }
54
55
56 return result;
57}
58} // namespace unravel
Class that contains core light data, used for rendering and other purposes.
auto get_light() const -> const light &
Gets the light object.
void Image(gfx::texture_handle _handle, uint8_t _mip, uint8_t _flags, const ImVec2 &_size, const ImVec2 &_uv0=ImVec2(0.0f, 0.0f), const ImVec2 &_uv1=ImVec2(1.0f, 1.0f))
Definition imgui.h:167
ImTexture ToTex(gfx::texture_handle _handle, uint8_t _index, gfx::program_handle _phandle, uint8_t _mip=0, uint8_t _flags=IMGUI_FLAGS_ALPHA_BLEND)
Definition imgui.h:87
auto inspect_var_properties(rtti::context &ctx, entt::meta_any &var, const meta_any_proxy &var_proxy, const var_info &info, const entt::meta_custom &custom) -> inspect_result
Inspects all properties of a complex object recursively.
Result of an inspection operation indicating what changes occurred.
Definition inspector.h:146
auto inspect(rtti::context &ctx, entt::meta_any &var, const meta_any_proxy &var_proxy, const var_info &info, const entt::meta_custom &custom) -> inspect_result override
Safe deferred property access proxy for arbitrary object properties.
Definition inspector.h:198
Metadata about a variable being inspected.
Definition inspector.h:133
ImTextureID id
Definition imgui.h:84