summaryrefslogtreecommitdiff
path: root/src/gpu/effects/theme_modulation_effect.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/effects/theme_modulation_effect.cc')
-rw-r--r--src/gpu/effects/theme_modulation_effect.cc17
1 files changed, 10 insertions, 7 deletions
diff --git a/src/gpu/effects/theme_modulation_effect.cc b/src/gpu/effects/theme_modulation_effect.cc
index 4ddb1f4..d2705d5 100644
--- a/src/gpu/effects/theme_modulation_effect.cc
+++ b/src/gpu/effects/theme_modulation_effect.cc
@@ -51,7 +51,8 @@ ThemeModulationEffect::ThemeModulationEffect(WGPUDevice device, WGPUQueue queue,
pipeline_ = create_post_process_pipeline(device, format, shader_code);
// Create uniform buffer (4 floats: brightness + padding)
- uniforms_ = gpu_create_buffer(device, 16, WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst);
+ uniforms_ = gpu_create_buffer(
+ device, 16, WGPUBufferUsage_Uniform | WGPUBufferUsage_CopyDst);
}
void ThemeModulationEffect::update_bind_group(WGPUTextureView input_view) {
@@ -59,22 +60,24 @@ void ThemeModulationEffect::update_bind_group(WGPUTextureView input_view) {
}
void ThemeModulationEffect::render(WGPURenderPassEncoder pass, float time,
- float beat, float intensity,
- float aspect_ratio) {
+ float beat, float intensity,
+ float aspect_ratio) {
(void)beat;
(void)intensity;
(void)aspect_ratio;
// 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)
- bool is_dark_section = (cycle_time >= 4.0f); // Dark for second half
+ float cycle_time = fmodf(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
+ float transition =
+ (std::sin(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 = bright_value + (dark_value - bright_value) * transition;
+ float theme_brightness =
+ bright_value + (dark_value - bright_value) * transition;
// Update uniform buffer
float uniforms[4] = {theme_brightness, 0.0f, 0.0f, 0.0f};