Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: support gaussian clouds with no gaussian cameras #126

Merged
merged 2 commits into from
Nov 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "bevy_gaussian_splatting"
description = "bevy gaussian splatting render pipeline plugin"
version = "2.7.4"
version = "2.7.5"
edition = "2021"
authors = ["mosure <[email protected]>"]
license = "MIT OR Apache-2.0"
Expand Down
1 change: 0 additions & 1 deletion src/camera.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ fn apply_camera_warmup(
) {
for mut camera in cameras.iter_mut() {
if camera.warmup {
info!("camera warmup...");
camera.warmup = false;
}
}
Expand Down
13 changes: 12 additions & 1 deletion src/sort/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -271,6 +271,12 @@ fn auto_insert_sorted_entries(
#[cfg(feature = "buffer_texture")]
mut images: ResMut<Assets<Image>>,
) {
let camera_count = gaussian_cameras.iter().len();

if camera_count == 0 {
return;
}

for (
entity,
gaussian_cloud_handle,
Expand All @@ -292,7 +298,7 @@ fn auto_insert_sorted_entries(
let cloud = cloud.unwrap();

let sorted_entries = sorted_entries_res.add(SortedEntries::new(
gaussian_cameras.iter().len(),
camera_count,
cloud.len_sqrt_ceil().pow(2),
#[cfg(feature = "buffer_texture")]
images,
Expand Down Expand Up @@ -322,6 +328,11 @@ fn update_sorted_entries_sizes(
let camera_count: usize = gaussian_cameras.iter().len();

for handle in sorted_entries.iter() {
if camera_count == 0 {
sorted_entries_res.remove(handle);
continue;
}

let sorted_entries = sorted_entries_res.get(handle).unwrap();
if sorted_entries.camera_count != camera_count {
let new_entry = SortedEntries::new(
Expand Down
Loading