Skip to content

Commit

Permalink
refactor: remove movement on startup (#11)
Browse files Browse the repository at this point in the history
* refactor: remove movement on startup

* chore: clippy
  • Loading branch information
cs50victor authored Jan 27, 2024
1 parent e318510 commit 45875ec
Show file tree
Hide file tree
Showing 5 changed files with 112 additions and 2,700 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_headless/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ mod plugin;
mod utils;

pub use plugin::{
CurrImageContainer, GpuImageExportSource, ImageExportBundle, ImageExportPlugin,
CurrImageContainer, GpuImageExportSource, HeadlessPlugin, ImageExportBundle,
ImageExportSettings, ImageExportSource, ImageExportSystems,
};

Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_headless/src/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,15 +253,15 @@ fn capture_img_bytes<P: Pixel + PixelWithColorType>(

/// Plugin enabling the generation of image sequences.
#[derive(Default)]
pub struct ImageExportPlugin;
pub struct HeadlessPlugin;

#[derive(Debug, Hash, PartialEq, Eq, Clone, SystemSet)]
pub enum ImageExportSystems {
SetupImageExport,
SetupImageExportFlush,
}

impl Plugin for ImageExportPlugin {
impl Plugin for HeadlessPlugin {
fn build(&self, app: &mut App) {
app.add_plugins(
DefaultPlugins
Expand Down
5 changes: 2 additions & 3 deletions examples/minimal/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ use bevy::{
transform::components::Transform,
utils::default,
};
use bevy_headless::{CurrImageContainer, ImageExportPlugin, ImageExportSource};
use bevy_headless::{CurrImageContainer, HeadlessPlugin, ImageExportSource};

fn setup(
mut commands: Commands,
Expand Down Expand Up @@ -55,11 +55,10 @@ pub fn main() {
let (w, h) = (1920, 1080);

Engine::new()
// .insert_resource(CurrImage::default())
.insert_resource(bevy_headless::SceneInfo::new(w, h))
.insert_resource(ClearColor(Color::rgb_u8(0, 0, 0)))
.add_plugins((
ImageExportPlugin,
HeadlessPlugin,
ScheduleRunnerPlugin::run_loop(std::time::Duration::from_secs_f64(1.0 / 60.0)),
))
.add_systems(Startup, setup)
Expand Down
20 changes: 4 additions & 16 deletions examples/new_media/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,16 +6,13 @@ use bevy::{
asset::{AssetServer, Assets},
core::Name,
core_pipeline::{clear_color::ClearColor, core_3d::Camera3dBundle, tonemapping::Tonemapping},
ecs::{
query::With,
system::{Commands, Query, Res, ResMut},
},
ecs::system::{Commands, Res, ResMut},
math::Vec3,
render::{camera::Camera, color::Color, texture::Image},
transform::components::Transform,
utils::default,
};
use bevy_headless::{ImageExportPlugin, ImageExportSource};
use bevy_headless::{HeadlessPlugin, ImageExportSource};
use bevy_panorbit_camera::{PanOrbitCamera, PanOrbitCameraPlugin};

use bevy_gaussian_splatting::{GaussianCloud, GaussianSplattingBundle, GaussianSplattingPlugin};
Expand Down Expand Up @@ -88,22 +85,13 @@ fn main() {
.insert_resource(bevy_headless::SceneInfo::new(config.width, config.height))
.insert_resource(ClearColor(Color::rgb_u8(255, 255, 255)))
.add_plugins((
ImageExportPlugin,
HeadlessPlugin,
WsPlugin,
ScheduleRunnerPlugin::run_loop(std::time::Duration::from_secs_f64(1.0 / 60.0)),
PanOrbitCameraPlugin,
GaussianSplattingPlugin,
))
.add_systems(Startup, (start_ws, setup_gaussian_cloud))
.add_systems(Update, (move_camera, receive_message))
.add_systems(Update, receive_message)
.run();
}

fn move_camera(mut camera: Query<&mut Transform, With<Camera>>) {
let speed = 0.0005;
for mut transform in camera.iter_mut() {
transform.translation.x += speed;
transform.translation.y += speed;
transform.translation.z += speed;
}
}
Loading

0 comments on commit 45875ec

Please sign in to comment.