From b4d10dac3e7a9fd41d26230bd7bc04363c27b48a Mon Sep 17 00:00:00 2001 From: Mitchell Mosure Date: Fri, 26 Jan 2024 16:22:53 -0800 Subject: [PATCH] fix: headless renderer doesn't support bevy/multi-threaded (#81) --- .gitignore | 3 ++- Cargo.toml | 10 ++++++++++ examples/headless.rs | 18 ++++-------------- 3 files changed, 16 insertions(+), 15 deletions(-) diff --git a/.gitignore b/.gitignore index 2e088a92..5c8ba9d1 100644 --- a/.gitignore +++ b/.gitignore @@ -13,5 +13,6 @@ Cargo.lock .DS_Store -www/assets/ screenshots/ +headless_output/ +www/assets/ diff --git a/Cargo.toml b/Cargo.toml index 8108ce84..7c6c54ea 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -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", diff --git a/examples/headless.rs b/examples/headless.rs index 20c7de9f..941e368b 100644 --- a/examples/headless.rs +++ b/examples/headless.rs @@ -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, @@ -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(); @@ -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() - }, )); } @@ -445,7 +437,7 @@ fn headless_app() { ); app.add_plugins(frame_capture::image_copy::ImageCopyPlugin); - + // headless frame capture app.add_plugins(frame_capture::scene::CaptureFramePlugin); @@ -453,8 +445,6 @@ fn headless_app() { std::time::Duration::from_secs_f64(1.0 / 60.0), )); - app.add_plugins(PanOrbitCameraPlugin); - // setup for gaussian splatting app.add_plugins(GaussianSplattingPlugin);