diff options
Diffstat (limited to 'src/gpu/effects/flash_effect.h')
| -rw-r--r-- | src/gpu/effects/flash_effect.h | 45 |
1 files changed, 0 insertions, 45 deletions
diff --git a/src/gpu/effects/flash_effect.h b/src/gpu/effects/flash_effect.h deleted file mode 100644 index 1ac75a4..0000000 --- a/src/gpu/effects/flash_effect.h +++ /dev/null @@ -1,45 +0,0 @@ -// This file is part of the 64k demo project. -// It declares the FlashEffect - brief white flash on beat hits. - -#pragma once - -#include "gpu/effect.h" -#include "gpu/gpu.h" -#include "gpu/uniform_helper.h" - -// Parameters for FlashEffect (set at construction time) -struct FlashEffectParams { - float color[3] = {1.0f, 1.0f, 1.0f}; // Default: white - float decay_rate = 0.98f; // Default: fast decay - float trigger_threshold = 0.7f; // Default: trigger on strong beats -}; - -// Uniform data sent to GPU shader -// IMPORTANT: Must match WGSL struct layout with proper alignment -// vec3<f32> in WGSL has 16-byte alignment, not 12-byte! -struct FlashUniforms { - float flash_intensity; // offset 0 - float intensity; // offset 4 - float _pad1[2]; // offset 8-15 (padding for vec3 alignment) - float color[3]; // offset 16-27 (vec3 aligned to 16 bytes) - float _pad2; // offset 28-31 -}; -static_assert(sizeof(FlashUniforms) == 32, - "FlashUniforms must be 32 bytes for WGSL alignment"); - -class FlashEffect : public PostProcessEffect { - public: - // Backward compatibility constructor (uses default params) - FlashEffect(const GpuContext& ctx); - // New parameterized constructor - FlashEffect(const GpuContext& ctx, const FlashEffectParams& params); - void render(WGPURenderPassEncoder pass, - const CommonPostProcessUniforms& uniforms) override; - void update_bind_group(WGPUTextureView input_view) override; - - private: - FlashEffectParams params_; - UniformBuffer<FlashUniforms> flash_uniforms_; - UniformBuffer<FlashEffectParams> params_buffer_; - float flash_intensity_ = 0.0f; -}; |
