diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/Cargo.toml b/examples/bevy_gltf_blueprints/basic_xpbd_physics/Cargo.toml index c6547b0..f1280c6 100644 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/Cargo.toml +++ b/examples/bevy_gltf_blueprints/basic_xpbd_physics/Cargo.toml @@ -7,6 +7,6 @@ license = "MIT OR Apache-2.0" [dependencies] bevy="0.13" bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" } -bevy_gltf_worlflow_examples_common = { path = "../../common" } +bevy_gltf_worlflow_examples_common = { path = "../../common" , default-features = false, features = ["blueprints", "physics_xpbd"]} bevy_xpbd_3d = "0.4" rand = "0.8.5" \ No newline at end of file diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/mod.rs b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/mod.rs index 7087b26..bfc256d 100644 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/mod.rs +++ b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/mod.rs @@ -1,17 +1,10 @@ -pub mod physics; -pub use physics::*; - use bevy::prelude::*; use bevy_gltf_blueprints::*; -use bevy_xpbd_3d::plugins::PhysicsDebugPlugin; - pub struct CorePlugin; impl Plugin for CorePlugin { fn build(&self, app: &mut App) { app.add_plugins(( - PhysicsPlugin, - //PhysicsDebugPlugin::default(), BlueprintsPlugin { library_folder: "models/library".into(), ..Default::default() diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/game/in_game.rs b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/game/in_game.rs index e093b2d..081f688 100644 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/game/in_game.rs +++ b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/game/in_game.rs @@ -1,10 +1,7 @@ use bevy::prelude::*; use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag}; - use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning}; -// use bevy_rapier3d::prelude::Velocity; use bevy_xpbd_3d::prelude::*; - use rand::Rng; pub fn setup_game( @@ -13,7 +10,6 @@ pub fn setup_game( models: Res>, mut next_game_state: ResMut>, ) { - println!("setting up all stuff"); commands.insert_resource(AmbientLight { color: Color::WHITE, brightness: 0.2, diff --git a/examples/bevy_gltf_blueprints/materials/src/game/in_game.rs b/examples/bevy_gltf_blueprints/materials/src/game/in_game.rs index 3ed4c63..9a986fd 100644 --- a/examples/bevy_gltf_blueprints/materials/src/game/in_game.rs +++ b/examples/bevy_gltf_blueprints/materials/src/game/in_game.rs @@ -11,7 +11,6 @@ pub fn setup_game( models: Res>, mut next_game_state: ResMut>, ) { - println!("setting up all stuff"); commands.insert_resource(AmbientLight { color: Color::WHITE, brightness: 0.2, diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/game/in_game.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/game/in_game.rs index 9e84877..f090a8e 100644 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/game/in_game.rs +++ b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/game/in_game.rs @@ -11,7 +11,6 @@ pub fn setup_game( models: Res>, mut next_game_state: ResMut>, ) { - println!("setting up all stuff"); commands.insert_resource(AmbientLight { color: Color::WHITE, brightness: 0.2, diff --git a/examples/bevy_registry_export/basic/src/game/in_game.rs b/examples/bevy_registry_export/basic/src/game/in_game.rs index 4c8f479..b88eaa1 100644 --- a/examples/bevy_registry_export/basic/src/game/in_game.rs +++ b/examples/bevy_registry_export/basic/src/game/in_game.rs @@ -11,7 +11,6 @@ pub fn setup_game( models: Res>, mut next_game_state: ResMut>, ) { - println!("setting up all stuff"); commands.insert_resource(AmbientLight { color: Color::WHITE, brightness: 0.2, diff --git a/examples/common/Cargo.toml b/examples/common/Cargo.toml index 58bdd88..2db2a13 100644 --- a/examples/common/Cargo.toml +++ b/examples/common/Cargo.toml @@ -4,10 +4,18 @@ version = "0.1.0" edition = "2021" license = "MIT OR Apache-2.0" +[features] +blueprints=["dep:bevy_gltf_blueprints"] +physics_rapier = ["dep:bevy_rapier3d"] +physics_xpbd = ["dep:bevy_xpbd_3d"] +default = ["blueprints", "physics_rapier"] + + [dependencies] bevy="0.13" -bevy_gltf_blueprints = { path = "../../crates/bevy_gltf_blueprints" } -bevy_rapier3d = { version = "0.25.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] } +bevy_gltf_blueprints = { path = "../../crates/bevy_gltf_blueprints", optional = true } +bevy_rapier3d = { version = "0.25", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] , optional = true } +bevy_xpbd_3d = { version = "0.4", optional = true } bevy_asset_loader = { version = "0.20", features = ["standard_dynamic_assets" ]} #bevy_editor_pls = { version = "0.6" } rand = "0.8.5" diff --git a/examples/common/src/assets/mod.rs b/examples/common/src/assets/mod.rs index a2c8b22..b3bf595 100644 --- a/examples/common/src/assets/mod.rs +++ b/examples/common/src/assets/mod.rs @@ -15,21 +15,21 @@ impl Plugin for AssetsPlugin { app // load core assets (ie assets needed in the main menu, and everywhere else before loading more assets in game) .add_loading_state( - LoadingState::new(AppState::CoreLoading).continue_to_state(AppState::MenuRunning), + LoadingState::new(AppState::CoreLoading) + .continue_to_state(AppState::MenuRunning) + .with_dynamic_assets_file::( + "assets_core.assets.ron", + ) + .load_collection::() ) - .add_dynamic_collection_to_loading_state::<_, StandardDynamicAssetCollection>( - AppState::CoreLoading, - "assets_core.assets.ron", - ) - .add_collection_to_loading_state::<_, CoreAssets>(AppState::CoreLoading) // load game assets .add_loading_state( - LoadingState::new(AppState::AppLoading).continue_to_state(AppState::AppRunning), - ) - .add_dynamic_collection_to_loading_state::<_, StandardDynamicAssetCollection>( - AppState::AppLoading, - "assets_game.assets.ron", - ) - .add_collection_to_loading_state::<_, GameAssets>(AppState::AppLoading); + LoadingState::new(AppState::AppLoading) + .continue_to_state(AppState::AppRunning) + .with_dynamic_assets_file::( + "assets_game.assets.ron", + ) + .load_collection::() + ); } } diff --git a/examples/common/src/core/camera/camera_replace_proxies.rs b/examples/common/src/core/camera/camera_replace_proxies.rs index 2f8e044..7e8547d 100644 --- a/examples/common/src/core/camera/camera_replace_proxies.rs +++ b/examples/common/src/core/camera/camera_replace_proxies.rs @@ -31,7 +31,7 @@ pub fn camera_replace_proxies( for (entity, mut camera, mut exposure, bloom_settings, ssao_setting) in added_cameras.iter_mut() { info!("detected added camera, updating proxy"); camera.hdr = true; - // exposure.ev100 *= 0.8; + exposure.ev100 *= 1.0; commands .entity(entity) .insert(DebandDither::Enabled) diff --git a/examples/common/src/core/mod.rs b/examples/common/src/core/mod.rs index 8c75182..20ce511 100644 --- a/examples/common/src/core/mod.rs +++ b/examples/common/src/core/mod.rs @@ -7,8 +7,16 @@ pub use lighting::*; //pub mod relationships; //pub use relationships::*; -pub mod physics; -pub use physics::*; +#[cfg(feature = "physics_rapier")] +pub mod physics_rapier; +#[cfg(feature = "physics_rapier")] +pub use physics_rapier::*; + +#[cfg(feature = "physics_xpbd")] +pub mod physics_xpbd; +#[cfg(feature = "physics_xpbd")] +pub use physics_xpbd::*; + use bevy::prelude::*; diff --git a/examples/common/src/core/physics/controls.rs b/examples/common/src/core/physics_rapier/controls.rs similarity index 100% rename from examples/common/src/core/physics/controls.rs rename to examples/common/src/core/physics_rapier/controls.rs diff --git a/examples/common/src/core/physics/mod.rs b/examples/common/src/core/physics_rapier/mod.rs similarity index 100% rename from examples/common/src/core/physics/mod.rs rename to examples/common/src/core/physics_rapier/mod.rs diff --git a/examples/common/src/core/physics/physics_replace_proxies.rs b/examples/common/src/core/physics_rapier/physics_replace_proxies.rs similarity index 100% rename from examples/common/src/core/physics/physics_replace_proxies.rs rename to examples/common/src/core/physics_rapier/physics_replace_proxies.rs diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/utils.rs b/examples/common/src/core/physics_rapier/utils.rs similarity index 100% rename from examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/utils.rs rename to examples/common/src/core/physics_rapier/utils.rs diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/controls.rs b/examples/common/src/core/physics_xpbd/controls.rs similarity index 71% rename from examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/controls.rs rename to examples/common/src/core/physics_xpbd/controls.rs index 6ff265d..2846560 100644 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/controls.rs +++ b/examples/common/src/core/physics_xpbd/controls.rs @@ -1,5 +1,5 @@ use bevy::ecs::system::Res; -use bevy::gizmos::config::{GizmoConfig, GizmoConfigStore}; +use bevy::gizmos::config::GizmoConfigStore; use bevy::input::keyboard::KeyCode; use bevy::input::ButtonInput; use bevy::log::info; @@ -25,14 +25,6 @@ pub fn toggle_physics_debug( if keycode.just_pressed(KeyCode::KeyD) { let config = config_store.config_mut::().0; config.enabled = !config.enabled; - println!("BLAAA"); - /* - .insert_gizmo_group( - PhysicsGizmos { - aabb_color: Some(Color::WHITE), - ..default() - }, - GizmoConfig::default(), - )*/ + // config.aabb_color = Some(Color::WHITE); } } diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/mod.rs b/examples/common/src/core/physics_xpbd/mod.rs similarity index 94% rename from examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/mod.rs rename to examples/common/src/core/physics_xpbd/mod.rs index 7ba0beb..99d2428 100644 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/mod.rs +++ b/examples/common/src/core/physics_xpbd/mod.rs @@ -10,7 +10,7 @@ use bevy::prelude::*; use bevy_xpbd_3d::prelude::*; use bevy_gltf_blueprints::GltfBlueprintsSet; -use bevy_gltf_worlflow_examples_common::GameState; +use crate::state::GameState; pub struct PhysicsPlugin; impl Plugin for PhysicsPlugin { diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/physics_replace_proxies.rs b/examples/common/src/core/physics_xpbd/physics_replace_proxies.rs similarity index 100% rename from examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/physics_replace_proxies.rs rename to examples/common/src/core/physics_xpbd/physics_replace_proxies.rs diff --git a/examples/common/src/core/physics/utils.rs b/examples/common/src/core/physics_xpbd/utils.rs similarity index 100% rename from examples/common/src/core/physics/utils.rs rename to examples/common/src/core/physics_xpbd/utils.rs diff --git a/testing/bevy_registry_export/basic/src/game/in_game.rs b/testing/bevy_registry_export/basic/src/game/in_game.rs index 2338956..f090a8e 100644 --- a/testing/bevy_registry_export/basic/src/game/in_game.rs +++ b/testing/bevy_registry_export/basic/src/game/in_game.rs @@ -11,7 +11,6 @@ pub fn setup_game( models: Res>, mut next_game_state: ResMut>, ) { - println!("setting up all stuff"); commands.insert_resource(AmbientLight { color: Color::WHITE, brightness: 0.2, @@ -41,12 +40,12 @@ pub fn setup_game( struct UnregisteredComponent; pub fn spawn_test( - keycode: Res>, + keycode: Res>, mut commands: Commands, mut game_world: Query<(Entity, &Children), With>, ) { - if keycode.just_pressed(KeyCode::T) { + if keycode.just_pressed(KeyCode::KeyT) { let world = game_world.single_mut(); let world = world.1[0]; @@ -82,47 +81,3 @@ pub fn spawn_test( commands.entity(world).add_child(new_entity); } } - -pub fn spawn_test_unregisted_components( - keycode: Res>, - mut commands: Commands, - - mut game_world: Query<(Entity, &Children), With>, -) { - if keycode.just_pressed(KeyCode::U) { - let world = game_world.single_mut(); - let world = world.1[0]; - - let mut rng = rand::thread_rng(); - let range = 5.5; - let x: f32 = rng.gen_range(-range..range); - let y: f32 = rng.gen_range(-range..range); - - let mut rng = rand::thread_rng(); - let range = 0.8; - let vel_x: f32 = rng.gen_range(-range..range); - let vel_y: f32 = rng.gen_range(2.0..2.5); - let vel_z: f32 = rng.gen_range(-range..range); - - let name_index: u64 = rng.gen(); - - let new_entity = commands - .spawn(( - BluePrintBundle { - blueprint: BlueprintName("Health_Pickup".to_string()), - ..Default::default() - }, - bevy::prelude::Name::from(format!("test{}", name_index)), - // BlueprintName("Health_Pickup".to_string()), - // SpawnHere, - TransformBundle::from_transform(Transform::from_xyz(x, 2.0, y)), - Velocity { - linvel: Vec3::new(vel_x, vel_y, vel_z), - angvel: Vec3::new(0.0, 0.0, 0.0), - }, - UnregisteredComponent, - )) - .id(); - commands.entity(world).add_child(new_entity); - } -} diff --git a/testing/bevy_registry_export/basic/src/game/in_main_menu.rs b/testing/bevy_registry_export/basic/src/game/in_main_menu.rs index c1a4b8b..32142cd 100644 --- a/testing/bevy_registry_export/basic/src/game/in_main_menu.rs +++ b/testing/bevy_registry_export/basic/src/game/in_main_menu.rs @@ -89,24 +89,10 @@ pub fn teardown_main_menu(bla: Query>, mut commands: Co } pub fn main_menu( - keycode: Res>, - + keycode: Res>, mut next_app_state: ResMut>, - // mut next_game_state: ResMut>, - // mut save_requested_events: EventWriter, - // mut load_requested_events: EventWriter, ) { - if keycode.just_pressed(KeyCode::Return) { + if keycode.just_pressed(KeyCode::Enter) { next_app_state.set(AppState::AppLoading); - // next_game_state.set(GameState::None); - } - - if keycode.just_pressed(KeyCode::L) { - next_app_state.set(AppState::AppLoading); - // load_requested_events.send(LoadRequest { path: "toto".into() }) - } - - if keycode.just_pressed(KeyCode::S) { - // save_requested_events.send(SaveRequest { path: "toto".into() }) } }