summaryrefslogtreecommitdiff
path: root/src/gpu/effects/hybrid_3d_effect.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/gpu/effects/hybrid_3d_effect.cc')
-rw-r--r--src/gpu/effects/hybrid_3d_effect.cc57
1 files changed, 35 insertions, 22 deletions
diff --git a/src/gpu/effects/hybrid_3d_effect.cc b/src/gpu/effects/hybrid_3d_effect.cc
index ee2dd57..0dbd786 100644
--- a/src/gpu/effects/hybrid_3d_effect.cc
+++ b/src/gpu/effects/hybrid_3d_effect.cc
@@ -101,31 +101,44 @@ void Hybrid3DEffect::render(WGPURenderPassEncoder pass, float time, float beat,
scene_.objects[i].position.y = std::sin(time * 3.0f + i) * 1.5f;
}
- // Create erratic, eased time variables for camera motion
+ // Camera jumps every other pattern (2 seconds) for dramatic effect
+ int pattern_num = (int)(time / 2.0f);
+ int camera_preset = pattern_num % 4; // Cycle through 4 different angles
- float erratic_time_radius = ease_in_out_cubic(fmodf(time * 0.2f, 1.0f));
+ vec3 cam_pos, cam_target;
- float erratic_time_height = ease_in_out_cubic(fmodf(time * 0.3f, 1.0f));
-
- float erratic_time_orbit = ease_in_out_cubic(fmodf(time * 0.1f, 1.0f));
-
- // Animate Camera
-
- float cam_radius = 10.0f + std::sin(erratic_time_radius * 6.28318f) * 4.0f;
-
- float cam_height = 5.0f + std::cos(erratic_time_height * 6.28318f) * 3.0f;
-
- camera_.set_look_at(
-
- vec3(std::sin(erratic_time_orbit * 6.28318f) * cam_radius, cam_height,
- std::cos(erratic_time_orbit * 6.28318f) * cam_radius),
-
- vec3(0, 0, 0),
-
- vec3(0, 1, 0)
-
- );
+ switch (camera_preset) {
+ case 0: // High angle, orbiting
+ {
+ float angle = time * 0.5f;
+ cam_pos = vec3(std::sin(angle) * 12.0f, 8.0f, std::cos(angle) * 12.0f);
+ cam_target = vec3(0, 0, 0);
+ }
+ break;
+ case 1: // Low angle, close-up
+ {
+ float angle = time * 0.3f + 1.57f; // Offset angle
+ cam_pos = vec3(std::sin(angle) * 6.0f, 2.0f, std::cos(angle) * 6.0f);
+ cam_target = vec3(0, 1, 0);
+ }
+ break;
+ case 2: // Side view, sweeping
+ {
+ float sweep = std::sin(time * 0.4f) * 10.0f;
+ cam_pos = vec3(sweep, 5.0f, 8.0f);
+ cam_target = vec3(0, 0, 0);
+ }
+ break;
+ case 3: // Top-down, rotating
+ {
+ float angle = time * 0.6f;
+ cam_pos = vec3(std::sin(angle) * 5.0f, 12.0f, std::cos(angle) * 5.0f);
+ cam_target = vec3(0, 0, 0);
+ }
+ break;
+ }
+ camera_.set_look_at(cam_pos, cam_target, vec3(0, 1, 0));
camera_.aspect_ratio = aspect_ratio;
// Draw