From 08dec960e64668622269b41d0add21636335ceb5 Mon Sep 17 00:00:00 2001 From: jacob Date: Fri, 3 Apr 2026 15:31:27 -0500 Subject: [PATCH] push ui blend rates to style stack --- src/pp/pp_vis/pp_vis_core.c | 10 +++++++-- src/pp/pp_vis/pp_vis_core.h | 1 + src/ui/ui_core.c | 45 ++++++++++++++++++++++++++----------- src/ui/ui_core.h | 10 +++++++++ 4 files changed, 51 insertions(+), 15 deletions(-) diff --git a/src/pp/pp_vis/pp_vis_core.c b/src/pp/pp_vis/pp_vis_core.c index 75f43717..d8856016 100644 --- a/src/pp/pp_vis/pp_vis_core.c +++ b/src/pp/pp_vis/pp_vis_core.c @@ -632,8 +632,14 @@ V_WidgetTheme V_GetWidgetTheme(void) theme.window_padding = 1; //- Colors - theme.col.window_bg = Rgb32(0xff1a1d1e); theme.col.window_bd = Rgb32(0xff343a3b); + theme.col.window_fg = Rgb32(0xff1a1d1e); + theme.col.window_bg = theme.col.window_fg; + + // theme.col.window_bg.r = theme.col.window_fg.r * 0.6375; + // theme.col.window_bg.g = theme.col.window_fg.g * 0.6375; + // theme.col.window_bg.b = theme.col.window_fg.b * 0.6375; + // theme.col.window_bg.a = 1; theme.col.panel_bg = theme.col.window_bg; theme.col.panel_bd = theme.col.window_bd; @@ -4508,7 +4514,7 @@ void V_TickForever(WaveLaneCtx *lane) // UI_PushDF(TextColor, theme.col.hint) UI_BuildBox(); - UI_PushDF(Text, Lit("(Lane 0)")) + UI_PushDF(Text, Lit("Lane 0")) UI_PushDF(TextColor, theme.col.hint) UI_BuildBox(); } diff --git a/src/pp/pp_vis/pp_vis_core.h b/src/pp/pp_vis/pp_vis_core.h index f6f4b571..67db7280 100644 --- a/src/pp/pp_vis/pp_vis_core.h +++ b/src/pp/pp_vis/pp_vis_core.h @@ -59,6 +59,7 @@ Struct(V_WidgetTheme) struct { Vec4 window_bg; + Vec4 window_fg; Vec4 window_bd; Vec4 divider; diff --git a/src/ui/ui_core.c b/src/ui/ui_core.c index f9cb7021..9e230ee5 100644 --- a/src/ui/ui_core.c +++ b/src/ui/ui_core.c @@ -317,6 +317,11 @@ void UI_PushDefaults(void) case UI_StyleKind_DebugColor: { desc.style.DebugColor = Rgba(1, 0, 1, 0.5); } break; case UI_StyleKind_InvisibleDebugColor: { desc.style.InvisibleDebugColor = Rgba(0, 1, 1, 0.25); } break; case UI_StyleKind_BackgroundTextureSliceUv: { desc.style.BackgroundTextureSliceUv = RNG2(VEC2(0, 0), VEC2(1, 1)); } break; + case UI_StyleKind_ActiveRate: { desc.style.ActiveRate = 15; } break; + case UI_StyleKind_HotRate: { desc.style.HotRate = 15; } break; + case UI_StyleKind_HoveredRate: { desc.style.HoveredRate = 15; } break; + case UI_StyleKind_ExistsRate: { desc.style.ExistsRate = 30; } break; + case UI_StyleKind_MiscRate: { desc.style.MiscRate = Inf; } break; }; UI_PushStyle(desc); } @@ -494,6 +499,11 @@ UI_Key UI_BuildBoxEx(UI_Key semantic_key) n->cmd.box.zag_amplitude = UI_Top(ZagAmplitude); n->cmd.box.zag_thickness = UI_Top(ZagThickness); n->cmd.box.zag_roundness = UI_Top(ZagRoundness); + n->cmd.box.active_rate = UI_Top(ActiveRate); + n->cmd.box.hot_rate = UI_Top(HotRate); + n->cmd.box.hovered_rate = UI_Top(HoveredRate); + n->cmd.box.exists_rate = UI_Top(ExistsRate); + n->cmd.box.misc_rate = UI_Top(MiscRate); } ++frame->cmds_count; SllQueuePush(frame->first_cmd_node, frame->last_cmd_node, n); @@ -848,21 +858,30 @@ UI_Frame *UI_BeginFrame(UI_FrameFlag frame_flags) f32 target_hot = feedback->hot_absolute ? Inf : lower_target; f32 target_hovered = feedback->hovered_absolute ? Inf : lower_target; f32 target_exists = feedback->exists_absolute ? upper_target : lower_target; - f32 target_misc = box->desc.misc; + f64 target_misc = box->desc.misc; + + feedback->active_smooth = SaturateF32(LerpF32(feedback->active_smooth, target_active, box->desc.active_rate * frame->dt)); + feedback->hot_smooth = SaturateF32(LerpF32(feedback->hot_smooth, target_hot, box->desc.hot_rate * frame->dt)); + feedback->hovered_smooth = SaturateF32(LerpF32(feedback->hovered_smooth, target_hovered, box->desc.hovered_rate * frame->dt)); + feedback->exists_smooth = SaturateF32(LerpF32(feedback->exists_smooth, target_exists, box->desc.exists_rate * frame->dt)); + feedback->misc_smooth = SaturateF64(LerpF64(feedback->misc_smooth, target_misc, box->desc.misc_rate * frame->dt)); + + + // f32 active_blend_rate = (15 * frame->dt); + // f32 hot_blend_rate = (15 * frame->dt); + // f32 hovered_blend_rate = (15 * frame->dt); + // f32 exists_blend_rate = (30 * frame->dt); + // // f64 misc_blend_rate = (30 * frame->dt); + // f64 misc_blend_rate = 1; + + // feedback->active_smooth = SaturateF32(LerpF32(feedback->active_smooth, target_active, active_blend_rate)); + // feedback->hot_smooth = SaturateF32(LerpF32(feedback->hot_smooth, target_hot, hot_blend_rate)); + // feedback->hovered_smooth = SaturateF32(LerpF32(feedback->hovered_smooth, target_hovered, hovered_blend_rate)); + // feedback->exists_smooth = SaturateF32(LerpF32(feedback->exists_smooth, target_exists, exists_blend_rate)); + // feedback->misc_smooth = SaturateF32(LerpF32(feedback->misc_smooth, target_misc, misc_blend_rate)); + - // TODO: Configurable per-box blend rates - f32 active_blend_rate = (15 * frame->dt); - f32 hot_blend_rate = (15 * frame->dt); - f32 hovered_blend_rate = (15 * frame->dt); - f32 exists_blend_rate = (30 * frame->dt); - // f64 misc_blend_rate = (30 * frame->dt); - f64 misc_blend_rate = 1; - feedback->active_smooth = SaturateF32(LerpF32(feedback->active_smooth, target_active, active_blend_rate)); - feedback->hot_smooth = SaturateF32(LerpF32(feedback->hot_smooth, target_hot, hot_blend_rate)); - feedback->hovered_smooth = SaturateF32(LerpF32(feedback->hovered_smooth, target_hovered, hovered_blend_rate)); - feedback->exists_smooth = SaturateF32(LerpF32(feedback->exists_smooth, target_exists, exists_blend_rate)); - feedback->misc_smooth = SaturateF32(LerpF32(feedback->misc_smooth, target_misc, misc_blend_rate)); feedback->screen_rect = box->screen_rect; feedback->screen_anchor = box->screen_anchor; diff --git a/src/ui/ui_core.h b/src/ui/ui_core.h index fea88c1b..236a9052 100644 --- a/src/ui/ui_core.h +++ b/src/ui/ui_core.h @@ -160,6 +160,11 @@ Enum(UI_DebugBreakFlag) X(ZagAmplitude, f32) \ X(ZagThickness, f32) \ X(ZagRoundness, f32) \ + X(ActiveRate, f32) \ + X(HotRate, f32) \ + X(HoveredRate, f32) \ + X(ExistsRate, f32) \ + X(MiscRate, f64) \ /* --------------------------------------------- */ \ /* --------------- Virtual styles -------------- */ \ /* --------------------------------------------- */ \ @@ -304,6 +309,11 @@ Struct(UI_BoxDesc) f32 zag_amplitude; f32 zag_thickness; f32 zag_roundness; + f32 active_rate; + f32 hot_rate; + f32 hovered_rate; + f32 exists_rate; + f32 misc_rate; }; Struct(UI_Cmd)