Skip to content

Commit

Permalink
feat: still playback mode
Browse files Browse the repository at this point in the history
  • Loading branch information
mosure committed Dec 29, 2024
1 parent 156f86b commit d800e9e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/gaussian/settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ pub enum PlaybackMode {
Loop,
Once,
Sin,
Still,
}


Expand Down Expand Up @@ -158,6 +159,9 @@ fn playback_update(
}
}
PlaybackMode::Sin => {}
PlaybackMode::Still => {
continue;
}
}

// forward condition
Expand All @@ -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
Expand All @@ -181,6 +186,7 @@ fn playback_update(
}
PlaybackMode::Once => {}
PlaybackMode::Sin => {}
PlaybackMode::Still => {}
}
}
}
4 changes: 2 additions & 2 deletions src/render/gaussian.wgsl
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
2 changes: 2 additions & 0 deletions viewer/viewer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ use bevy_gaussian_splatting::{
PlanarGaussian3dHandle,
PlanarGaussian4dHandle,
gaussian::interface::TestCloud,
gaussian::settings::PlaybackMode,
random_gaussians_3d,
random_gaussians_4d,
utils::{
Expand Down Expand Up @@ -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"),
Expand Down

0 comments on commit d800e9e

Please sign in to comment.