Skip to content

Commit

Permalink
fix: support gaussian clouds with no gaussian cameras (#126)
Browse files Browse the repository at this point in the history
* fix: support gaussian clouds with no gaussian cameras

* chore: bump version 2.7.5
  • Loading branch information
mosure authored Nov 7, 2024
1 parent 968e648 commit b8d7ed1
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 3 deletions.
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

0 comments on commit b8d7ed1

Please sign in to comment.