diff options
Diffstat (limited to 'src/gpu/effects/theme_modulation_effect.cc')
| -rw-r--r-- | src/gpu/effects/theme_modulation_effect.cc | 18 |
1 files changed, 5 insertions, 13 deletions
diff --git a/src/gpu/effects/theme_modulation_effect.cc b/src/gpu/effects/theme_modulation_effect.cc index b1eff90..aff6bce 100644 --- a/src/gpu/effects/theme_modulation_effect.cc +++ b/src/gpu/effects/theme_modulation_effect.cc @@ -76,26 +76,18 @@ void ThemeModulationEffect::update_bind_group(WGPUTextureView input_view) { uniforms_.get(), params_buffer_); } -void ThemeModulationEffect::render(WGPURenderPassEncoder pass, float time, - float beat, float intensity, - float aspect_ratio) { - const CommonPostProcessUniforms u = { - .resolution = {(float)width_, (float)height_}, - .aspect_ratio = aspect_ratio, - .time = time, - .beat = beat, - .audio_intensity = intensity, - }; - uniforms_.update(ctx_.queue, u); +void ThemeModulationEffect::render(WGPURenderPassEncoder pass, + const CommonPostProcessUniforms& uniforms) { + uniforms_.update(ctx_.queue, uniforms); // Alternate between bright and dark every 4 seconds (2 pattern changes) // Music patterns change every 2 seconds at 120 BPM - float cycle_time = fmodf(time, 8.0f); // 8 second cycle (4 patterns) + float cycle_time = fmodf(uniforms.time, 8.0f); // 8 second cycle (4 patterns) bool is_dark_section = (cycle_time >= 4.0f); // Dark for second half // Smooth transition between themes using a sine wave float transition = - (std::sin(time * 3.14159f / 4.0f) + 1.0f) * 0.5f; // 0.0 to 1.0 + (std::sin(uniforms.time * 3.14159f / 4.0f) + 1.0f) * 0.5f; // 0.0 to 1.0 float bright_value = 1.0f; float dark_value = 0.35f; float theme_brightness = |
