summaryrefslogtreecommitdiff
path: root/cnn_v3
diff options
context:
space:
mode:
authorskal <pascal.massimino@gmail.com>2026-03-22 19:51:16 +0100
committerskal <pascal.massimino@gmail.com>2026-03-22 19:51:16 +0100
commit47f946b234b8a103986c1b332f04be207fac854d (patch)
tree799037f0c0a0e1c3e440c255cb258997c1690750 /cnn_v3
parentd41e26b4a0be6fa7f27fc5d6e26505472eb946a9 (diff)
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.
Diffstat (limited to 'cnn_v3')
-rw-r--r--cnn_v3/src/gbuffer_effect.cc9
1 files changed, 9 insertions, 0 deletions
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];