mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-28 08:58:07 +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 wgpu::Extent3d;
|
||||||
|
|
||||||
use crate::{
|
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)]
|
#[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) => {
|
HeadlessMode::Scene(scene, skybox) => {
|
||||||
app.add_systems(
|
app.add_systems(
|
||||||
@@ -84,7 +91,10 @@ pub fn start_headless(
|
|||||||
commands.insert_resource(SkyboxId(skybox.clone()));
|
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();
|
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 clap::{Args, Parser, Subcommand};
|
||||||
use studio::headless::{start_headless, HeadlessMode};
|
use studio::headless::{start_headless, HeadlessMode};
|
||||||
|
|
||||||
@@ -20,7 +23,7 @@ enum Subcommands {
|
|||||||
Scene {
|
Scene {
|
||||||
scene_dir: String,
|
scene_dir: String,
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
orbit : bool,
|
orbit: bool,
|
||||||
#[arg(long, short)]
|
#[arg(long, short)]
|
||||||
output_dir: Option<String>,
|
output_dir: Option<String>,
|
||||||
#[arg(long)]
|
#[arg(long)]
|
||||||
@@ -92,15 +95,12 @@ fn main() {
|
|||||||
frames,
|
frames,
|
||||||
output_res,
|
output_res,
|
||||||
);
|
);
|
||||||
|
|
||||||
if orbit {
|
if orbit {
|
||||||
app.insert_resource(OrbitSettings {
|
app.insert_resource(OrbitSettings { radius: 10.0 })
|
||||||
radius: 10.0,
|
.add_systems(Update, orbit_scene);
|
||||||
})
|
|
||||||
.add_systems(Update, orbit_scene)
|
|
||||||
;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
app
|
app
|
||||||
}
|
}
|
||||||
Subcommands::Bvh {
|
Subcommands::Bvh {
|
||||||
@@ -163,14 +163,20 @@ struct OrbitSettings {
|
|||||||
radius: f32,
|
radius: f32,
|
||||||
}
|
}
|
||||||
|
|
||||||
fn orbit_scene (
|
fn orbit_scene(
|
||||||
mut camera : Query<&mut Transform, With<PrimaryWindow>>,
|
mut camera: Query<&mut Transform, With<PrimaryWindow>>,
|
||||||
orbit_settings : Res<OrbitSettings>,
|
orbit_settings: Res<OrbitSettings>,
|
||||||
time : Res<Time>
|
time: Res<Time>,
|
||||||
) {
|
) {
|
||||||
let Ok(mut main_cam_transform) = camera.get_single_mut() else { return };
|
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.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);
|
main_cam_transform.look_at(Vec3::ZERO, Vec3::Y);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+2
-1
@@ -326,7 +326,8 @@ fn initialiaze_headless(
|
|||||||
..default()
|
..default()
|
||||||
},
|
},
|
||||||
CameraControllerBundle::new(focus, camera_xform.translation),
|
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::{
|
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_graph::{RenderGraphApp, ViewNode, ViewNodeRunner},
|
||||||
render_resource::{
|
render_resource::{
|
||||||
Buffer, BufferDescriptor, BufferUsages, ImageCopyBuffer, ImageDataLayout, MapMode,
|
Buffer, BufferDescriptor, BufferUsages, ImageCopyBuffer, ImageDataLayout, MapMode,
|
||||||
@@ -7,7 +10,7 @@ use bevy::{
|
|||||||
renderer::RenderDevice,
|
renderer::RenderDevice,
|
||||||
view::ViewTarget,
|
view::ViewTarget,
|
||||||
Extract, Render, RenderSet,
|
Extract, Render, RenderSet,
|
||||||
}
|
},
|
||||||
};
|
};
|
||||||
use bytemuck::AnyBitPattern;
|
use bytemuck::AnyBitPattern;
|
||||||
use image::{
|
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() {
|
for mut screen_capture in screen_captures.iter_mut() {
|
||||||
screen_capture.frames += 1;
|
screen_capture.frames += 1;
|
||||||
|
|
||||||
if !screen_capture.should_capture() {
|
if !screen_capture.should_capture() {
|
||||||
exit_event.send(AppExit);
|
exit_event.send(AppExit);
|
||||||
}
|
}
|
||||||
@@ -141,7 +147,10 @@ fn extract_screen_capture_components(
|
|||||||
) {
|
) {
|
||||||
for (entity, screen_capture) in screen_capure_comps.iter() {
|
for (entity, screen_capture) in screen_capure_comps.iter() {
|
||||||
if screen_capture.should_capture() {
|
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());
|
commands.get_or_spawn(entity).insert(screen_capture.clone());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user