From 47f946b234b8a103986c1b332f04be207fac854d Mon Sep 17 00:00:00 2001 From: skal Date: Sun, 22 Mar 2026 19:51:16 +0100 Subject: fix(cnn_v3): call set_scene() in constructor + orbiting camera - GBufferEffect::render() was a no-op (scene_ready_=false) because set_scene() was never called from the timeline sequence constructor. Fixed by calling set_scene() at the end of the constructor. - Camera now orbits the scene at 0.3 rad/s (R=6, y=2.5). handoff(Gemini): cnn_v3_test sequence now renders G-buffer + GBufViewEffect with animated orbiting camera. --- cnn_v3/src/gbuffer_effect.cc | 9 +++++++++ 1 file changed, 9 insertions(+) (limited to 'cnn_v3') diff --git a/cnn_v3/src/gbuffer_effect.cc b/cnn_v3/src/gbuffer_effect.cc index 06e5e66..ff78cf8 100644 --- a/cnn_v3/src/gbuffer_effect.cc +++ b/cnn_v3/src/gbuffer_effect.cc @@ -74,6 +74,8 @@ GBufferEffect::GBufferEffect(const GpuContext& ctx, create_raster_pipeline(); create_shadow_pipeline(); create_pack_pipeline(); + + set_scene(); } void GBufferEffect::declare_nodes(NodeRegistry& registry) { @@ -189,6 +191,13 @@ void GBufferEffect::render(WGPUCommandEncoder encoder, // Update camera aspect ratio from current resolution. camera_.aspect_ratio = params.aspect_ratio; + // Slowly orbit around the scene. + const float angle = params.time * 0.3f; + const float R = 6.0f; + camera_.set_look_at(vec3(R * sinf(angle), 2.5f, R * cosf(angle)), + vec3(0.0f, 0.0f, 0.0f), + vec3(0.0f, 1.0f, 0.0f)); + // Animate cubes: axis-angle rotation driven by physical time. for (int i = 0; i < (int)cube_anims_.size(); ++i) { const CubeAnim& a = cube_anims_[(size_t)i]; -- cgit v1.2.3