diff options
Diffstat (limited to 'editor')
-rw-r--r-- | editor/imgui.cpp | 16 | ||||
-rw-r--r-- | editor/inspect-types.cpp | 21 |
2 files changed, 13 insertions, 24 deletions
diff --git a/editor/imgui.cpp b/editor/imgui.cpp index c6a5bff9..df75501a 100644 --- a/editor/imgui.cpp +++ b/editor/imgui.cpp @@ -170,28 +170,22 @@ void app::draw_light_info() switch (e.falloff) { default: falloff = "?"_s; break; - case light_falloff::constant: falloff = "Constant"_s; break; - case light_falloff::linear: falloff = "Linear"_s; break; - case light_falloff::quadratic: falloff = "Quadratic"_s; break; + case light_falloff::constant: falloff = "constant"_s; break; + case light_falloff::linear: falloff = "linear"_s; break; + case light_falloff::quadratic: falloff = "quadratic"_s; break; } - char dist[32]; - if (!e.symmetric) - snformat(dist, "{{{}, {}}}"_cf, e.half_dist.x(), e.half_dist.y()); - else - snformat(dist, "{}"_cf, e.half_dist.x()); - // todo add rendering color as part of the lightbulb icon #if 0 char color[8]; snformat(color, "{:2X}{:2X}{:2X}"_cf, e.color.x(), e.color.y(), e.color.z()); #endif - char buf[128]; + if (e.falloff == light_falloff::constant) snformat(buf, "{}"_cf, falloff); else - snformat(buf, "{} D={}"_cf, falloff, dist); + snformat(buf, "{} range={}"_cf, falloff, e.max_distance); auto text_size = ImGui::CalcTextSize(buf); float offy = dest.max().y() + 5 * dpi.y(); diff --git a/editor/inspect-types.cpp b/editor/inspect-types.cpp index 75d79901..c7d4b494 100644 --- a/editor/inspect-types.cpp +++ b/editor/inspect-types.cpp @@ -203,7 +203,8 @@ template<typename U> struct enum_values<light_falloff, U> }; template<> -struct entity_accessors<light> { +struct entity_accessors<light> +{ static constexpr auto accessors() { using E = Entity<light>; @@ -218,19 +219,13 @@ struct entity_accessors<light> { [](const light& x) { return x.falloff; }, [](light& x, light_falloff value) { x.falloff = value; }, }, - E::type<Vector2>::field{"half-dist"_s, - [](const light& x) { return x.half_dist; }, - [](light& x, Vector2 value) { x.half_dist = value; }, - [](const light& x) { return !x.symmetric ? st::enabled : st::hidden; }, - }, - E::type<float>::field{"half-dist"_s, - [](const light& x) { return x.half_dist.x(); }, - [](light& x, float value) { x.half_dist = Vector2(value); }, - [](const light& x) { return x.symmetric ? st::enabled : st::hidden; } + E::type<float>::field{"range"_s, + [](const light& x) { return x.max_distance; }, + [](light& x, float value) { x.max_distance = value; }, }, - E::type<bool>::field{"symmetric"_s, - [](const light& x) { return x.symmetric; }, - [](light& x, bool value) { x.symmetric = value; if (value) x.half_dist = Vector2(x.half_dist.x()); }, + E::type<bool>::field{"enabled"_s, + [](const light& x) { return !!x.enabled; }, + [](light& x, bool value) { x.enabled = value; }, }, }; return std::tuple_cat(tuple0, tuple); |