Skip to content

Commit

Permalink
fix: headless renderer doesn't support bevy/multi-threaded (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
mosure authored Jan 27, 2024
1 parent 10533d9 commit b4d10da
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 15 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,6 @@ Cargo.lock

.DS_Store

www/assets/
screenshots/
headless_output/
www/assets/
10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,16 @@ tooling = ["byte-unit"]

perftest = []

headless = [
"io_flexbuffers",
"io_ply",
"planar",
"buffer_storage",
"f16",
"sort_rayon",
"sort_std",
]

viewer = [
"bevy-inspector-egui",
"bevy_panorbit_camera",
Expand Down
18 changes: 4 additions & 14 deletions examples/headless.rs
Original file line number Diff line number Diff line change
@@ -1,11 +1,10 @@
// for running the gaussian splatting viewer without a window ( i.e on a server )
//! ensure the "test_images" directory exists in the root of the project
// c_rr --example headless -- [filename]
//! ensure the "headless_output" directory exists in the root of the project
// c_rr --example headless --no-default-features --features "headless" -- [filename]

use bevy::{
app::ScheduleRunnerPlugin, core::Name, core_pipeline::tonemapping::Tonemapping, prelude::*, render::renderer::RenderDevice,
};
use bevy_panorbit_camera::{PanOrbitCamera, PanOrbitCameraPlugin};

use bevy_gaussian_splatting::{
random_gaussians, utils::get_arg, GaussianCloud, GaussianSplattingBundle,
Expand Down Expand Up @@ -333,7 +332,7 @@ mod frame_capture {
};

let images_dir =
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("test_images");
PathBuf::from(env!("CARGO_MANIFEST_DIR")).join("headless_output");
std::fs::create_dir_all(&images_dir).unwrap();

let uuid = bevy::utils::Uuid::new_v4();
Expand Down Expand Up @@ -405,13 +404,6 @@ fn setup_gaussian_cloud(
},
..default()
},
PanOrbitCamera {
allow_upside_down: true,
orbit_smoothness: 0.0,
pan_smoothness: 0.0,
zoom_smoothness: 0.0,
..default()
},
));
}

Expand Down Expand Up @@ -445,16 +437,14 @@ fn headless_app() {
);

app.add_plugins(frame_capture::image_copy::ImageCopyPlugin);

// headless frame capture
app.add_plugins(frame_capture::scene::CaptureFramePlugin);

app.add_plugins(ScheduleRunnerPlugin::run_loop(
std::time::Duration::from_secs_f64(1.0 / 60.0),
));

app.add_plugins(PanOrbitCameraPlugin);

// setup for gaussian splatting
app.add_plugins(GaussianSplattingPlugin);

Expand Down

0 comments on commit b4d10da

Please sign in to comment.