mirror of
https://github.com/storytold/storyteller-bevy.git
synced 2026-10-18 07:35:19 +00:00
fmt
This commit is contained in:
@@ -1,5 +1,8 @@
|
||||
use bevy::{
|
||||
ecs::entity::{EntityHashMap, EntityHashSet}, math::Affine3A, prelude::*, render::{mesh::skinning::SkinnedMesh, view::NoFrustumCulling}
|
||||
ecs::entity::{EntityHashMap, EntityHashSet},
|
||||
math::Affine3A,
|
||||
prelude::*,
|
||||
render::{mesh::skinning::SkinnedMesh, view::NoFrustumCulling},
|
||||
};
|
||||
use space_editor::space_prefab::editor_registry::EditorRegistryExt;
|
||||
|
||||
|
||||
+2
-1
@@ -4,7 +4,8 @@ use bevy::{prelude::*, window::PrimaryWindow};
|
||||
use bevy_inspector_egui::{bevy_egui::EguiPlugin, DefaultInspectorConfigPlugin};
|
||||
use bevy_mod_picking::debug::DebugPickingMode;
|
||||
use space_editor::{
|
||||
prelude::*, space_editor_ui::{tools::gizmo::GizmoToolPlugin, EditorGizmoConfigPlugin, EditorPluginGroup}
|
||||
prelude::*,
|
||||
space_editor_ui::{tools::gizmo::GizmoToolPlugin, EditorGizmoConfigPlugin, EditorPluginGroup},
|
||||
};
|
||||
|
||||
use crate::{
|
||||
|
||||
+10
-4
@@ -1,7 +1,9 @@
|
||||
use std::time::Duration;
|
||||
|
||||
use bevy::{
|
||||
app::{AppExit, ScheduleRunnerPlugin}, core_pipeline::Skybox, prelude::*
|
||||
app::{AppExit, ScheduleRunnerPlugin},
|
||||
core_pipeline::Skybox,
|
||||
prelude::*,
|
||||
};
|
||||
use space_editor::prelude::{EditorEvent, EditorPrefabPath};
|
||||
use wgpu::Extent3d;
|
||||
@@ -72,9 +74,13 @@ pub fn start_headless(
|
||||
HeadlessMode::Scene(scene, skybox) => {
|
||||
app.add_systems(
|
||||
Startup,
|
||||
move |mut cmd: Commands, mut ew: EventWriter<EditorEvent>, mut asset_server: Res<AssetServer>| {
|
||||
|
||||
cmd.insert_resource(SkyboxHolder(Some(Skybox { image: asset_server.load(skybox.clone()), brightness: 1.0 })));
|
||||
move |mut cmd: Commands,
|
||||
mut ew: EventWriter<EditorEvent>,
|
||||
mut asset_server: Res<AssetServer>| {
|
||||
cmd.insert_resource(SkyboxHolder(Some(Skybox {
|
||||
image: asset_server.load(skybox.clone()),
|
||||
brightness: 1.0,
|
||||
})));
|
||||
|
||||
ew.send(EditorEvent::Load(EditorPrefabPath::File(scene.clone())));
|
||||
},
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
use bevy::{
|
||||
ecs::entity::{EntityHashMap, EntityHashSet}, prelude::*
|
||||
ecs::entity::{EntityHashMap, EntityHashSet},
|
||||
prelude::*,
|
||||
};
|
||||
|
||||
/// Find the parent entity of `target`. Returns `None` if `target` has no
|
||||
|
||||
+16
-3
@@ -90,7 +90,10 @@ impl From<Selection> for Action {
|
||||
|
||||
// TODO: Make the bindings of raw device inputs to InputActions configurable
|
||||
|
||||
fn translate_selection_events(keyboard: Res<ButtonInput<KeyCode>>, mut input: EventWriter<InputAction>) {
|
||||
fn translate_selection_events(
|
||||
keyboard: Res<ButtonInput<KeyCode>>,
|
||||
mut input: EventWriter<InputAction>,
|
||||
) {
|
||||
if keyboard.just_pressed(KeyCode::Escape) {
|
||||
input.send(InputAction(Lifecycle::Start, Selection::Clear.into()));
|
||||
} else if keyboard.just_released(KeyCode::Escape) {
|
||||
@@ -110,7 +113,10 @@ fn translate_selection_events(keyboard: Res<ButtonInput<KeyCode>>, mut input: Ev
|
||||
}
|
||||
}
|
||||
|
||||
fn translate_debug_toggle(keyboard: Res<ButtonInput<KeyCode>>, mut input: EventWriter<InputAction>) {
|
||||
fn translate_debug_toggle(
|
||||
keyboard: Res<ButtonInput<KeyCode>>,
|
||||
mut input: EventWriter<InputAction>,
|
||||
) {
|
||||
if keyboard.pressed(KeyCode::ControlLeft) || keyboard.pressed(KeyCode::ControlRight) {
|
||||
if keyboard.just_pressed(KeyCode::Backquote) {
|
||||
input.send(InputAction(Lifecycle::Start, Action::ToggleDebug));
|
||||
@@ -232,7 +238,14 @@ fn translate_fps_camera_events(
|
||||
) {
|
||||
// Camera Translation (FPS-like)
|
||||
use KeyCode::*;
|
||||
let wasd_keys = [KeyCode::KeyW, KeyCode::KeyA, KeyCode::KeyS, KeyCode::KeyD, KeyCode::KeyE, KeyCode::KeyQ];
|
||||
let wasd_keys = [
|
||||
KeyCode::KeyW,
|
||||
KeyCode::KeyA,
|
||||
KeyCode::KeyS,
|
||||
KeyCode::KeyD,
|
||||
KeyCode::KeyE,
|
||||
KeyCode::KeyQ,
|
||||
];
|
||||
let wasd_keys_set = wasd_keys.into_iter().collect::<HashSet<_>>();
|
||||
|
||||
// A little unfortunate that `get_pressed()` doesn't just return a reference
|
||||
|
||||
@@ -1,8 +1,4 @@
|
||||
use bevy::{
|
||||
core_pipeline::fxaa::Fxaa,
|
||||
prelude::*,
|
||||
render::view::RenderLayers,
|
||||
};
|
||||
use bevy::{core_pipeline::fxaa::Fxaa, prelude::*, render::view::RenderLayers};
|
||||
use space_editor::space_editor_ui::camera_plugin::NotShowCamera;
|
||||
|
||||
use crate::MainCamera;
|
||||
@@ -23,9 +19,7 @@ pub(super) fn spawn_gizmo_camera(
|
||||
Name::new("Gizmo Camera"),
|
||||
GizmoCamera,
|
||||
Camera3dBundle {
|
||||
camera_3d: Camera3d {
|
||||
..default()
|
||||
},
|
||||
camera_3d: Camera3d { ..default() },
|
||||
camera: Camera {
|
||||
hdr: true,
|
||||
order: 1,
|
||||
|
||||
@@ -46,8 +46,7 @@ impl Plugin for GizmoPlugin {
|
||||
app.add_systems(
|
||||
PreUpdate,
|
||||
spawn_gizmo_camera.run_if(
|
||||
any_with_component::<MainCamera>
|
||||
.and_then(not(any_with_component::<GizmoCamera>)),
|
||||
any_with_component::<MainCamera>.and_then(not(any_with_component::<GizmoCamera>)),
|
||||
),
|
||||
);
|
||||
app.add_systems(
|
||||
|
||||
@@ -302,7 +302,9 @@ pub(super) fn on_rotate(
|
||||
}
|
||||
|
||||
let view_plane_normal = (cam_xform.translation() - p1).normalize();
|
||||
let hit_dist = ray.intersect_plane(p1, Plane3d::new(view_plane_normal)).unwrap();
|
||||
let hit_dist = ray
|
||||
.intersect_plane(p1, Plane3d::new(view_plane_normal))
|
||||
.unwrap();
|
||||
let p2 = ray.origin + ray.direction * hit_dist;
|
||||
let drag_dist = (p2 - p1).length();
|
||||
// TODO: Sensitivity could use some tuning
|
||||
|
||||
@@ -1,7 +1,10 @@
|
||||
use bevy::{
|
||||
math::vec3,
|
||||
prelude::*,
|
||||
render::{mesh::Indices, primitives::Aabb, render_asset::RenderAssetUsages, render_resource::PrimitiveTopology},
|
||||
render::{
|
||||
mesh::Indices, primitives::Aabb, render_asset::RenderAssetUsages,
|
||||
render_resource::PrimitiveTopology,
|
||||
},
|
||||
};
|
||||
|
||||
pub struct Cone {
|
||||
|
||||
@@ -113,6 +113,9 @@ trait IntoError<Output> {
|
||||
|
||||
impl IntoError<AssetReaderError> for reqwest::Error {
|
||||
fn into(self) -> AssetReaderError {
|
||||
AssetReaderError::Io(Arc::new(std::io::Error::new(ErrorKind::Other, format!("{self}"))))
|
||||
AssetReaderError::Io(Arc::new(std::io::Error::new(
|
||||
ErrorKind::Other,
|
||||
format!("{self}"),
|
||||
)))
|
||||
}
|
||||
}
|
||||
|
||||
+3
-2
@@ -3,7 +3,8 @@ use bevy::{
|
||||
core_pipeline::{
|
||||
bloom::{BloomCompositeMode, BloomPrefilterSettings, BloomSettings},
|
||||
fxaa::Fxaa,
|
||||
tonemapping::Tonemapping, Skybox,
|
||||
tonemapping::Tonemapping,
|
||||
Skybox,
|
||||
},
|
||||
gltf::Gltf,
|
||||
math::vec2,
|
||||
@@ -111,7 +112,7 @@ pub struct SkyboxHolder(pub Option<Skybox>);
|
||||
fn attach_skybox(
|
||||
mut cmd: Commands,
|
||||
mut skybox_holder: ResMut<SkyboxHolder>,
|
||||
mut q_camera: Query<Entity, (With<Camera3d>, Without<Skybox>)>
|
||||
mut q_camera: Query<Entity, (With<Camera3d>, Without<Skybox>)>,
|
||||
) {
|
||||
let Some(skybox) = skybox_holder.0.as_ref() else {
|
||||
return;
|
||||
|
||||
@@ -1,9 +1,10 @@
|
||||
use bevy::render::render_graph::RenderSubGraph;
|
||||
use bevy::{
|
||||
app::AppExit,
|
||||
core_pipeline::{core_3d, prepass::ViewPrepassTextures},
|
||||
prelude::*,
|
||||
render::{
|
||||
render_graph::{RenderGraphApp, ViewNode, ViewNodeRunner},
|
||||
render_graph::{RenderGraphApp, RenderLabel, ViewNode, ViewNodeRunner},
|
||||
render_resource::{
|
||||
Buffer, BufferDescriptor, BufferUsages, ImageCopyBuffer, ImageDataLayout, MapMode,
|
||||
},
|
||||
@@ -52,13 +53,13 @@ impl Plugin for ScreenShotPlugin {
|
||||
//Render Graph Additions
|
||||
.add_render_graph_node::<ViewNodeRunner<ScreenCaptureNode>>(
|
||||
core_3d::graph::Core3d,
|
||||
ScreenCaptureNode::NAME,
|
||||
ScreenCaptureNode,
|
||||
)
|
||||
.add_render_graph_edges(
|
||||
core_3d::graph::Core3d,
|
||||
&[
|
||||
core_3d::graph::Node3d::Tonemapping,
|
||||
ScreenCaptureNode::NAME,
|
||||
ScreenCaptureNode,
|
||||
core_3d::graph::Node3d::EndMainPassPostProcessing,
|
||||
],
|
||||
);
|
||||
@@ -206,13 +207,9 @@ fn prepare_screen_capture_buffers(
|
||||
// Screen Shot View Node
|
||||
//==============================================================================
|
||||
|
||||
#[derive(Default)]
|
||||
#[derive(Debug, Hash, PartialEq, Eq, Clone, RenderLabel, Default)]
|
||||
struct ScreenCaptureNode;
|
||||
|
||||
impl ScreenCaptureNode {
|
||||
pub const NAME: &'static str = "ScreenCaptureNode";
|
||||
}
|
||||
|
||||
impl ViewNode for ScreenCaptureNode {
|
||||
type ViewQuery = (
|
||||
Entity,
|
||||
|
||||
@@ -99,8 +99,8 @@ fn spawn_skybox(
|
||||
// Add components to the scene camera
|
||||
cmd.entity(q_camera.single()).insert((
|
||||
Skybox {
|
||||
image : skybox_assets.cubemap.clone(),
|
||||
brightness: 1.0
|
||||
image: skybox_assets.cubemap.clone(),
|
||||
brightness: 1.0,
|
||||
},
|
||||
EnvironmentMapLight {
|
||||
diffuse_map: skybox_assets.env_diffuse.clone(),
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
use bevy::{
|
||||
a11y::accesskit::TextAlign, diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin}, prelude::*
|
||||
a11y::accesskit::TextAlign,
|
||||
diagnostic::{DiagnosticsStore, FrameTimeDiagnosticsPlugin},
|
||||
prelude::*,
|
||||
};
|
||||
|
||||
use crate::debug::DebugMode;
|
||||
@@ -35,7 +37,7 @@ fn layout(mut cmd: Commands) {
|
||||
position_type: PositionType::Absolute,
|
||||
right: Val::Px(16.),
|
||||
bottom: Val::Px(16.),
|
||||
|
||||
|
||||
..default()
|
||||
});
|
||||
|
||||
|
||||
@@ -10,7 +10,11 @@ use bevy::{
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::*;
|
||||
use space_editor::{
|
||||
space_editor_ui::{editor_tab::{EditorTab, EditorTabName}, ui_plugin::EditorUiAppExt}, space_prefab::component::MeshPrimitive3dPrefab,
|
||||
space_editor_ui::{
|
||||
editor_tab::{EditorTab, EditorTabName},
|
||||
ui_plugin::EditorUiAppExt,
|
||||
},
|
||||
space_prefab::component::MeshPrimitive3dPrefab,
|
||||
};
|
||||
use wasm_bindgen::prelude::*;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user