mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-17 00:13:17 +00:00
ran cargo fmt
This commit is contained in:
+13
-3
@@ -8,7 +8,11 @@ use space_editor::prelude::{EditorEvent, EditorPrefabPath};
|
||||
use wgpu::Extent3d;
|
||||
|
||||
use crate::{
|
||||
bvh::{BvhAnimCompleteEvent, TestBvh}, scene::SceneState, screenshot::{ScreenCapture, ScreenShotPlugin}, BvhPlugin, CommonPlugins, LoadLibraryObjectEvent, LoadSceneEvent, MainCamera, MixamoImportEvent, MixamoPlugin, SkyboxId, StudioMode, WorldGridPlugin
|
||||
bvh::{BvhAnimCompleteEvent, TestBvh},
|
||||
scene::SceneState,
|
||||
screenshot::{ScreenCapture, ScreenShotPlugin},
|
||||
BvhPlugin, CommonPlugins, LoadLibraryObjectEvent, LoadSceneEvent, MainCamera,
|
||||
MixamoImportEvent, MixamoPlugin, SkyboxId, StudioMode, WorldGridPlugin,
|
||||
};
|
||||
|
||||
#[derive(Debug, Resource, Clone)]
|
||||
@@ -61,7 +65,10 @@ pub fn start_headless(
|
||||
},
|
||||
);
|
||||
|
||||
app.add_systems(PostUpdate, check_for_bvh_capture_complete.run_if(in_state(SceneState::Active)));
|
||||
app.add_systems(
|
||||
PostUpdate,
|
||||
check_for_bvh_capture_complete.run_if(in_state(SceneState::Active)),
|
||||
);
|
||||
}
|
||||
HeadlessMode::Scene(scene, skybox) => {
|
||||
app.add_systems(
|
||||
@@ -84,7 +91,10 @@ pub fn start_headless(
|
||||
commands.insert_resource(SkyboxId(skybox.clone()));
|
||||
},
|
||||
);
|
||||
app.add_systems(PostUpdate, check_for_mixamo_capture_complete.run_if(in_state(SceneState::Active)));
|
||||
app.add_systems(
|
||||
PostUpdate,
|
||||
check_for_mixamo_capture_complete.run_if(in_state(SceneState::Active)),
|
||||
);
|
||||
|
||||
app.run();
|
||||
}
|
||||
|
||||
+22
-16
@@ -1,4 +1,7 @@
|
||||
use bevy::{prelude::*, render::render_resource::Extent3d, transform::components::Transform, window::PrimaryWindow};
|
||||
use bevy::{
|
||||
prelude::*, render::render_resource::Extent3d, transform::components::Transform,
|
||||
window::PrimaryWindow,
|
||||
};
|
||||
use clap::{Args, Parser, Subcommand};
|
||||
use studio::headless::{start_headless, HeadlessMode};
|
||||
|
||||
@@ -20,7 +23,7 @@ enum Subcommands {
|
||||
Scene {
|
||||
scene_dir: String,
|
||||
#[arg(long)]
|
||||
orbit : bool,
|
||||
orbit: bool,
|
||||
#[arg(long, short)]
|
||||
output_dir: Option<String>,
|
||||
#[arg(long)]
|
||||
@@ -92,15 +95,12 @@ fn main() {
|
||||
frames,
|
||||
output_res,
|
||||
);
|
||||
|
||||
|
||||
if orbit {
|
||||
app.insert_resource(OrbitSettings {
|
||||
radius: 10.0,
|
||||
})
|
||||
.add_systems(Update, orbit_scene)
|
||||
;
|
||||
app.insert_resource(OrbitSettings { radius: 10.0 })
|
||||
.add_systems(Update, orbit_scene);
|
||||
}
|
||||
|
||||
|
||||
app
|
||||
}
|
||||
Subcommands::Bvh {
|
||||
@@ -163,14 +163,20 @@ struct OrbitSettings {
|
||||
radius: f32,
|
||||
}
|
||||
|
||||
fn orbit_scene (
|
||||
mut camera : Query<&mut Transform, With<PrimaryWindow>>,
|
||||
orbit_settings : Res<OrbitSettings>,
|
||||
time : Res<Time>
|
||||
fn orbit_scene(
|
||||
mut camera: Query<&mut Transform, With<PrimaryWindow>>,
|
||||
orbit_settings: Res<OrbitSettings>,
|
||||
time: Res<Time>,
|
||||
) {
|
||||
let Ok(mut main_cam_transform) = camera.get_single_mut() else { return };
|
||||
|
||||
main_cam_transform.translation = Vec3::new(orbit_settings.radius * time.elapsed_seconds().cos() * 10.0, orbit_settings.radius * time.elapsed_seconds().sin(), 6.0);
|
||||
let Ok(mut main_cam_transform) = camera.get_single_mut() else {
|
||||
return;
|
||||
};
|
||||
|
||||
main_cam_transform.translation = Vec3::new(
|
||||
orbit_settings.radius * time.elapsed_seconds().cos() * 10.0,
|
||||
orbit_settings.radius * time.elapsed_seconds().sin(),
|
||||
6.0,
|
||||
);
|
||||
main_cam_transform.look_at(Vec3::ZERO, Vec3::Y);
|
||||
}
|
||||
|
||||
|
||||
+2
-1
@@ -326,7 +326,8 @@ fn initialiaze_headless(
|
||||
..default()
|
||||
},
|
||||
CameraControllerBundle::new(focus, camera_xform.translation),
|
||||
ScreenCapture::from_out(&headless_settings.output_dir).with_max_frames(headless_settings.max_frames),
|
||||
ScreenCapture::from_out(&headless_settings.output_dir)
|
||||
.with_max_frames(headless_settings.max_frames),
|
||||
));
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
use bevy::{
|
||||
app::AppExit, core_pipeline::{core_3d, prepass::ViewPrepassTextures}, prelude::*, render::{
|
||||
app::AppExit,
|
||||
core_pipeline::{core_3d, prepass::ViewPrepassTextures},
|
||||
prelude::*,
|
||||
render::{
|
||||
render_graph::{RenderGraphApp, ViewNode, ViewNodeRunner},
|
||||
render_resource::{
|
||||
Buffer, BufferDescriptor, BufferUsages, ImageCopyBuffer, ImageDataLayout, MapMode,
|
||||
@@ -7,7 +10,7 @@ use bevy::{
|
||||
renderer::RenderDevice,
|
||||
view::ViewTarget,
|
||||
Extract, Render, RenderSet,
|
||||
}
|
||||
},
|
||||
};
|
||||
use bytemuck::AnyBitPattern;
|
||||
use image::{
|
||||
@@ -121,10 +124,13 @@ impl ScreenCapture {
|
||||
}
|
||||
}
|
||||
|
||||
fn update_screen_capture_on_extract_step(mut screen_captures: Query<&mut ScreenCapture>, mut exit_event : EventWriter<AppExit>) {
|
||||
fn update_screen_capture_on_extract_step(
|
||||
mut screen_captures: Query<&mut ScreenCapture>,
|
||||
mut exit_event: EventWriter<AppExit>,
|
||||
) {
|
||||
for mut screen_capture in screen_captures.iter_mut() {
|
||||
screen_capture.frames += 1;
|
||||
|
||||
|
||||
if !screen_capture.should_capture() {
|
||||
exit_event.send(AppExit);
|
||||
}
|
||||
@@ -141,7 +147,10 @@ fn extract_screen_capture_components(
|
||||
) {
|
||||
for (entity, screen_capture) in screen_capure_comps.iter() {
|
||||
if screen_capture.should_capture() {
|
||||
println!("Capturing Frame: {} / {}", screen_capture.frames, screen_capture.max_frames);
|
||||
println!(
|
||||
"Capturing Frame: {} / {}",
|
||||
screen_capture.frames, screen_capture.max_frames
|
||||
);
|
||||
commands.get_or_spawn(entity).insert(screen_capture.clone());
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user