chore(cargo fmt): linting

This commit is contained in:
kaosat.dev 2024-02-29 23:40:46 +01:00
parent 7f824c47fe
commit e68b230fc9
18 changed files with 268 additions and 47 deletions

View File

@ -4,11 +4,9 @@ use bevy_gltf_blueprints::*;
pub struct CorePlugin; pub struct CorePlugin;
impl Plugin for CorePlugin { impl Plugin for CorePlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.add_plugins(( app.add_plugins((BlueprintsPlugin {
BlueprintsPlugin { library_folder: "models/library".into(),
library_folder: "models/library".into(), ..Default::default()
..Default::default() },));
},
));
} }
} }

View File

@ -80,4 +80,4 @@ pub fn spawn_test(
.id(); .id();
commands.entity(world).add_child(new_entity); commands.entity(world).add_child(new_entity);
} }
} }

View File

@ -91,7 +91,6 @@ pub fn teardown_main_menu(bla: Query<Entity, With<InMainMenu>>, mut commands: Co
pub fn main_menu( pub fn main_menu(
keycode: Res<ButtonInput<KeyCode>>, keycode: Res<ButtonInput<KeyCode>>,
mut next_app_state: ResMut<NextState<AppState>>, mut next_app_state: ResMut<NextState<AppState>>,
) { ) {
if keycode.just_pressed(KeyCode::Enter) { if keycode.just_pressed(KeyCode::Enter) {
next_app_state.set(AppState::AppLoading); next_app_state.set(AppState::AppLoading);

View File

@ -10,13 +10,10 @@ use bevy_gltf_worlflow_examples_common::{AppState, GameState};
pub struct GamePlugin; pub struct GamePlugin;
impl Plugin for GamePlugin { impl Plugin for GamePlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.add_systems( app.add_systems(Update, (spawn_test).run_if(in_state(GameState::InGame)))
Update, .add_systems(OnEnter(AppState::MenuRunning), setup_main_menu)
(spawn_test).run_if(in_state(GameState::InGame)), .add_systems(OnExit(AppState::MenuRunning), teardown_main_menu)
) .add_systems(Update, main_menu.run_if(in_state(AppState::MenuRunning)))
.add_systems(OnEnter(AppState::MenuRunning), setup_main_menu) .add_systems(OnEnter(AppState::AppRunning), setup_game);
.add_systems(OnExit(AppState::MenuRunning), teardown_main_menu)
.add_systems(Update, main_menu.run_if(in_state(AppState::MenuRunning)))
.add_systems(OnEnter(AppState::AppRunning), setup_game);
} }
} }

View File

@ -103,9 +103,7 @@ pub fn trigger_level_transition(
pub struct LevelsPlugin; pub struct LevelsPlugin;
impl Plugin for LevelsPlugin { impl Plugin for LevelsPlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app app.register_type::<LevelTransition>().add_systems(
.register_type::<LevelTransition>()
.add_systems(
Update, Update,
(trigger_level_transition,).run_if(in_state(GameState::InGame)), (trigger_level_transition,).run_if(in_state(GameState::InGame)),
); );

View File

@ -14,10 +14,7 @@ pub struct GamePlugin;
impl Plugin for GamePlugin { impl Plugin for GamePlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.add_plugins(LevelsPlugin) app.add_plugins(LevelsPlugin)
.add_systems( .add_systems(Update, (spawn_test).run_if(in_state(GameState::InGame)))
Update,
(spawn_test).run_if(in_state(GameState::InGame)),
)
.add_systems(OnEnter(AppState::MenuRunning), setup_main_menu) .add_systems(OnEnter(AppState::MenuRunning), setup_main_menu)
.add_systems(OnExit(AppState::MenuRunning), teardown_main_menu) .add_systems(OnExit(AppState::MenuRunning), teardown_main_menu)
.add_systems(Update, main_menu.run_if(in_state(AppState::MenuRunning))) .add_systems(Update, main_menu.run_if(in_state(AppState::MenuRunning)))

View File

@ -1,4 +1,4 @@
use bevy::{prelude::*}; use bevy::prelude::*;
use bevy_gltf_worlflow_examples_common::InGameLoading; use bevy_gltf_worlflow_examples_common::InGameLoading;
pub fn setup_loading_screen(mut commands: Commands) { pub fn setup_loading_screen(mut commands: Commands) {

View File

@ -102,5 +102,4 @@ pub fn main_menu(
if keycode.just_pressed(KeyCode::KeyL) { if keycode.just_pressed(KeyCode::KeyL) {
next_app_state.set(AppState::AppLoading); next_app_state.set(AppState::AppLoading);
} }
} }

View File

@ -835,6 +835,44 @@
"type": "object", "type": "object",
"typeInfo": "Enum" "typeInfo": "Enum"
}, },
"bevy_asset::handle::Handle<bevy_pbr::wireframe::WireframeMaterial>": {
"isComponent": true,
"isResource": false,
"oneOf": [
{
"items": false,
"prefixItems": [
{
"type": {
"$ref": "#/$defs/std::sync::Arc<bevy_asset::handle::StrongHandle>"
}
}
],
"short_name": "Strong",
"title": "Strong",
"type": "array",
"typeInfo": "Tuple"
},
{
"items": false,
"prefixItems": [
{
"type": {
"$ref": "#/$defs/bevy_asset::id::AssetId<bevy_pbr::wireframe::WireframeMaterial>"
}
}
],
"short_name": "Weak",
"title": "Weak",
"type": "array",
"typeInfo": "Tuple"
}
],
"short_name": "Handle<WireframeMaterial>",
"title": "bevy_asset::handle::Handle<bevy_pbr::wireframe::WireframeMaterial>",
"type": "object",
"typeInfo": "Enum"
},
"bevy_asset::handle::Handle<bevy_render::mesh::mesh::Mesh>": { "bevy_asset::handle::Handle<bevy_render::mesh::mesh::Mesh>": {
"isComponent": true, "isComponent": true,
"isResource": false, "isResource": false,
@ -1775,6 +1813,52 @@
"type": "object", "type": "object",
"typeInfo": "Enum" "typeInfo": "Enum"
}, },
"bevy_asset::id::AssetId<bevy_pbr::wireframe::WireframeMaterial>": {
"isComponent": false,
"isResource": false,
"oneOf": [
{
"additionalProperties": false,
"properties": {
"index": {
"title": "index",
"type": {
"$ref": "#/$defs/bevy_asset::assets::AssetIndex"
}
}
},
"required": [
"index"
],
"short_name": "Index",
"title": "Index",
"type": "object",
"typeInfo": "Struct"
},
{
"additionalProperties": false,
"properties": {
"uuid": {
"title": "uuid",
"type": {
"$ref": "#/$defs/bevy_utils::Uuid"
}
}
},
"required": [
"uuid"
],
"short_name": "Uuid",
"title": "Uuid",
"type": "object",
"typeInfo": "Struct"
}
],
"short_name": "AssetId<WireframeMaterial>",
"title": "bevy_asset::id::AssetId<bevy_pbr::wireframe::WireframeMaterial>",
"type": "object",
"typeInfo": "Enum"
},
"bevy_asset::id::AssetId<bevy_render::mesh::mesh::Mesh>": { "bevy_asset::id::AssetId<bevy_render::mesh::mesh::Mesh>": {
"isComponent": false, "isComponent": false,
"isResource": false, "isResource": false,
@ -3179,6 +3263,30 @@
"type": "object", "type": "object",
"typeInfo": "Value" "typeInfo": "Value"
}, },
"bevy_egui::EguiSettings": {
"additionalProperties": false,
"isComponent": false,
"isResource": false,
"properties": {
"default_open_url_target": {
"type": {
"$ref": "#/$defs/core::option::Option<alloc::string::String>"
}
},
"scale_factor": {
"type": {
"$ref": "#/$defs/f32"
}
}
},
"required": [
"scale_factor"
],
"short_name": "EguiSettings",
"title": "bevy_egui::EguiSettings",
"type": "object",
"typeInfo": "Struct"
},
"bevy_gizmos::aabb::AabbGizmoConfigGroup": { "bevy_gizmos::aabb::AabbGizmoConfigGroup": {
"additionalProperties": false, "additionalProperties": false,
"isComponent": false, "isComponent": false,
@ -3336,6 +3444,17 @@
"type": "object", "type": "object",
"typeInfo": "Struct" "typeInfo": "Struct"
}, },
"bevy_gltf_components::GltfProcessed": {
"additionalProperties": false,
"isComponent": true,
"isResource": false,
"properties": {},
"required": [],
"short_name": "GltfProcessed",
"title": "bevy_gltf_components::GltfProcessed",
"type": "object",
"typeInfo": "Struct"
},
"bevy_gltf_worlflow_examples_common::core::camera::camera_replace_proxies::SSAOSettings": { "bevy_gltf_worlflow_examples_common::core::camera::camera_replace_proxies::SSAOSettings": {
"additionalProperties": false, "additionalProperties": false,
"isComponent": true, "isComponent": true,
@ -3437,7 +3556,7 @@
"type": "object", "type": "object",
"typeInfo": "Struct" "typeInfo": "Struct"
}, },
"bevy_gltf_worlflow_examples_common::core::physics::physics_replace_proxies::AutoAABBCollider": { "bevy_gltf_worlflow_examples_common::core::physics_rapier::physics_replace_proxies::AutoAABBCollider": {
"isComponent": true, "isComponent": true,
"isResource": false, "isResource": false,
"oneOf": [ "oneOf": [
@ -3446,11 +3565,11 @@
"Capsule" "Capsule"
], ],
"short_name": "AutoAABBCollider", "short_name": "AutoAABBCollider",
"title": "bevy_gltf_worlflow_examples_common::core::physics::physics_replace_proxies::AutoAABBCollider", "title": "bevy_gltf_worlflow_examples_common::core::physics_rapier::physics_replace_proxies::AutoAABBCollider",
"type": "string", "type": "string",
"typeInfo": "Enum" "typeInfo": "Enum"
}, },
"bevy_gltf_worlflow_examples_common::core::physics::physics_replace_proxies::Collider": { "bevy_gltf_worlflow_examples_common::core::physics_rapier::physics_replace_proxies::Collider": {
"isComponent": true, "isComponent": true,
"isResource": false, "isResource": false,
"oneOf": [ "oneOf": [
@ -3511,7 +3630,7 @@
} }
], ],
"short_name": "Collider", "short_name": "Collider",
"title": "bevy_gltf_worlflow_examples_common::core::physics::physics_replace_proxies::Collider", "title": "bevy_gltf_worlflow_examples_common::core::physics_rapier::physics_replace_proxies::Collider",
"type": "object", "type": "object",
"typeInfo": "Enum" "typeInfo": "Enum"
}, },
@ -7054,6 +7173,72 @@
"type": "object", "type": "object",
"typeInfo": "Struct" "typeInfo": "Struct"
}, },
"bevy_pbr::wireframe::NoWireframe": {
"additionalProperties": false,
"isComponent": true,
"isResource": false,
"properties": {},
"required": [],
"short_name": "NoWireframe",
"title": "bevy_pbr::wireframe::NoWireframe",
"type": "object",
"typeInfo": "Struct"
},
"bevy_pbr::wireframe::Wireframe": {
"additionalProperties": false,
"isComponent": true,
"isResource": false,
"properties": {},
"required": [],
"short_name": "Wireframe",
"title": "bevy_pbr::wireframe::Wireframe",
"type": "object",
"typeInfo": "Struct"
},
"bevy_pbr::wireframe::WireframeColor": {
"additionalProperties": false,
"isComponent": true,
"isResource": false,
"properties": {
"color": {
"type": {
"$ref": "#/$defs/bevy_render::color::Color"
}
}
},
"required": [
"color"
],
"short_name": "WireframeColor",
"title": "bevy_pbr::wireframe::WireframeColor",
"type": "object",
"typeInfo": "Struct"
},
"bevy_pbr::wireframe::WireframeConfig": {
"additionalProperties": false,
"isComponent": false,
"isResource": true,
"properties": {
"default_color": {
"type": {
"$ref": "#/$defs/bevy_render::color::Color"
}
},
"global": {
"type": {
"$ref": "#/$defs/bool"
}
}
},
"required": [
"global",
"default_color"
],
"short_name": "WireframeConfig",
"title": "bevy_pbr::wireframe::WireframeConfig",
"type": "object",
"typeInfo": "Struct"
},
"bevy_rapier3d::dynamics::rigid_body::AdditionalMassProperties": { "bevy_rapier3d::dynamics::rigid_body::AdditionalMassProperties": {
"isComponent": true, "isComponent": true,
"isResource": false, "isResource": false,
@ -9338,6 +9523,43 @@
"type": "object", "type": "object",
"typeInfo": "Struct" "typeInfo": "Struct"
}, },
"bevy_time::virt::Virtual": {
"additionalProperties": false,
"isComponent": false,
"isResource": false,
"properties": {
"effective_speed": {
"type": {
"$ref": "#/$defs/f64"
}
},
"max_delta": {
"type": {
"$ref": "#/$defs/bevy_utils::Duration"
}
},
"paused": {
"type": {
"$ref": "#/$defs/bool"
}
},
"relative_speed": {
"type": {
"$ref": "#/$defs/f64"
}
}
},
"required": [
"max_delta",
"paused",
"relative_speed",
"effective_speed"
],
"short_name": "Virtual",
"title": "bevy_time::virt::Virtual",
"type": "object",
"typeInfo": "Struct"
},
"bevy_transform::components::global_transform::GlobalTransform": { "bevy_transform::components::global_transform::GlobalTransform": {
"isComponent": true, "isComponent": true,
"isResource": false, "isResource": false,
@ -11433,6 +11655,14 @@
"type": "object", "type": "object",
"typeInfo": "Value" "typeInfo": "Value"
}, },
"core::ops::Range<f64>": {
"isComponent": false,
"isResource": false,
"short_name": "Range<f64>",
"title": "core::ops::Range<f64>",
"type": "object",
"typeInfo": "Value"
},
"core::option::Option<alloc::string::String>": { "core::option::Option<alloc::string::String>": {
"isComponent": false, "isComponent": false,
"isResource": false, "isResource": false,

View File

@ -7,7 +7,7 @@ impl Plugin for CorePlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.add_plugins(( app.add_plugins((
ExportRegistryPlugin { ExportRegistryPlugin {
save_path: "assets/registry.json".into(), save_path: "registry.json".into(),
..Default::default() ..Default::default()
}, },
BlueprintsPlugin { BlueprintsPlugin {

View File

@ -80,4 +80,4 @@ pub fn spawn_test(
.id(); .id();
commands.entity(world).add_child(new_entity); commands.entity(world).add_child(new_entity);
} }
} }

View File

@ -10,13 +10,10 @@ use bevy_gltf_worlflow_examples_common::{AppState, GameState};
pub struct GamePlugin; pub struct GamePlugin;
impl Plugin for GamePlugin { impl Plugin for GamePlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.add_systems( app.add_systems(Update, (spawn_test).run_if(in_state(GameState::InGame)))
Update, .add_systems(OnEnter(AppState::MenuRunning), setup_main_menu)
(spawn_test).run_if(in_state(GameState::InGame)), .add_systems(OnExit(AppState::MenuRunning), teardown_main_menu)
) .add_systems(Update, main_menu.run_if(in_state(AppState::MenuRunning)))
.add_systems(OnEnter(AppState::MenuRunning), setup_main_menu) .add_systems(OnEnter(AppState::AppRunning), setup_game);
.add_systems(OnExit(AppState::MenuRunning), teardown_main_menu)
.add_systems(Update, main_menu.run_if(in_state(AppState::MenuRunning)))
.add_systems(OnEnter(AppState::AppRunning), setup_game);
} }
} }

View File

@ -20,7 +20,7 @@ impl Plugin for AssetsPlugin {
.with_dynamic_assets_file::<StandardDynamicAssetCollection>( .with_dynamic_assets_file::<StandardDynamicAssetCollection>(
"assets_core.assets.ron", "assets_core.assets.ron",
) )
.load_collection::<CoreAssets>() .load_collection::<CoreAssets>(),
) )
// load game assets // load game assets
.add_loading_state( .add_loading_state(
@ -29,7 +29,7 @@ impl Plugin for AssetsPlugin {
.with_dynamic_assets_file::<StandardDynamicAssetCollection>( .with_dynamic_assets_file::<StandardDynamicAssetCollection>(
"assets_game.assets.ron", "assets_game.assets.ron",
) )
.load_collection::<GameAssets>() .load_collection::<GameAssets>(),
); );
} }
} }

View File

@ -2,8 +2,8 @@ use bevy::core_pipeline::bloom::{BloomCompositeMode, BloomSettings};
use bevy::core_pipeline::experimental::taa::TemporalAntiAliasBundle; use bevy::core_pipeline::experimental::taa::TemporalAntiAliasBundle;
use bevy::core_pipeline::tonemapping::{DebandDither, Tonemapping}; use bevy::core_pipeline::tonemapping::{DebandDither, Tonemapping};
use bevy::pbr::ScreenSpaceAmbientOcclusionBundle; use bevy::pbr::ScreenSpaceAmbientOcclusionBundle;
use bevy::render::camera::Exposure;
use bevy::prelude::*; use bevy::prelude::*;
use bevy::render::camera::Exposure;
use super::CameraTrackingOffset; use super::CameraTrackingOffset;
@ -28,7 +28,8 @@ pub fn camera_replace_proxies(
added_bloom_settings: Query<&BloomSettings, Added<BloomSettings>>, added_bloom_settings: Query<&BloomSettings, Added<BloomSettings>>,
added_ssao_settings: Query<&SSAOSettings, Added<SSAOSettings>>, // Move to camera added_ssao_settings: Query<&SSAOSettings, Added<SSAOSettings>>, // Move to camera
) { ) {
for (entity, mut camera, mut exposure, bloom_settings, ssao_setting) in added_cameras.iter_mut() { for (entity, mut camera, mut exposure, bloom_settings, ssao_setting) in added_cameras.iter_mut()
{
info!("detected added camera, updating proxy"); info!("detected added camera, updating proxy");
camera.hdr = true; camera.hdr = true;
exposure.ev100 *= 1.0; exposure.ev100 *= 1.0;

View File

@ -53,7 +53,7 @@ pub fn lighting_replace_proxies(
println!("AMBIENT {:?} {}", ambient.color, ambient.brightness); println!("AMBIENT {:?} {}", ambient.color, ambient.brightness);
commands.insert_resource(AmbientLight { commands.insert_resource(AmbientLight {
color: ambient.color, color: ambient.color,
brightness: ambient.brightness,// * 4000., brightness: ambient.brightness, // * 4000.,
}); });
// FIXME: does this belong here ? // FIXME: does this belong here ?
commands.insert_resource(ClearColor(ambient.color * ambient.brightness)); commands.insert_resource(ClearColor(ambient.color * ambient.brightness));

View File

@ -17,7 +17,6 @@ pub mod physics_xpbd;
#[cfg(feature = "physics_xpbd")] #[cfg(feature = "physics_xpbd")]
pub use physics_xpbd::*; pub use physics_xpbd::*;
use bevy::prelude::*; use bevy::prelude::*;
pub struct CorePlugin; pub struct CorePlugin;

View File

@ -9,8 +9,8 @@ pub use controls::*;
use bevy::prelude::*; use bevy::prelude::*;
use bevy_xpbd_3d::prelude::*; use bevy_xpbd_3d::prelude::*;
use bevy_gltf_blueprints::GltfBlueprintsSet;
use crate::state::GameState; use crate::state::GameState;
use bevy_gltf_blueprints::GltfBlueprintsSet;
pub struct PhysicsPlugin; pub struct PhysicsPlugin;
impl Plugin for PhysicsPlugin { impl Plugin for PhysicsPlugin {

View File

@ -16,6 +16,12 @@ use bevy_editor_pls::prelude::*;
pub struct CommonPlugin; pub struct CommonPlugin;
impl Plugin for CommonPlugin { impl Plugin for CommonPlugin {
fn build(&self, app: &mut App) { fn build(&self, app: &mut App) {
app.add_plugins((StatePlugin, AssetsPlugin, CorePlugin, GamePlugin, EditorPlugin::default())); app.add_plugins((
StatePlugin,
AssetsPlugin,
CorePlugin,
GamePlugin,
EditorPlugin::default(),
));
} }
} }