some organization pass, still need to review a bunch
This commit is contained in:
+13
-15
@@ -11,20 +11,19 @@ class CRTFilter:
|
||||
|
||||
def render(self, width: float, height: float):
|
||||
"""
|
||||
[C: tests/test_theme_nerv_alert.py:test_alert_pulsing_render_active, tests/test_theme_nerv_alert.py:test_alert_pulsing_render_inactive, tests/test_theme_nerv_fx.py:TestThemeNervFx.test_alert_pulsing_render, tests/test_theme_nerv_fx.py:TestThemeNervFx.test_crt_filter_disabled, tests/test_theme_nerv_fx.py:TestThemeNervFx.test_crt_filter_render]
|
||||
[C: tests/test_theme_nerv_alert.py:test_alert_pulsing_render_active, tests/test_theme_nerv_alert.py:test_alert_pulsing_render_inactive, tests/test_theme_nerv_fx.py:TestThemeNervFx.test_alert_pulsing_render, tests/test_theme_nerv_fx.py:TestThemeNervFx.test_crt_filter_disabled, tests/test_theme_nerv_fx.py:TestThemeNervFx.test_crt_filter_render]
|
||||
"""
|
||||
if not self.enabled:
|
||||
return
|
||||
if not self.enabled: return
|
||||
draw_list = imgui.get_foreground_draw_list()
|
||||
|
||||
# 1. Enhanced Scanlines (Horizontal)
|
||||
# Vary thickness and alpha for a more "analog" feel
|
||||
for y in range(0, int(height), 2):
|
||||
# Thicker/Darker every 4 pixels
|
||||
is_major = (y % 4 == 0)
|
||||
alpha = 0.08 if is_major else 0.04
|
||||
thickness = 1.2 if is_major else 0.8
|
||||
s_color = imgui.get_color_u32((0.0, 0.0, 0.0, alpha))
|
||||
is_major = (y % 4 == 0)
|
||||
alpha = 0.08 if is_major else 0.04
|
||||
thickness = 1.2 if is_major else 0.8
|
||||
s_color = imgui.get_color_u32((0.0, 0.0, 0.0, alpha))
|
||||
draw_list.add_line((0.0, float(y)), (float(width), float(y)), s_color, thickness)
|
||||
|
||||
# 2. Shadow Mask (Vertical)
|
||||
@@ -38,12 +37,11 @@ class CRTFilter:
|
||||
v_steps = 20
|
||||
for i in range(v_steps):
|
||||
# Exponential alpha for smoother falloff
|
||||
alpha = (i / v_steps) ** 3.0 * 0.25
|
||||
alpha = (i / v_steps) ** 3.0 * 0.25
|
||||
v_color = imgui.get_color_u32((0.0, 0.0, 0.0, alpha))
|
||||
|
||||
# Inset and rounding grow to simulate tube curvature
|
||||
inset = (v_steps - i) * 4.5
|
||||
rounding = 60.0 + (v_steps - i) * 8.0
|
||||
inset = (v_steps - i) * 4.5
|
||||
rounding = 60.0 + (v_steps - i) * 8.0
|
||||
thickness = 15.0
|
||||
|
||||
if width > inset * 2.0 and height > inset * 2.0:
|
||||
@@ -70,7 +68,7 @@ class StatusFlicker:
|
||||
def get_alpha(self) -> float:
|
||||
# Modulate between 0.7 and 1.0 using sin wave
|
||||
"""
|
||||
[C: tests/test_theme_nerv_fx.py:TestThemeNervFx.test_status_flicker_get_alpha]
|
||||
[C: tests/test_theme_nerv_fx.py:TestThemeNervFx.test_status_flicker_get_alpha]
|
||||
"""
|
||||
return 0.85 + 0.15 * math.sin(time.time() * 20.0)
|
||||
|
||||
@@ -80,13 +78,13 @@ class AlertPulsing:
|
||||
|
||||
def update(self, status: str):
|
||||
"""
|
||||
[C: tests/test_spawn_interception_v2.py:MockDialog.wait, tests/test_theme_nerv_alert.py:test_alert_pulsing_update, tests/test_theme_nerv_fx.py:TestThemeNervFx.test_alert_pulsing_update]
|
||||
[C: tests/test_spawn_interception_v2.py:MockDialog.wait, tests/test_theme_nerv_alert.py:test_alert_pulsing_update, tests/test_theme_nerv_fx.py:TestThemeNervFx.test_alert_pulsing_update]
|
||||
"""
|
||||
self.active = status.lower().startswith("error")
|
||||
|
||||
def render(self, width: float, height: float):
|
||||
"""
|
||||
[C: tests/test_theme_nerv_alert.py:test_alert_pulsing_render_active, tests/test_theme_nerv_alert.py:test_alert_pulsing_render_inactive, tests/test_theme_nerv_fx.py:TestThemeNervFx.test_alert_pulsing_render, tests/test_theme_nerv_fx.py:TestThemeNervFx.test_crt_filter_disabled, tests/test_theme_nerv_fx.py:TestThemeNervFx.test_crt_filter_render]
|
||||
[C: tests/test_theme_nerv_alert.py:test_alert_pulsing_render_active, tests/test_theme_nerv_alert.py:test_alert_pulsing_render_inactive, tests/test_theme_nerv_fx.py:TestThemeNervFx.test_alert_pulsing_render, tests/test_theme_nerv_fx.py:TestThemeNervFx.test_crt_filter_disabled, tests/test_theme_nerv_fx.py:TestThemeNervFx.test_crt_filter_render]
|
||||
"""
|
||||
if not self.active:
|
||||
return
|
||||
@@ -96,4 +94,4 @@ class AlertPulsing:
|
||||
# multiply by (0.2 - 0.05) = 0.15 and add 0.05
|
||||
alpha = 0.05 + 0.15 * ((math.sin(time.time() * 4.0) + 1.0) / 2.0)
|
||||
color = imgui.get_color_u32((1.0, 0.0, 0.0, alpha))
|
||||
draw_list.add_rect((0.0, 0.0), (width, height), color, 0.0, 0, 10.0)
|
||||
draw_list.add_rect((0.0, 0.0), (width, height), color, 0.0, 0, 10.0)
|
||||
|
||||
Reference in New Issue
Block a user