summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/gpu/effects/flash_effect.cc10
1 files changed, 6 insertions, 4 deletions
diff --git a/src/gpu/effects/flash_effect.cc b/src/gpu/effects/flash_effect.cc
index 217a7bb..5aebe2d 100644
--- a/src/gpu/effects/flash_effect.cc
+++ b/src/gpu/effects/flash_effect.cc
@@ -15,7 +15,7 @@ FlashEffect::FlashEffect(const GpuContext& ctx)
struct Uniforms {
flash_intensity: f32,
- _pad0: f32,
+ intensity: f32,
_pad1: f32,
_pad2: f32,
};
@@ -42,7 +42,9 @@ FlashEffect::FlashEffect(const GpuContext& ctx)
let color = textureSample(inputTexture, inputSampler, input.uv);
// Add white flash: blend towards white based on flash intensity
let white = vec3<f32>(1.0, 1.0, 1.0);
- let flashed = mix(color.rgb, white, uniforms.flash_intensity);
+ let green = vec3<f32>(0.0, 1.0, 0.0);
+ var flashed = mix(color.rgb, green, uniforms.intensity);
+ if (input.uv.y > .5) { flashed = mix(color.rgb, white, uniforms.flash_intensity); }
return vec4<f32>(flashed, color.a);
}
)";
@@ -68,9 +70,9 @@ void FlashEffect::render(WGPURenderPassEncoder pass, float time, float beat,
}
// Exponential decay
- flash_intensity_ *= 0.85f;
+ flash_intensity_ *= 0.98f;
- float uniforms[4] = {flash_intensity_, 0.0f, 0.0f, 0.0f};
+ float uniforms[4] = {flash_intensity_, intensity, 0.0f, 0.0f};
wgpuQueueWriteBuffer(ctx_.queue, uniforms_.buffer, 0, uniforms, sizeof(uniforms));
wgpuRenderPassEncoderSetPipeline(pass, pipeline_);