diff options
Diffstat (limited to 'src/gpu/effects/flash_cube_effect.cc')
| -rw-r--r-- | src/gpu/effects/flash_cube_effect.cc | 14 |
1 files changed, 7 insertions, 7 deletions
diff --git a/src/gpu/effects/flash_cube_effect.cc b/src/gpu/effects/flash_cube_effect.cc index f01bbd1..ee25408 100644 --- a/src/gpu/effects/flash_cube_effect.cc +++ b/src/gpu/effects/flash_cube_effect.cc @@ -48,11 +48,11 @@ void FlashCubeEffect::init(MainSequence* demo) { scene_.add_object(cube); } -void FlashCubeEffect::render(WGPURenderPassEncoder pass, float time, float beat, - float intensity, float aspect_ratio) { +void FlashCubeEffect::render(WGPURenderPassEncoder pass, + const CommonPostProcessUniforms& uniforms) { // Detect beat changes for flash trigger (using intensity as proxy for beat // hits) Intensity spikes on beats, so we can use it to trigger flashes - if (intensity > 0.5f && + if (uniforms.audio_intensity > 0.5f && flash_intensity_ < 0.3f) { // High intensity + flash cooled down flash_intensity_ = 1.0f; // Trigger full flash } @@ -73,12 +73,12 @@ void FlashCubeEffect::render(WGPURenderPassEncoder pass, float time, float beat, // Slowly rotate the cube for visual interest scene_.objects[0].rotation = - quat::from_axis(vec3(0.3f, 1, 0.2f), time * 0.05f); + quat::from_axis(vec3(0.3f, 1, 0.2f), uniforms.time * 0.05f); // Position camera OUTSIDE the cube looking at it from a distance // This way we see the cube as a background element float cam_distance = 150.0f; // Much farther to ensure it's behind everything - float orbit_angle = time * 0.1f; + float orbit_angle = uniforms.time * 0.1f; camera_.set_look_at( vec3(std::sin(orbit_angle) * cam_distance, @@ -87,11 +87,11 @@ void FlashCubeEffect::render(WGPURenderPassEncoder pass, float time, float beat, vec3(0, 0, 0), // Look at cube center vec3(0, 1, 0)); - camera_.aspect_ratio = aspect_ratio; + camera_.aspect_ratio = uniforms.aspect_ratio; // Extend far plane to accommodate distant camera position (150 units + cube // size) camera_.far_plane = 300.0f; // Draw the cube - renderer_.draw(pass, scene_, camera_, time); + renderer_.draw(pass, scene_, camera_, uniforms.time); } |
