Unravel Engine C++ Reference
Loading...
Searching...
No Matches
inspector_reflection_probe.cpp
Go to the documentation of this file.
2#include "inspectors.h"
3
5
6namespace unravel
7{
8
10 entt::meta_any& var,
11 const meta_any_proxy& var_proxy,
12 const var_info& info,
13 const entt::meta_custom& custom) -> inspect_result
14{
15 inspect_result result;
16 auto& data = var.cast<reflection_probe_component&>();
17
18 // Status line: shows whether a bake is currently in flight.
19 bool is_realitme = data.get_update_mode() == probe_update_mode::realtime;
20 bool is_realitme_live = data.get_update_interval() < 0.01f;
21 const bool dirty = data.is_dirty();
22 ImGui::AlignTextToFramePadding();
23 ImGui::TextUnformatted("Status:");
24 ImGui::SameLine();
25 if(is_realitme && is_realitme_live)
26 {
27 ImGui::TextColored(ImVec4(0.4f, 0.8f, 0.4f, 1.0f), ICON_MDI_REFRESH " Realtime");
28 }
29 else if(dirty)
30 {
31 ImGui::TextColored(ImVec4(0.95f, 0.75f, 0.25f, 1.0f), ICON_MDI_REFRESH " Baking...");
32 }
33 else
34 {
35 ImGui::TextColored(ImVec4(0.4f, 0.8f, 0.4f, 1.0f), "Ready");
36 }
37
38 // "Bake Now" triggers a full 1-frame rebuild so the user sees an instant result.
39 if(ImGui::Button(ICON_MDI_HAMMER " Bake Now"))
40 {
41 data.mark_dirty(true);
42 result.changed = true;
43 }
44 ImGui::SetItemTooltip(
45 "Force an immediate full rebuild of this probe's cubemap in the next frame.\n"
46 "Ignores time-slicing so the result is visible right away.");
47
48 ImGui::SameLine();
49 if(ImGui::Button(ICON_MDI_RELOAD " Refresh"))
50 {
51 data.mark_dirty(false);
52 result.changed = true;
53 }
54 ImGui::SetItemTooltip(
55 "Schedule a time-sliced refresh. Faces will be rebuilt over multiple frames\n"
56 "according to Faces Per Frame, avoiding editor hitches.");
57
58 ImGui::Separator();
59
60 result |= inspect_var_properties(ctx, var, var_proxy, info, custom);
61
62 return result;
63}
64
65} // namespace unravel
Class that contains core reflection probe data, used for rendering and other purposes.
auto get_update_mode() const -> probe_update_mode
Gets the probe's update policy.
#define ICON_MDI_REFRESH
#define ICON_MDI_HAMMER
#define ICON_MDI_RELOAD
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:164
bool changed
Whether the value was modified during inspection.
Definition inspector.h:166
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:216
Metadata about a variable being inspected.
Definition inspector.h:151