diff options
Diffstat (limited to 'src/gpu/effects/rotating_cube_effect.cc')
| -rw-r--r-- | src/gpu/effects/rotating_cube_effect.cc | 9 |
1 files changed, 4 insertions, 5 deletions
diff --git a/src/gpu/effects/rotating_cube_effect.cc b/src/gpu/effects/rotating_cube_effect.cc index da973e5..79a540b 100644 --- a/src/gpu/effects/rotating_cube_effect.cc +++ b/src/gpu/effects/rotating_cube_effect.cc @@ -182,9 +182,8 @@ void RotatingCubeEffect::init(MainSequence* demo) { wgpuBindGroupLayoutRelease(bgl_1); } -void RotatingCubeEffect::render(WGPURenderPassEncoder pass, float time, - float beat, float intensity, - float aspect_ratio) { +void RotatingCubeEffect::render(WGPURenderPassEncoder pass, + const CommonPostProcessUniforms& u) { rotation_ += 0.016f * 1.5f; const vec3 camera_pos = vec3(0, 0, 5); @@ -193,7 +192,7 @@ void RotatingCubeEffect::render(WGPURenderPassEncoder pass, float time, const mat4 view = mat4::look_at(camera_pos, target, up); const float fov = 60.0f * 3.14159f / 180.0f; - const mat4 proj = mat4::perspective(fov, aspect_ratio, 0.1f, 100.0f); + const mat4 proj = mat4::perspective(fov, u.aspect_ratio, 0.1f, 100.0f); const mat4 view_proj = proj * view; const quat rot = quat::from_axis(vec3(0.3f, 1.0f, 0.2f), rotation_); @@ -206,7 +205,7 @@ void RotatingCubeEffect::render(WGPURenderPassEncoder pass, float time, const Uniforms uniforms = { .view_proj = view_proj, .inv_view_proj = view_proj.inverse(), - .camera_pos_time = vec4(camera_pos.x, camera_pos.y, camera_pos.z, time), + .camera_pos_time = vec4(camera_pos.x, camera_pos.y, camera_pos.z, u.time), .params = vec4(1.0f, 0.0f, 0.0f, 0.0f), .resolution = vec2(1280.0f, 720.0f), }; |
