From d800e9e9349e923c2b56cef7c66fac14ab5bc299 Mon Sep 17 00:00:00 2001 From: mosure Date: Sun, 29 Dec 2024 17:48:14 -0600 Subject: [PATCH] feat: still playback mode --- src/gaussian/settings.rs | 6 ++++++ src/render/gaussian.wgsl | 4 ++-- viewer/viewer.rs | 2 ++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/gaussian/settings.rs b/src/gaussian/settings.rs index fa332ed7..ebe3ecbb 100644 --- a/src/gaussian/settings.rs +++ b/src/gaussian/settings.rs @@ -61,6 +61,7 @@ pub enum PlaybackMode { Loop, Once, Sin, + Still, } @@ -158,6 +159,9 @@ fn playback_update( } } PlaybackMode::Sin => {} + PlaybackMode::Still => { + continue; + } } // forward condition @@ -170,6 +174,7 @@ fn playback_update( let y = (theta * 2.0 * std::f32::consts::PI).sin(); settings.time = settings.time_start + (settings.time_stop - settings.time_start) * (y + 1.0) / 2.0; } + PlaybackMode::Still => {} } // reset condition @@ -181,6 +186,7 @@ fn playback_update( } PlaybackMode::Once => {} PlaybackMode::Sin => {} + PlaybackMode::Still => {} } } } diff --git a/src/render/gaussian.wgsl b/src/render/gaussian.wgsl index 7bfa0fbf..48013f34 100644 --- a/src/render/gaussian.wgsl +++ b/src/render/gaussian.wgsl @@ -186,8 +186,8 @@ fn vs_points( #ifdef GAUSSIAN_4D #else - let origin_projected_position = world_to_clip(transformed_position); - discard_quad |= !in_frustum(origin_projected_position.xyz); + let projected_position = world_to_clip(transformed_position); + discard_quad |= !in_frustum(projected_position.xyz); #endif if (discard_quad) { diff --git a/viewer/viewer.rs b/viewer/viewer.rs index eecc18f4..a57fc3ef 100644 --- a/viewer/viewer.rs +++ b/viewer/viewer.rs @@ -33,6 +33,7 @@ use bevy_gaussian_splatting::{ PlanarGaussian3dHandle, PlanarGaussian4dHandle, gaussian::interface::TestCloud, + gaussian::settings::PlaybackMode, random_gaussians_3d, random_gaussians_4d, utils::{ @@ -108,6 +109,7 @@ fn setup_gaussian_cloud( PlanarGaussian4dHandle(cloud), CloudSettings { gaussian_mode: args.gaussian_mode, + playback_mode: PlaybackMode::Sin, ..default() }, Name::new("gaussian_cloud_4d"),