diff --git a/Cargo.toml b/Cargo.toml index c2a2ef9..e7397fd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,20 +4,20 @@ members = [ "crates/bevy_gltf_blueprints", "crates/bevy_gltf_save_load", "crates/bevy_registry_export", + + "examples/common/", + "examples/bevy_gltf_components/basic/", - "examples/bevy_gltf_components/basic_wasm/", + "examples/bevy_gltf_blueprints/basic/", - "examples/bevy_gltf_blueprints/basic_wasm/", - "examples/bevy_gltf_blueprints/basic_scene_components/", "examples/bevy_gltf_blueprints/basic_xpbd_physics/", - "examples/bevy_gltf_blueprints/nested_blueprints/", "examples/bevy_gltf_blueprints/animation/", - "examples/bevy_gltf_blueprints/multiple_levels/", "examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles", "examples/bevy_gltf_blueprints/materials/", - "examples/bevy_gltf_save_load/basic/", - "examples/bevy_registry_export/basic" + "examples/bevy_gltf_save_load/basic/", + + "examples/bevy_registry_export/basic" ] resolver = "2" diff --git a/crates/bevy_gltf_blueprints/Cargo.toml b/crates/bevy_gltf_blueprints/Cargo.toml index bee65b1..40d60c9 100644 --- a/crates/bevy_gltf_blueprints/Cargo.toml +++ b/crates/bevy_gltf_blueprints/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_gltf_blueprints" -version = "0.7.0" +version = "0.7.1" authors = ["Mark 'kaosat-dev' Moissette"] description = "Adds the ability to define Blueprints/Prefabs for [Bevy](https://bevyengine.org/) inside gltf files and spawn them in Bevy." homepage = "https://github.com/kaosat-dev/Blender_bevy_components_workflow" diff --git a/crates/bevy_gltf_blueprints/README.md b/crates/bevy_gltf_blueprints/README.md index 59c57c7..a4914ab 100644 --- a/crates/bevy_gltf_blueprints/README.md +++ b/crates/bevy_gltf_blueprints/README.md @@ -332,16 +332,10 @@ https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/example https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_gltf_blueprints/basic_xpbd_physics -https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_gltf_blueprints/basic_scene_components - https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_gltf_blueprints/animation -https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_gltf_blueprints/multiple_levels - https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_gltf_blueprints/materials -https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_gltf_blueprints/nested_blueprints - https://github.com/kaosat-dev/Blender_bevy_components_workflow/tree/main/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles diff --git a/crates/bevy_gltf_blueprints/src/aabb.rs b/crates/bevy_gltf_blueprints/src/aabb.rs index ab3a21f..7c1c218 100644 --- a/crates/bevy_gltf_blueprints/src/aabb.rs +++ b/crates/bevy_gltf_blueprints/src/aabb.rs @@ -41,7 +41,7 @@ pub fn compute_descendant_aabb( if let Ok(aabb) = existing_aabbs.get(*child) { chilren_aabbs.push(*aabb); } else { - let aabb = compute_descendant_aabb(*child, children, &existing_aabbs); + let aabb = compute_descendant_aabb(*child, children, existing_aabbs); chilren_aabbs.push(aabb); } } @@ -57,5 +57,5 @@ pub fn compute_descendant_aabb( return aabb; } - return Aabb::default(); + Aabb::default() } diff --git a/crates/bevy_gltf_blueprints/src/animation.rs b/crates/bevy_gltf_blueprints/src/animation.rs index d3d8c6c..4a18ec4 100644 --- a/crates/bevy_gltf_blueprints/src/animation.rs +++ b/crates/bevy_gltf_blueprints/src/animation.rs @@ -3,14 +3,14 @@ use bevy::utils::HashMap; #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -/// storage for animations for a given entity (hierarchy), essentially a clone of gltf's named_animations +/// storage for animations for a given entity (hierarchy), essentially a clone of gltf's `named_animations` pub struct Animations { pub named_animations: HashMap>, } #[derive(Component, Debug)] /// Stop gap helper component : this is inserted into a "root" entity (an entity representing a whole gltf file) -/// so that the root entity knows which of its children contains an actualy AnimationPlayer component -/// this is for convenience, because currently , Bevy's gltf parsing inserts AnimationPlayers "one level down" +/// so that the root entity knows which of its children contains an actualy `AnimationPlayer` component +/// this is for convenience, because currently , Bevy's gltf parsing inserts `AnimationPlayers` "one level down" /// ie armature/root for animated models, which means more complex queries to trigger animations that we want to avoid pub struct AnimationPlayerLink(pub Entity); diff --git a/crates/bevy_gltf_blueprints/src/copy_components.rs b/crates/bevy_gltf_blueprints/src/copy_components.rs index bb24170..93feba9 100644 --- a/crates/bevy_gltf_blueprints/src/copy_components.rs +++ b/crates/bevy_gltf_blueprints/src/copy_components.rs @@ -42,7 +42,7 @@ impl CopyComponents { let type_id = component_info.type_id().unwrap(); if self.exclude.contains(&type_id) { debug!("excluding component: {:?}", component_info.name()); - return None; + None } else { debug!( "cloning: component: {:?} {:?}", @@ -51,32 +51,27 @@ impl CopyComponents { ); if let Some(type_registration) = registry.get(type_id) { - return Some(type_registration); - } else { - if self.stringent { - return Some( - registry.get(type_id).expect( - format!( - "cannot clone entity: component: {:?} is not registered", - component_info.name() - ) - .as_str(), - ), - ); - } else { - warn!( - "cannot clone component: component: {:?} is not registered", + Some(type_registration) + } else if self.stringent { + return Some(registry.get(type_id).unwrap_or_else(|| { + panic!( + "cannot clone entity: component: {:?} is not registered", component_info.name() - ); - return None; - } + ) + })); + } else { + warn!( + "cannot clone component: component: {:?} is not registered", + component_info.name() + ); + None } } }) .map(|type_id| { return ( type_id.data::().unwrap().clone(), - type_id.type_info().type_id().clone(), // we need the original type_id down the line + type_id.type_info().type_id(), // we need the original type_id down the line ); }) .collect::>() @@ -104,6 +99,6 @@ impl CopyComponents { // This allows the command to be used in systems impl Command for CopyComponents { fn apply(self, world: &mut World) { - self.transfer_components(world) + self.transfer_components(world); } } diff --git a/crates/bevy_gltf_blueprints/src/lib.rs b/crates/bevy_gltf_blueprints/src/lib.rs index f6bd24b..366f05f 100644 --- a/crates/bevy_gltf_blueprints/src/lib.rs +++ b/crates/bevy_gltf_blueprints/src/lib.rs @@ -113,47 +113,47 @@ fn materials_library_enabled(blueprints_config: Res) -> bool { impl Plugin for BlueprintsPlugin { fn build(&self, app: &mut App) { - app.add_plugins(ComponentsFromGltfPlugin{ - legacy_mode: self.legacy_mode + app.add_plugins(ComponentsFromGltfPlugin { + legacy_mode: self.legacy_mode, }) - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .insert_resource(BluePrintsConfig { - format: self.format.clone(), - library_folder: self.library_folder.clone(), + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .insert_resource(BluePrintsConfig { + format: self.format, + library_folder: self.library_folder.clone(), - aabbs: self.aabbs, - aabb_cache: HashMap::new(), + aabbs: self.aabbs, + aabb_cache: HashMap::new(), - material_library: self.material_library, - material_library_folder: self.material_library_folder.clone(), - material_library_cache: HashMap::new(), - }) - .configure_sets( - Update, - (GltfBlueprintsSet::Spawn, GltfBlueprintsSet::AfterSpawn) - .chain() - .after(GltfComponentsSet::Injection), + material_library: self.material_library, + material_library_folder: self.material_library_folder.clone(), + material_library_cache: HashMap::new(), + }) + .configure_sets( + Update, + (GltfBlueprintsSet::Spawn, GltfBlueprintsSet::AfterSpawn) + .chain() + .after(GltfComponentsSet::Injection), + ) + .add_systems( + Update, + ( + spawn_from_blueprints, + compute_scene_aabbs.run_if(aabbs_enabled), + apply_deferred.run_if(aabbs_enabled), + apply_deferred, + materials_inject.run_if(materials_library_enabled), ) - .add_systems( - Update, - ( - spawn_from_blueprints, - compute_scene_aabbs.run_if(aabbs_enabled), - apply_deferred.run_if(aabbs_enabled), - apply_deferred, - materials_inject.run_if(materials_library_enabled), - ) - .chain() - .in_set(GltfBlueprintsSet::Spawn), - ) - .add_systems( - Update, - (spawned_blueprint_post_process, apply_deferred) - .chain() - .in_set(GltfBlueprintsSet::AfterSpawn), - ); + .chain() + .in_set(GltfBlueprintsSet::Spawn), + ) + .add_systems( + Update, + (spawned_blueprint_post_process, apply_deferred) + .chain() + .in_set(GltfBlueprintsSet::AfterSpawn), + ); } } diff --git a/crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs b/crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs index 57ca64b..3701fa5 100644 --- a/crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs +++ b/crates/bevy_gltf_blueprints/src/spawn_from_blueprints.rs @@ -19,17 +19,17 @@ pub struct BlueprintName(pub String); pub struct SpawnHere; #[derive(Component)] -/// FlagComponent for dynamically spawned scenes +/// flag component for dynamically spawned scenes pub struct Spawned; #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -/// flag component marking any spwaned child of blueprints ..unless the original entity was marked with the 'NoInBlueprint' marker component +/// flag component marking any spwaned child of blueprints ..unless the original entity was marked with the `NoInBlueprint` marker component pub struct InBlueprint; #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -/// flag component preventing any spwaned child of blueprints to be marked with the InBlueprint component +/// flag component preventing any spawned child of blueprints to be marked with the `InBlueprint` component pub struct NoInBlueprint; #[derive(Component, Reflect, Default, Debug)] @@ -112,14 +112,15 @@ pub(crate) fn spawn_from_blueprints( let main_scene_name = gltf .named_scenes .keys() - .nth(0) + .next() .expect("there should be at least one named scene in the gltf file to spawn"); + let scene = &gltf.named_scenes[main_scene_name]; // transforms are optional, but still deal with them correctly let mut transforms: Transform = Transform::default(); if transform.is_some() { - transforms = transform.unwrap().clone(); + transforms = *transform.unwrap(); } commands.entity(entity).insert(( diff --git a/crates/bevy_gltf_blueprints/src/spawn_post_process.rs b/crates/bevy_gltf_blueprints/src/spawn_post_process.rs index 2c3f3fc..2caa625 100644 --- a/crates/bevy_gltf_blueprints/src/spawn_post_process.rs +++ b/crates/bevy_gltf_blueprints/src/spawn_post_process.rs @@ -12,7 +12,7 @@ use crate::{CopyComponents, InBlueprint, NoInBlueprint, OriginalChildren}; /// - it removes one level of useless nesting /// - it copies the blueprint's root components to the entity it was spawned on (original entity) /// - it copies the children of the blueprint scene into the original entity -/// - it add AnimationLink components so that animations can be controlled from the original entity +/// - it add `AnimationLink` components so that animations can be controlled from the original entity /// - it cleans up/ removes a few , by then uneeded components pub(crate) fn spawned_blueprint_post_process( unprocessed_entities: Query< diff --git a/crates/bevy_gltf_components/Cargo.toml b/crates/bevy_gltf_components/Cargo.toml index 0d6c56b..d2f3fad 100644 --- a/crates/bevy_gltf_components/Cargo.toml +++ b/crates/bevy_gltf_components/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_gltf_components" -version = "0.3.0" +version = "0.3.1" authors = ["Mark 'kaosat-dev' Moissette"] description = "Allows you to define [Bevy](https://bevyengine.org/) components direclty inside gltf files and instanciate the components on the Bevy side." homepage = "https://github.com/kaosat-dev/Blender_bevy_components_workflow" diff --git a/crates/bevy_gltf_components/src/gltf_to_components.rs b/crates/bevy_gltf_components/src/gltf_to_components.rs index 8a051f0..11d1826 100644 --- a/crates/bevy_gltf_components/src/gltf_to_components.rs +++ b/crates/bevy_gltf_components/src/gltf_to_components.rs @@ -26,11 +26,11 @@ struct TuppleTestColor(Color); pub struct VecOfColors(Vec); pub fn ronstring_to_reflect_component( - ron_string: &String, + ron_string: &str, type_registry: &TypeRegistry, simplified_types: bool, ) -> Vec> { - let lookup: HashMap = ron::from_str(ron_string.as_str()).unwrap(); + let lookup: HashMap = ron::from_str(ron_string).unwrap(); let mut components: Vec> = Vec::new(); for (key, value) in lookup.into_iter() { let type_string = key.replace("component: ", "").trim().to_string(); @@ -49,70 +49,65 @@ pub fn ronstring_to_reflect_component( { debug!("TYPE INFO {:?}", type_registration.type_info()); if simplified_types { - match type_registration.type_info() { - TypeInfo::TupleStruct(info) => { - // we handle tupple strucs with only one field differently, as Blender's custom properties with custom ui (float, int, bool, etc) always give us a tupple struct - if info.field_len() == 1 { - let field = info - .field_at(0) - .expect("we should always have at least one field here"); - let field_name = field.type_path(); - let mut formated = parsed_value.clone(); - match field_name { - "f32" => { - formated = parsed_value.parse::().unwrap().to_string(); - } - "f64" => { - formated = parsed_value.parse::().unwrap().to_string(); - } - "u8" => { - formated = parsed_value.parse::().unwrap().to_string(); - } - "u16" => { - formated = parsed_value.parse::().unwrap().to_string(); - } - "u32" => { - formated = parsed_value.parse::().unwrap().to_string(); - } - "u64" => { - formated = parsed_value.parse::().unwrap().to_string(); - } - "u128" => { - formated = parsed_value.parse::().unwrap().to_string(); - } - "glam::Vec2" => { - let parsed: Vec = ron::from_str(&parsed_value).unwrap(); - formated = format!("(x:{},y:{})", parsed[0], parsed[1]); - } - "glam::Vec3" => { - let parsed: Vec = ron::from_str(&parsed_value).unwrap(); + if let TypeInfo::TupleStruct(info) = type_registration.type_info() { + // we handle tupple strucs with only one field differently, as Blender's custom properties with custom ui (float, int, bool, etc) always give us a tupple struct + if info.field_len() == 1 { + let field = info + .field_at(0) + .expect("we should always have at least one field here"); + let field_name = field.type_path(); + let mut formated = parsed_value.clone(); + match field_name { + "f32" => { + formated = parsed_value.parse::().unwrap().to_string(); + } + "f64" => { + formated = parsed_value.parse::().unwrap().to_string(); + } + "u8" => { + formated = parsed_value.parse::().unwrap().to_string(); + } + "u16" => { + formated = parsed_value.parse::().unwrap().to_string(); + } + "u32" => { + formated = parsed_value.parse::().unwrap().to_string(); + } + "u64" => { + formated = parsed_value.parse::().unwrap().to_string(); + } + "u128" => { + formated = parsed_value.parse::().unwrap().to_string(); + } + "glam::Vec2" => { + let parsed: Vec = ron::from_str(&parsed_value).unwrap(); + formated = format!("(x:{},y:{})", parsed[0], parsed[1]); + } + "glam::Vec3" => { + let parsed: Vec = ron::from_str(&parsed_value).unwrap(); + formated = + format!("(x:{},y:{},z:{})", parsed[0], parsed[1], parsed[2]); + } + "bevy_render::color::Color" => { + let parsed: Vec = ron::from_str(&parsed_value).unwrap(); + if parsed.len() == 3 { formated = format!( - "(x:{},y:{},z:{})", + "Rgba(red:{},green:{},blue:{}, alpha: 1.0)", parsed[0], parsed[1], parsed[2] ); } - "bevy_render::color::Color" => { - let parsed: Vec = ron::from_str(&parsed_value).unwrap(); - if parsed.len() == 3 { - formated = format!( - "Rgba(red:{},green:{},blue:{}, alpha: 1.0)", - parsed[0], parsed[1], parsed[2] - ); - } - if parsed.len() == 4 { - formated = format!( - "Rgba(red:{},green:{},blue:{}, alpha:{})", - parsed[0], parsed[1], parsed[2], parsed[3] - ); - } + if parsed.len() == 4 { + formated = format!( + "Rgba(red:{},green:{},blue:{}, alpha:{})", + parsed[0], parsed[1], parsed[2], parsed[3] + ); } - _ => {} } - - parsed_value = format!("({formated})"); + _ => {} } + + parsed_value = format!("({formated})"); } - _ => {} } } @@ -137,13 +132,14 @@ pub fn ronstring_to_reflect_component( debug!("component data ron string {}", ron_string); let mut deserializer = ron::Deserializer::from_str(ron_string.as_str()).unwrap(); let reflect_deserializer = UntypedReflectDeserializer::new(type_registry); - let component = reflect_deserializer.deserialize(&mut deserializer).expect( - format!( - "failed to deserialize component {} with value: {:?}", - key, value - ) - .as_str(), - ); + let component = reflect_deserializer + .deserialize(&mut deserializer) + .unwrap_or_else(|_| { + panic!( + "failed to deserialize component {} with value: {:?}", + key, value + ) + }); debug!("component {:?}", component); debug!("real type {:?}", component.get_represented_type_info()); @@ -157,12 +153,12 @@ pub fn ronstring_to_reflect_component( components } -/// main function: injects components into each entity in gltf files that have gltf_extras, using reflection +/// main function: injects components into each entity in gltf files that have `gltf_extras`, using reflection pub fn gltf_extras_to_components( gltf: &mut Gltf, scenes: &mut ResMut>, type_registry: impl Deref, - legacy_mode: bool + legacy_mode: bool, ) { let mut added_components = 0; let simplified_types = legacy_mode; diff --git a/crates/bevy_gltf_components/src/lib.rs b/crates/bevy_gltf_components/src/lib.rs index aaa312f..3c20a5a 100644 --- a/crates/bevy_gltf_components/src/lib.rs +++ b/crates/bevy_gltf_components/src/lib.rs @@ -7,7 +7,10 @@ pub use gltf_to_components::*; pub mod process_gltfs; pub use process_gltfs::*; -use bevy::{ecs::system::Resource, prelude::{App, IntoSystemConfigs, Plugin, SystemSet, Update}}; +use bevy::{ + ecs::system::Resource, + prelude::{App, IntoSystemConfigs, Plugin, SystemSet, Update}, +}; /// A Bevy plugin for extracting components from gltf files and automatically adding them to the relevant entities /// It will automatically run every time you load a gltf file @@ -54,14 +57,12 @@ pub struct GltfComponentsConfig { } pub struct ComponentsFromGltfPlugin { - pub legacy_mode: bool + pub legacy_mode: bool, } impl Default for ComponentsFromGltfPlugin { fn default() -> Self { - Self { - legacy_mode: true - } + Self { legacy_mode: true } } } @@ -69,7 +70,7 @@ impl Plugin for ComponentsFromGltfPlugin { fn build(&self, app: &mut App) { app.insert_resource(GltfLoadingTracker::new()) .insert_resource(GltfComponentsConfig { - legacy_mode: self.legacy_mode + legacy_mode: self.legacy_mode, }) .add_systems(Update, (track_new_gltf, process_loaded_scenes)) .add_systems( diff --git a/crates/bevy_gltf_components/src/process_gltfs.rs b/crates/bevy_gltf_components/src/process_gltfs.rs index 18e26af..d04bd97 100644 --- a/crates/bevy_gltf_components/src/process_gltfs.rs +++ b/crates/bevy_gltf_components/src/process_gltfs.rs @@ -1,8 +1,8 @@ -use std::path::Path; use bevy::asset::AssetPath; use bevy::gltf::Gltf; use bevy::utils::HashSet; use bevy::{asset::LoadState, prelude::*}; +use std::path::Path; use crate::{gltf_extras_to_components, GltfComponentsConfig}; @@ -12,6 +12,11 @@ pub struct GltfLoadingTracker { pub loading_gltfs: HashSet>, pub processed_gltfs: HashSet, } +impl Default for GltfLoadingTracker { + fn default() -> Self { + Self::new() + } +} impl GltfLoadingTracker { pub fn new() -> GltfLoadingTracker { @@ -32,17 +37,18 @@ pub fn track_new_gltf( ) { for event in events.read() { if let AssetEvent::Added { id } = event { - let handle = asset_server.get_id_handle(*id); if let Some(handle) = handle { tracker.add_gltf(handle.clone()); debug!("gltf created {:?}", handle); } else { - let asset_path = asset_server.get_path(*id).unwrap_or(AssetPath::from_path(Path::new("n/a".into()))); // will unfortunatly not work, will do a PR/ discussion at the Bevy level, leaving for reference, would be very practical + let asset_path = asset_server + .get_path(*id) + .unwrap_or(AssetPath::from_path(Path::new("n/a"))); // will unfortunatly not work, will do a PR/ discussion at the Bevy level, leaving for reference, would be very practical warn!( "a gltf file ({:?}) has no handle available, cannot inject components", asset_path - ) + ); } } } @@ -76,7 +82,12 @@ pub fn process_loaded_scenes( for gltf_handle in &loaded_gltfs { if let Some(gltf) = gltfs.get_mut(gltf_handle) { - gltf_extras_to_components(gltf, &mut scenes, &*type_registry, gltf_components_config.legacy_mode); + gltf_extras_to_components( + gltf, + &mut scenes, + &*type_registry, + gltf_components_config.legacy_mode, + ); if let Some(path) = gltf_handle.path() { tracker.processed_gltfs.insert(path.to_string()); diff --git a/crates/bevy_gltf_save_load/Cargo.toml b/crates/bevy_gltf_save_load/Cargo.toml index 659726e..23800fb 100644 --- a/crates/bevy_gltf_save_load/Cargo.toml +++ b/crates/bevy_gltf_save_load/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "bevy_gltf_save_load" -version = "0.2.0" +version = "0.2.1" authors = ["Mark 'kaosat-dev' Moissette"] description = "Save & load your bevy games" homepage = "https://github.com/kaosat-dev/Blender_bevy_components_workflow" diff --git a/crates/bevy_gltf_save_load/src/loading.rs b/crates/bevy_gltf_save_load/src/loading.rs index 9342ecf..7410eca 100644 --- a/crates/bevy_gltf_save_load/src/loading.rs +++ b/crates/bevy_gltf_save_load/src/loading.rs @@ -24,18 +24,18 @@ pub(crate) struct LoadFirstStageDone; #[reflect(Component)] pub(crate) struct CleanupScene; -/// helper system that "converts" loadRequest events to LoadRequested resources +/// helper system that "converts" loadRequest events to `LoadRequested` resources pub(crate) fn mark_load_requested( mut load_requests: EventReader, mut commands: Commands, ) { let mut save_path: String = "".into(); for load_request in load_requests.read() { - if load_request.path != "" { + if !load_request.path.is_empty() { save_path = load_request.path.clone(); } } - if save_path != "" { + if !save_path.is_empty() { commands.insert_resource(LoadRequested { path: save_path }); } } @@ -111,7 +111,7 @@ pub(crate) fn load_static( )) .id(); - if info.library_path != "" { + if !info.library_path.is_empty() { commands .entity(static_data) .insert(Library(info.library_path.clone().into())); diff --git a/crates/bevy_gltf_save_load/src/saving.rs b/crates/bevy_gltf_save_load/src/saving.rs index 51aeb0c..b702ae8 100644 --- a/crates/bevy_gltf_save_load/src/saving.rs +++ b/crates/bevy_gltf_save_load/src/saving.rs @@ -17,7 +17,7 @@ pub struct SaveRequest { pub struct SavingFinished; pub fn should_save(save_requests: EventReader) -> bool { - return save_requests.len() > 0; + !save_requests.is_empty() } #[derive(Resource, Clone, Debug, Default, Reflect)] @@ -65,9 +65,7 @@ pub(crate) fn prepare_save_game( } } for (_, blueprint_name, library) in static_entities.iter() { - let library_path: String = library - .map_or_else(|| "", |l| &l.0.to_str().unwrap()) - .into(); + let library_path: String = library.map_or_else(|| "", |l| l.0.to_str().unwrap()).into(); commands.insert_resource(StaticEntitiesStorage { name: blueprint_name.0.clone(), library_path, diff --git a/crates/bevy_registry_export/Cargo.toml b/crates/bevy_registry_export/Cargo.toml index 3aa0228..5cee292 100644 --- a/crates/bevy_registry_export/Cargo.toml +++ b/crates/bevy_registry_export/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "bevy_registry_export" -version = "0.1.0" -authors = ["Mark 'kaosat-dev' Moissette"] +version = "0.1.1" +authors = ["Mark 'kaosat-dev' Moissette", "Pascal 'Killercup' Hertleif"] description = "Allows you to define [Bevy](https://bevyengine.org/) components direclty inside gltf files and instanciate the components on the Bevy side." homepage = "https://github.com/kaosat-dev/Blender_bevy_components_workflow" repository = "https://github.com/kaosat-dev/Blender_bevy_components_workflow" diff --git a/crates/bevy_registry_export/src/export_types.rs b/crates/bevy_registry_export/src/export_types.rs index 06c0573..cb0872d 100644 --- a/crates/bevy_registry_export/src/export_types.rs +++ b/crates/bevy_registry_export/src/export_types.rs @@ -15,8 +15,7 @@ pub fn export_types(world: &mut World) { .get_resource::() .expect("ExportComponentsConfig should exist at this stage"); - let writer = - File::create(config.save_path.to_path_buf()).expect("should have created schema file"); + let writer = File::create(&config.save_path).expect("should have created schema file"); let types = world.resource_mut::(); let types = types.read(); diff --git a/examples/bevy_gltf_blueprints/animation/Cargo.toml b/examples/bevy_gltf_blueprints/animation/Cargo.toml index 23edf5e..ee87ff2 100644 --- a/examples/bevy_gltf_blueprints/animation/Cargo.toml +++ b/examples/bevy_gltf_blueprints/animation/Cargo.toml @@ -7,6 +7,8 @@ license = "MIT OR Apache-2.0" [dependencies] bevy="0.12" bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" } +bevy_gltf_worlflow_examples_common = { path = "../../common" } + bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] } bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]} bevy_editor_pls = { version = "0.6" } diff --git a/examples/bevy_gltf_blueprints/animation/src/assets/assets_game.rs b/examples/bevy_gltf_blueprints/animation/src/assets/assets_game.rs deleted file mode 100644 index b8e0665..0000000 --- a/examples/bevy_gltf_blueprints/animation/src/assets/assets_game.rs +++ /dev/null @@ -1,13 +0,0 @@ -use bevy::gltf::Gltf; -use bevy::prelude::*; -use bevy::utils::HashMap; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct GameAssets { - #[asset(key = "world")] - pub world: Handle, - - #[asset(key = "models", collection(typed, mapped))] - pub models: HashMap>, -} diff --git a/examples/bevy_gltf_blueprints/animation/src/core/camera/camera_replace_proxies.rs b/examples/bevy_gltf_blueprints/animation/src/core/camera/camera_replace_proxies.rs deleted file mode 100644 index 9055c95..0000000 --- a/examples/bevy_gltf_blueprints/animation/src/core/camera/camera_replace_proxies.rs +++ /dev/null @@ -1,24 +0,0 @@ -use bevy::core_pipeline::bloom::{BloomCompositeMode, BloomSettings}; -use bevy::core_pipeline::tonemapping::{DebandDither, Tonemapping}; -use bevy::prelude::*; - -use super::CameraTrackingOffset; - -pub fn camera_replace_proxies( - mut commands: Commands, - mut added_cameras: Query<(Entity, &mut Camera), (Added, With)>, -) { - for (entity, mut camera) in added_cameras.iter_mut() { - info!("detected added camera, updating proxy"); - camera.hdr = true; - commands - .entity(entity) - .insert(DebandDither::Enabled) - .insert(Tonemapping::BlenderFilmic) - .insert(BloomSettings { - intensity: 0.01, - composite_mode: BloomCompositeMode::Additive, - ..default() - }); - } -} diff --git a/examples/bevy_gltf_blueprints/animation/src/core/camera/camera_tracking.rs b/examples/bevy_gltf_blueprints/animation/src/core/camera/camera_tracking.rs deleted file mode 100644 index 62da84d..0000000 --- a/examples/bevy_gltf_blueprints/animation/src/core/camera/camera_tracking.rs +++ /dev/null @@ -1,58 +0,0 @@ -use bevy::prelude::*; - -#[derive(Component, Reflect, Debug)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -/// -pub struct CameraTracking { - pub offset: Vec3, -} -impl Default for CameraTracking { - fn default() -> Self { - CameraTracking { - offset: Vec3::new(0.0, 6.0, 8.0), - } - } -} - -#[derive(Component, Reflect, Debug, Deref, DerefMut)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -pub struct CameraTrackingOffset(Vec3); -impl Default for CameraTrackingOffset { - fn default() -> Self { - CameraTrackingOffset(Vec3::new(0.0, 6.0, 8.0)) - } -} - -impl CameraTrackingOffset { - fn new(input: Vec3) -> Self { - CameraTrackingOffset(input) - } -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Add this component to an entity if you want it to be tracked by a Camera -pub struct CameraTrackable; - -pub fn camera_track( - mut tracking_cameras: Query< - (&mut Transform, &CameraTrackingOffset), - ( - With, - With, - Without, - ), - >, - camera_tracked: Query<&Transform, With>, -) { - for (mut camera_transform, tracking_offset) in tracking_cameras.iter_mut() { - for tracked_transform in camera_tracked.iter() { - let target_position = tracked_transform.translation + tracking_offset.0; - let eased_position = camera_transform.translation.lerp(target_position, 0.1); - camera_transform.translation = eased_position; // + tracking.offset;// tracked_transform.translation + tracking.offset; - *camera_transform = camera_transform.looking_at(tracked_transform.translation, Vec3::Y); - } - } -} diff --git a/examples/bevy_gltf_blueprints/animation/src/core/camera/mod.rs b/examples/bevy_gltf_blueprints/animation/src/core/camera/mod.rs deleted file mode 100644 index a6bbb65..0000000 --- a/examples/bevy_gltf_blueprints/animation/src/core/camera/mod.rs +++ /dev/null @@ -1,24 +0,0 @@ -pub mod camera_tracking; -pub use camera_tracking::*; - -pub mod camera_replace_proxies; -pub use camera_replace_proxies::*; - -use bevy::prelude::*; -use bevy_gltf_blueprints::GltfBlueprintsSet; - -pub struct CameraPlugin; -impl Plugin for CameraPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .register_type::() - .register_type::() - .add_systems( - Update, - ( - camera_replace_proxies.after(GltfBlueprintsSet::AfterSpawn), - camera_track, - ), - ); - } -} diff --git a/examples/bevy_gltf_blueprints/animation/src/core/lighting/lighting_replace_proxies.rs b/examples/bevy_gltf_blueprints/animation/src/core/lighting/lighting_replace_proxies.rs deleted file mode 100644 index 48c0908..0000000 --- a/examples/bevy_gltf_blueprints/animation/src/core/lighting/lighting_replace_proxies.rs +++ /dev/null @@ -1,25 +0,0 @@ -use bevy::prelude::*; - -use bevy::pbr::{CascadeShadowConfig, CascadeShadowConfigBuilder}; - -// fixme might be too specific to might needs, should it be moved out ? also these are all for lights, not models -pub fn lighting_replace_proxies( - mut added_dirights: Query<(Entity, &mut DirectionalLight), Added>, - mut added_spotlights: Query<&mut SpotLight, Added>, - mut commands: Commands, -) { - for (entity, mut light) in added_dirights.iter_mut() { - light.illuminance *= 5.0; - light.shadows_enabled = true; - let shadow_config: CascadeShadowConfig = CascadeShadowConfigBuilder { - first_cascade_far_bound: 15.0, - maximum_distance: 135.0, - ..default() - } - .into(); - commands.entity(entity).insert(shadow_config); - } - for mut light in added_spotlights.iter_mut() { - light.shadows_enabled = true; - } -} diff --git a/examples/bevy_gltf_blueprints/animation/src/core/lighting/mod.rs b/examples/bevy_gltf_blueprints/animation/src/core/lighting/mod.rs deleted file mode 100644 index c9688cd..0000000 --- a/examples/bevy_gltf_blueprints/animation/src/core/lighting/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -mod lighting_replace_proxies; -use lighting_replace_proxies::*; - -use bevy::pbr::{DirectionalLightShadowMap, NotShadowCaster}; -use bevy::prelude::*; - -pub struct LightingPlugin; -impl Plugin for LightingPlugin { - fn build(&self, app: &mut App) { - app - .insert_resource(DirectionalLightShadowMap { size: 4096 }) - // FIXME: adding these since they are missing - .register_type::() - - .add_systems(PreUpdate, lighting_replace_proxies) // FIXME: you should actually run this in a specific state most likely - ; - } -} diff --git a/examples/bevy_gltf_blueprints/animation/src/core/mod.rs b/examples/bevy_gltf_blueprints/animation/src/core/mod.rs index 3271ad4..6db036e 100644 --- a/examples/bevy_gltf_blueprints/animation/src/core/mod.rs +++ b/examples/bevy_gltf_blueprints/animation/src/core/mod.rs @@ -1,29 +1,14 @@ -pub mod camera; -pub use camera::*; - -pub mod lighting; -pub use lighting::*; - -pub mod relationships; -pub use relationships::*; - -pub mod physics; -pub use physics::*; - use bevy::prelude::*; use bevy_gltf_blueprints::*; pub struct CorePlugin; impl Plugin for CorePlugin { fn build(&self, app: &mut App) { - app.add_plugins(( - LightingPlugin, - CameraPlugin, - PhysicsPlugin, - BlueprintsPlugin { - library_folder: "models/library".into(), - ..Default::default() - }, - )); + app.add_plugins((BlueprintsPlugin { + library_folder: "models/library".into(), + format: GltfFormat::GLB, + aabbs: true, + ..Default::default() + },)); } } diff --git a/examples/bevy_gltf_blueprints/animation/src/core/physics/controls.rs b/examples/bevy_gltf_blueprints/animation/src/core/physics/controls.rs deleted file mode 100644 index 9ff42c9..0000000 --- a/examples/bevy_gltf_blueprints/animation/src/core/physics/controls.rs +++ /dev/null @@ -1,12 +0,0 @@ -use bevy::prelude::{info, ResMut}; -use bevy_rapier3d::prelude::RapierConfiguration; - -pub fn pause_physics(mut physics_config: ResMut) { - info!("pausing physics"); - physics_config.physics_pipeline_active = false; -} - -pub fn resume_physics(mut physics_config: ResMut) { - info!("unpausing physics"); - physics_config.physics_pipeline_active = true; -} diff --git a/examples/bevy_gltf_blueprints/animation/src/core/physics/mod.rs b/examples/bevy_gltf_blueprints/animation/src/core/physics/mod.rs deleted file mode 100644 index cd7d523..0000000 --- a/examples/bevy_gltf_blueprints/animation/src/core/physics/mod.rs +++ /dev/null @@ -1,37 +0,0 @@ -pub mod physics_replace_proxies; -use bevy_rapier3d::{ - prelude::{NoUserData, RapierPhysicsPlugin}, - render::RapierDebugRenderPlugin, -}; -pub use physics_replace_proxies::*; - -pub mod utils; - -pub mod controls; -pub use controls::*; - -use crate::state::GameState; -use bevy::prelude::*; -// use super::blueprints::GltfBlueprintsSet; -use bevy_gltf_blueprints::GltfBlueprintsSet; -// use crate::Collider; -pub struct PhysicsPlugin; -impl Plugin for PhysicsPlugin { - fn build(&self, app: &mut App) { - app.add_plugins(( - RapierPhysicsPlugin::::default(), - RapierDebugRenderPlugin::default(), - )) - .register_type::() - .register_type::() - // find a way to make serde's stuff serializable - // .register_type::() - //bevy_rapier3d::dynamics::CoefficientCombineRule - .add_systems( - Update, - physics_replace_proxies.after(GltfBlueprintsSet::AfterSpawn), - ) - .add_systems(OnEnter(GameState::InGame), resume_physics) - .add_systems(OnExit(GameState::InGame), pause_physics); - } -} diff --git a/examples/bevy_gltf_blueprints/animation/src/core/physics/utils_old.rs b/examples/bevy_gltf_blueprints/animation/src/core/physics/utils_old.rs deleted file mode 100644 index c210dd3..0000000 --- a/examples/bevy_gltf_blueprints/animation/src/core/physics/utils_old.rs +++ /dev/null @@ -1,75 +0,0 @@ -use bevy::prelude::*; -use bevy::render::mesh::{MeshVertexAttributeId, PrimitiveTopology, VertexAttributeValues}; -// TAKEN VERBATIB FROM https://github.com/janhohenheim/foxtrot/blob/6e31fc02652fc9d085a4adde0a73ab007dbbb0dc/src/util/trait_extension.rs - -pub trait Vec3Ext { - #[allow(clippy::wrong_self_convention)] // Because [`Vec3`] is [`Copy`] - fn is_approx_zero(self) -> bool; - fn x0z(self) -> Vec3; -} -impl Vec3Ext for Vec3 { - fn is_approx_zero(self) -> bool { - [self.x, self.y, self.z].iter().all(|&x| x.abs() < 1e-5) - } - fn x0z(self) -> Vec3 { - Vec3::new(self.x, 0., self.z) - } -} - -pub trait MeshExt { - fn transform(&mut self, transform: Transform); - fn transformed(&self, transform: Transform) -> Mesh; - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]>; - fn search_in_children<'a>( - children: &'a Children, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> (Entity, &'a Mesh); -} - -impl MeshExt for Mesh { - fn transform(&mut self, transform: Transform) { - for attribute in [Mesh::ATTRIBUTE_POSITION, Mesh::ATTRIBUTE_NORMAL] { - for coords in self.read_coords_mut(attribute.clone()) { - let vec3 = (*coords).into(); - let transformed = transform.transform_point(vec3); - *coords = transformed.into(); - } - } - } - - fn transformed(&self, transform: Transform) -> Mesh { - let mut mesh = self.clone(); - mesh.transform(transform); - mesh - } - - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]> { - match self.attribute_mut(id).unwrap() { - VertexAttributeValues::Float32x3(values) => values, - // Guaranteed by Bevy - _ => unreachable!(), - } - } - - fn search_in_children<'a>( - children: &'a Children, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> (Entity, &'a Mesh) { - let entity_handles: Vec<_> = children - .iter() - .filter_map(|entity| mesh_handles.get(*entity).ok().map(|mesh| (*entity, mesh))) - .collect(); - assert_eq!( - entity_handles.len(), - 1, - "Collider must contain exactly one mesh, but found {}", - entity_handles.len() - ); - let (entity, mesh_handle) = entity_handles.first().unwrap(); - let mesh = meshes.get(mesh_handle).unwrap(); - assert_eq!(mesh.primitive_topology(), PrimitiveTopology::TriangleList); - (*entity, mesh) - } -} diff --git a/examples/bevy_gltf_blueprints/animation/src/game/in_game.rs b/examples/bevy_gltf_blueprints/animation/src/game/in_game.rs index f29efcf..d8651fa 100644 --- a/examples/bevy_gltf_blueprints/animation/src/game/in_game.rs +++ b/examples/bevy_gltf_blueprints/animation/src/game/in_game.rs @@ -1,18 +1,15 @@ +use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning, Player}; use bevy_rapier3d::prelude::Velocity; use rand::Rng; use std::time::Duration; use bevy::prelude::*; -use crate::{ - assets::GameAssets, - state::{GameState, InAppRunning}, -}; use bevy_gltf_blueprints::{ AnimationPlayerLink, Animations, BluePrintBundle, BlueprintName, GameWorldTag, }; -use super::{Fox, Player, Robot}; +use super::{Fox, Robot}; pub fn setup_game( mut commands: Commands, @@ -103,9 +100,9 @@ pub fn animation_change_on_proximity_foxes( let mut anim_name = "Walk"; if distance < 8.5 { anim_name = "Run"; - } else if distance >= 8.5 && distance < 10.0 { + } else if (8.5..10.0).contains(&distance) { anim_name = "Walk"; - } else if distance >= 10.0 && distance < 15.0 { + } else if (10.0..15.0).contains(&distance) { anim_name = "Survey"; } // now play the animation based on the chosen animation name @@ -140,9 +137,9 @@ pub fn animation_change_on_proximity_robots( let mut anim_name = "Idle"; if distance < 8.5 { anim_name = "Jump"; - } else if distance >= 8.5 && distance < 10.0 { + } else if (8.5..10.0).contains(&distance) { anim_name = "Scan"; - } else if distance >= 10.0 && distance < 15.0 { + } else if (10.0..15.0).contains(&distance) { anim_name = "Idle"; } diff --git a/examples/bevy_gltf_blueprints/animation/src/game/in_main_menu.rs b/examples/bevy_gltf_blueprints/animation/src/game/in_main_menu.rs index 0420be5..749eb36 100644 --- a/examples/bevy_gltf_blueprints/animation/src/game/in_main_menu.rs +++ b/examples/bevy_gltf_blueprints/animation/src/game/in_main_menu.rs @@ -1,6 +1,5 @@ use bevy::prelude::*; - -use crate::state::{AppState, GameState, InMainMenu}; +use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu}; pub fn setup_main_menu(mut commands: Commands) { commands.spawn((Camera2dBundle::default(), InMainMenu)); diff --git a/examples/bevy_gltf_blueprints/animation/src/game/mod.rs b/examples/bevy_gltf_blueprints/animation/src/game/mod.rs index 69a5ae4..bb44b89 100644 --- a/examples/bevy_gltf_blueprints/animation/src/game/mod.rs +++ b/examples/bevy_gltf_blueprints/animation/src/game/mod.rs @@ -4,44 +4,8 @@ pub use in_game::*; pub mod in_main_menu; pub use in_main_menu::*; -pub mod picking; -pub use picking::*; - -use crate::{ - insert_dependant_component, - state::{AppState, GameState}, -}; use bevy::prelude::*; -use bevy_rapier3d::prelude::*; - -// this file is just for demo purposes, contains various types of components, systems etc - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum SoundMaterial { - Metal, - Wood, - Rock, - Cloth, - Squishy, - #[default] - None, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Player; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo component showing auto injection of components -pub struct ShouldBeWithPlayer; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Interactible; +use bevy_gltf_worlflow_examples_common::{AppState, GameState}; #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] @@ -53,66 +17,14 @@ pub struct Fox; /// Demo marker component pub struct Robot; -fn player_move_demo( - keycode: Res>, - mut players: Query<&mut Transform, With>, -) { - let speed = 0.2; - if let Ok(mut player) = players.get_single_mut() { - if keycode.pressed(KeyCode::Left) { - player.translation.x += speed; - } - if keycode.pressed(KeyCode::Right) { - player.translation.x -= speed; - } - - if keycode.pressed(KeyCode::Up) { - player.translation.z += speed; - } - if keycode.pressed(KeyCode::Down) { - player.translation.z -= speed; - } - } -} - -// collision tests/debug -pub fn test_collision_events( - mut collision_events: EventReader, - mut contact_force_events: EventReader, -) { - for collision_event in collision_events.iter() { - println!("collision"); - match collision_event { - CollisionEvent::Started(_entity1, _entity2, _) => { - println!("collision started") - } - CollisionEvent::Stopped(_entity1, _entity2, _) => { - println!("collision ended") - } - } - } - - for contact_force_event in contact_force_events.iter() { - println!("Received contact force event: {:?}", contact_force_event); - } -} - pub struct GamePlugin; impl Plugin for GamePlugin { fn build(&self, app: &mut App) { - app.add_plugins(PickingPlugin) - .register_type::() - .register_type::() - .register_type::() - .register_type::() + app.register_type::() .register_type::() - // little helper utility, to automatically inject components that are dependant on an other component - // ie, here an Entity with a Player component should also always have a ShouldBeWithPlayer component - // you get a warning if you use this, as I consider this to be stop-gap solution (usually you should have either a bundle, or directly define all needed components) .add_systems( Update, ( - player_move_demo, spawn_test, animation_control, animation_change_on_proximity_foxes, diff --git a/examples/bevy_gltf_blueprints/animation/src/game/picking.rs b/examples/bevy_gltf_blueprints/animation/src/game/picking.rs deleted file mode 100644 index 23988c8..0000000 --- a/examples/bevy_gltf_blueprints/animation/src/game/picking.rs +++ /dev/null @@ -1,37 +0,0 @@ -use super::Player; -use bevy::prelude::*; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub struct Pickable; - -// very simple, crude picking (as in picking up objects) implementation - -pub fn picking( - players: Query<&GlobalTransform, With>, - pickables: Query<(Entity, &GlobalTransform), With>, - mut commands: Commands, -) { - for player_transforms in players.iter() { - for (pickable, pickable_transforms) in pickables.iter() { - let distance = player_transforms - .translation() - .distance(pickable_transforms.translation()); - if distance < 2.5 { - commands.entity(pickable).despawn_recursive(); - } - } - } -} - -pub struct PickingPlugin; -impl Plugin for PickingPlugin { - fn build(&self, app: &mut App) { - app.register_type::().add_systems( - Update, - ( - picking, //.run_if(in_state(AppState::Running)), - ), - ); - } -} diff --git a/examples/bevy_gltf_blueprints/animation/src/main.rs b/examples/bevy_gltf_blueprints/animation/src/main.rs index 6edba33..8fca426 100644 --- a/examples/bevy_gltf_blueprints/animation/src/main.rs +++ b/examples/bevy_gltf_blueprints/animation/src/main.rs @@ -1,15 +1,10 @@ use bevy::prelude::*; use bevy_editor_pls::prelude::*; +use bevy_gltf_worlflow_examples_common::CommonPlugin; mod core; use crate::core::*; -pub mod assets; -use assets::*; - -pub mod state; -use state::*; - mod game; use game::*; @@ -23,8 +18,7 @@ fn main() { // editor EditorPlugin::default(), // our custom plugins - StatePlugin, - AssetsPlugin, + CommonPlugin, CorePlugin, // reusable plugins GamePlugin, // specific to our game ComponentsTestPlugin, // Showcases different type of components /structs diff --git a/examples/bevy_gltf_blueprints/animation/src/test_components.rs b/examples/bevy_gltf_blueprints/animation/src/test_components.rs index d0e6fbd..b5384e2 100644 --- a/examples/bevy_gltf_blueprints/animation/src/test_components.rs +++ b/examples/bevy_gltf_blueprints/animation/src/test_components.rs @@ -6,39 +6,39 @@ struct UnitTest; #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -struct TuppleTestF32(f32); +struct TupleTestF32(f32); #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -struct TuppleTestU64(u64); +struct TupleTestU64(u64); #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -pub struct TuppleTestStr(String); +pub struct TupleTestStr(String); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTest2(f32, u64, String); +struct TupleTest2(f32, u64, String); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTestBool(bool); +struct TupleTestBool(bool); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec2(Vec2); +struct TupleVec2(Vec2); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec3(Vec3); +struct TupleVec3(Vec3); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec(Vec); +struct TupleVec(Vec); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTestColor(Color); +struct TupleTestColor(Color); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] @@ -65,16 +65,16 @@ impl Plugin for ComponentsTestPlugin { fn build(&self, app: &mut App) { app.register_type::() .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() .register_type::() - .register_type::() - .register_type::() + .register_type::() + .register_type::() .register_type::>(); } } diff --git a/examples/bevy_gltf_blueprints/basic/Cargo.toml b/examples/bevy_gltf_blueprints/basic/Cargo.toml index 1e902c0..9b83cc8 100644 --- a/examples/bevy_gltf_blueprints/basic/Cargo.toml +++ b/examples/bevy_gltf_blueprints/basic/Cargo.toml @@ -7,6 +7,8 @@ license = "MIT OR Apache-2.0" [dependencies] bevy="0.12" bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" } +bevy_gltf_worlflow_examples_common = { path = "../../common" } + bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] } bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]} bevy_editor_pls = { version = "0.6" } diff --git a/examples/bevy_gltf_blueprints/basic/README.md b/examples/bevy_gltf_blueprints/basic/README.md index 748e517..c61406e 100644 --- a/examples/bevy_gltf_blueprints/basic/README.md +++ b/examples/bevy_gltf_blueprints/basic/README.md @@ -15,9 +15,39 @@ It also allows you to setup 'blueprints' in Blender by using collections (the re ``` cargo run --features bevy/dynamic_linking + ``` -### Additional notes +## Wasm instructions + +### Setup + +as per the bevy documentation: + +```shell +rustup target add wasm32-unknown-unknown +cargo install wasm-bindgen-cli +``` + + +### Building this example + +navigate to the current folder , and then + +```shell +cargo build --release --target wasm32-unknown-unknown --target-dir ./target +wasm-bindgen --out-name wasm_example \ + --out-dir ./target/wasm \ + --target web target/wasm32-unknown-unknown/release/bevy_gltf_blueprints_basic_wasm_example.wasm + +``` + +### Running this example + +run a web server in the current folder, and navigate to the page, you should see the example in your browser + + +## Additional notes * You usually define either the Components directly or use ```Proxy components``` that get replaced in Bevy systems with the actual Components that you want (usually when for some reason, ie external crates with unregistered components etc) you cannot use the components directly. * this example contains code for future features, not finished yet ! please disregard anything related to saving & loading diff --git a/examples/bevy_gltf_blueprints/basic/TODO.md b/examples/bevy_gltf_blueprints/basic/TODO.md deleted file mode 100644 index 5958ba1..0000000 --- a/examples/bevy_gltf_blueprints/basic/TODO.md +++ /dev/null @@ -1,53 +0,0 @@ -- [x] seperate "spawn velocity" into a seperate (optional) component -- [x] try dynamically spawned entities with save & load -- [ ] fix issues with multiple entites having the same name ?? -- [ ] fix issues with system ordering - - [x] add sets for proxy-replacements -- [x] annoying camera movement : camera should be saveable as well - => we need to be able to only save the camera position (and name) -- [ ] only spawn "new level" stuff when transitioning from menu to game ? - - [ ] put more thoughts into this - -- [ ] rework how save-loading is triggered - - [ ] no hardcoded keypresses - - [ ] ability to choose what save to load ? - - [ ] take a look at bevy_moonshine_save - - [ ] move to system pipelines - -- [x] split Blueprints into a seperate crate: perhaps bevy_gltf_blueprints - - [x] how to deal with states that are not defined as part of the plugin/crate ? - - [x] same issue for the assets - -- [x] support multiple main scenes in the blender plugin ? -- [ ] study possibilities of expanding the bevy & blender tooling side to define UIS - - likely using the blender data only as a placeholder/ directly replace in Python - -- system ordering ? - load level => inject components => spawn blueprint entities/rehydrate => (loading) => replace proxies - OR - load level => inject components => (loading) => spawn blueprint entities/rehydrate => replace proxies - -- perhaps it does make more sense to save ALL entities and not just the dynamic ones? mostly as we have the blueprints anyway, which should cut down on needed data ? - - -- different approaches for dealing with saving/loading - in particular the problem of entites that are defined as part of the level but can be despawned (items that get picked up etc) - - Bevy side - * var 1 : spawn all entities completely, despawn those saveables that are not actually present in the save data but that have been spawned - * problems: needs correct ordering of systems otherwise the diffing above will not work - * pros: minimal save files, only bevy boilerplate - * cons: requires spawning potentially huge gltf files just to "peek" inside of them to know if they are saveable - - - * var 2 : save both saveables & unsaveables but only save the absolute minimal data for unsaveables - * problems: how to combine different filters into a single save file ? - * pros: easier diffing, more homogeneous handling - * cons: a lot bigger save file with mostly useless data - - Blender side - - * var 3 => CHOSEN OPTION : mark INSTANCES in advance as static/dynamic (ie saveable or not), thus this data would be present in the world/level and not inside the gltf data - * problems: would require adding custom properties to each instance in Blender (COULD be automated by 'peeking' inside the collection) - * pros: simpler, and this might be more "editor-like" where you would mark each item as static or not - * cons: potentially a lot of manual work / error prone \ No newline at end of file diff --git a/examples/bevy_gltf_blueprints/basic/assets/advanced.blend b/examples/bevy_gltf_blueprints/basic/assets/advanced.blend deleted file mode 100644 index 3f711e3..0000000 Binary files a/examples/bevy_gltf_blueprints/basic/assets/advanced.blend and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/assets/nested.blend b/examples/bevy_gltf_blueprints/basic/assets/basic.blend similarity index 58% rename from examples/bevy_gltf_blueprints/nested_blueprints/assets/nested.blend rename to examples/bevy_gltf_blueprints/basic/assets/basic.blend index 17d66dd..d92ce80 100644 Binary files a/examples/bevy_gltf_blueprints/nested_blueprints/assets/nested.blend and b/examples/bevy_gltf_blueprints/basic/assets/basic.blend differ diff --git a/examples/bevy_gltf_blueprints/basic/assets/models/World.glb b/examples/bevy_gltf_blueprints/basic/assets/models/World.glb index b71d240..642b155 100644 Binary files a/examples/bevy_gltf_blueprints/basic/assets/models/World.glb and b/examples/bevy_gltf_blueprints/basic/assets/models/World.glb differ diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Enemy.glb b/examples/bevy_gltf_blueprints/basic/assets/models/library/Enemy.glb similarity index 92% rename from examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Enemy.glb rename to examples/bevy_gltf_blueprints/basic/assets/models/library/Enemy.glb index 1a139bf..9d40674 100644 Binary files a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Enemy.glb and b/examples/bevy_gltf_blueprints/basic/assets/models/library/Enemy.glb differ diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Finger.glb b/examples/bevy_gltf_blueprints/basic/assets/models/library/Finger.glb similarity index 100% rename from examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Finger.glb rename to examples/bevy_gltf_blueprints/basic/assets/models/library/Finger.glb diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Hand.glb b/examples/bevy_gltf_blueprints/basic/assets/models/library/Hand.glb similarity index 87% rename from examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Hand.glb rename to examples/bevy_gltf_blueprints/basic/assets/models/library/Hand.glb index cf02f86..bdddd17 100644 Binary files a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Hand.glb and b/examples/bevy_gltf_blueprints/basic/assets/models/library/Hand.glb differ diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Humanoid_cactus.glb b/examples/bevy_gltf_blueprints/basic/assets/models/library/Humanoid_cactus.glb similarity index 89% rename from examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Humanoid_cactus.glb rename to examples/bevy_gltf_blueprints/basic/assets/models/library/Humanoid_cactus.glb index 3d5736b..3aa5e5d 100644 Binary files a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Humanoid_cactus.glb and b/examples/bevy_gltf_blueprints/basic/assets/models/library/Humanoid_cactus.glb differ diff --git a/examples/bevy_gltf_blueprints/basic/assets/scenes/save.scn.ron b/examples/bevy_gltf_blueprints/basic/assets/scenes/save.scn.ron deleted file mode 100644 index ed30389..0000000 --- a/examples/bevy_gltf_blueprints/basic/assets/scenes/save.scn.ron +++ /dev/null @@ -1,485 +0,0 @@ -( - resources: {}, - entities: { - 20: ( - components: { - "bevy_render::camera::projection::Projection": Perspective(( - fov: 0.3995965, - aspect_ratio: 1.7777778, - near: 0.1, - far: 100.0, - )), - "bevy_render::primitives::Frustum": (), - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 34.821884, - y: 49.024857, - z: -36.79615, - ), - rotation: (-0.1694689, 0.82838506, 0.40884802, 0.3433684), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core_pipeline::tonemapping::Tonemapping": BlenderFilmic, - "bevy_core_pipeline::tonemapping::DebandDither": Enabled, - "bevy_render::view::ColorGrading": ( - exposure: 0.0, - gamma: 1.0, - pre_saturation: 1.0, - post_saturation: 1.0, - ), - "bevy_core::name::Name": ( - hash: 17702508670109176045, - name: "Camera", - ), - "advanced::core::camera::camera_tracking::CameraTrackingOffset": (( - x: 26.0, - y: 48.0, - z: -26.0, - )), - "bevy_pbr::light::ClusterConfig": FixedZ( - total: 4096, - z_slices: 24, - z_config: ( - first_slice_depth: 5.0, - far_z_mode: MaxLightRange, - ), - dynamic_resizing: true, - ), - "bevy_core_pipeline::bloom::settings::BloomSettings": ( - intensity: 0.01, - low_frequency_boost: 0.7, - low_frequency_boost_curvature: 0.95, - high_pass_frequency: 1.0, - prefilter_settings: ( - threshold: 0.0, - threshold_softness: 0.0, - ), - composite_mode: Additive, - ), - }, - ), - 34: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 4.697565, - y: 1.5983224, - z: 8.962274, - ), - rotation: (0.000000000000000031724054, -0.00000000000000000000647681, -0.000013119204, 1.0), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 9837288155836662016, - name: "Health_Pickup.001", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "advanced::game::picking::Pickable": (), - }, - ), - 54: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 8.799996, - y: 1.02484, - z: -10.799994, - ), - rotation: (0.0, 0.0, 0.0, 1.0), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 17978181434632022651, - name: "Player", - ), - "advanced::core::camera::camera_tracking::CameraTrackable": (), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Player"), - "advanced::game::Player": (), - "advanced::game::SoundMaterial": Wood, - }, - ), - 60: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 3.6351967, - y: 1.7298106, - z: -7.313273, - ), - rotation: (0.0, 0.0, 0.0, 1.0), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 7225506896223411979, - name: "MagicTeapot.001", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("MagicTeapot"), - }, - ), - 64: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -4.6068983, - y: 1.5983224, - z: -10.579347, - ), - rotation: (0.000000000000000031724054, 0.00000000000000000000647681, 0.000013119204, 1.0), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 3089896164553476909, - name: "Health_Pickup.002", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "advanced::game::picking::Pickable": (), - }, - ), - 72: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -11.560788, - y: 0.0, - z: 7.6554174, - ), - rotation: (0.0, 0.0, 0.0, 1.0), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 16961132108296874979, - name: "Container.001", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Container"), - "advanced::game::picking::Pickable": (), - }, - ), - 80: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -21.397858, - y: 0.3833189, - z: -0.32418346, - ), - rotation: (0.0, 0.0, 0.0, 1.0), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 5104740624378885265, - name: "Container.002", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Container"), - "advanced::game::picking::Pickable": (), - }, - ), - 82: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 2.9156065, - y: 1.4984571, - z: 2.1909573, - ), - rotation: (0.058853183, 0.0726243, 0.2048649, 0.97431636), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 107557640935939866, - name: "test5159735758431545549", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "advanced::game::picking::Pickable": (), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: -1.2580805, - y: -0.39687577, - z: 0.4816798, - ), - angvel: ( - x: 0.2979751, - y: 0.07926611, - z: 0.8434645, - ), - ), - }, - ), - 86: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 0.26087752, - y: 1.5525806, - z: 1.5980839, - ), - rotation: (0.059497803, -0.0000018232388, 0.13145457, 0.9895351), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 3398656236303073559, - name: "test7470642598731063943", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "advanced::game::picking::Pickable": (), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: -0.9268077, - y: -0.19806683, - z: 0.41948256, - ), - angvel: ( - x: 0.26946256, - y: -0.000006710977, - z: 0.5953494, - ), - ), - }, - ), - 90: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 2.6515265, - y: 1.5944021, - z: -4.391837, - ), - rotation: (-0.030030435, -0.0000006527225, 0.029748484, 0.9991062), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 12541900054595385134, - name: "test3938024405863834719", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "advanced::game::picking::Pickable": (), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: -0.28430828, - y: -0.022357654, - z: -0.2870027, - ), - angvel: ( - x: -0.17986917, - y: -0.0000035613396, - z: 0.17818078, - ), - ), - }, - ), - 94: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -4.2356462, - y: 1.596993, - z: 0.7254991, - ), - rotation: (-0.0221751, -0.0000000001891749, 0.011065631, 0.99969286), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 6757906322211730861, - name: "test11007490954016878479", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "advanced::game::picking::Pickable": (), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: -0.21747473, - y: -0.014912919, - z: -0.43581253, - ), - angvel: ( - x: -0.2727097, - y: -0.0000000034594905, - z: 0.13608481, - ), - ), - }, - ), - 98: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 3.1525247, - y: 1.5518407, - z: -2.9611976, - ), - rotation: (-0.09219627, 0.1602262, -0.11205085, 0.9763565), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 12588565107899185946, - name: "test5980867849331267699", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "advanced::game::picking::Pickable": (), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: 0.8323179, - y: -0.20597076, - z: -0.68975484, - ), - angvel: ( - x: -0.37971017, - y: 0.49603412, - z: -0.6079359, - ), - ), - }, - ), - 4294967310: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 4.826278, - y: 1.2710563, - z: -3.1997645, - ), - rotation: (-0.303028, 0.00000087800436, -0.23889118, 0.9225535), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 15533546218717453536, - name: "test12380979123759326444", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "advanced::game::picking::Pickable": (), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: 1.2146912, - y: -1.1640646, - z: -1.5408095, - ), - angvel: ( - x: -1.1932359, - y: 0.000002945365, - z: -0.94068503, - ), - ), - }, - ), - 4294967314: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 3.9906094, - y: 1.4824095, - z: 2.4394412, - ), - rotation: (0.06015042, 0.085218765, 0.2215642, 0.9695509), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 2466794778849297109, - name: "test12475628281920299197", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "advanced::game::picking::Pickable": (), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: -1.0818624, - y: -0.37798148, - z: 0.45334253, - ), - angvel: ( - x: 0.25961447, - y: 0.14854014, - z: 0.7426717, - ), - ), - }, - ), - 4294967321: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 2.2306876, - y: 0.989814, - z: -1.3596333, - ), - rotation: (0.30614096, 0.002587511, -0.42789298, 0.8503991), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 1545925632270385398, - name: "test15780367212768138828", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "advanced::game::picking::Pickable": (), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: 1.3027526, - y: -1.8947054, - z: 1.6179247, - ), - angvel: ( - x: 1.4565696, - y: -0.16299045, - z: -1.3631926, - ), - ), - }, - ), - }, -) \ No newline at end of file diff --git a/examples/bevy_gltf_blueprints/basic_wasm/index.html b/examples/bevy_gltf_blueprints/basic/index.html similarity index 100% rename from examples/bevy_gltf_blueprints/basic_wasm/index.html rename to examples/bevy_gltf_blueprints/basic/index.html diff --git a/examples/bevy_gltf_blueprints/basic/src/assets/assets_core.rs b/examples/bevy_gltf_blueprints/basic/src/assets/assets_core.rs deleted file mode 100644 index 29b577a..0000000 --- a/examples/bevy_gltf_blueprints/basic/src/assets/assets_core.rs +++ /dev/null @@ -1,5 +0,0 @@ -use bevy::prelude::*; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct CoreAssets {} diff --git a/examples/bevy_gltf_blueprints/basic/src/assets/assets_game.rs b/examples/bevy_gltf_blueprints/basic/src/assets/assets_game.rs deleted file mode 100644 index b8e0665..0000000 --- a/examples/bevy_gltf_blueprints/basic/src/assets/assets_game.rs +++ /dev/null @@ -1,13 +0,0 @@ -use bevy::gltf::Gltf; -use bevy::prelude::*; -use bevy::utils::HashMap; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct GameAssets { - #[asset(key = "world")] - pub world: Handle, - - #[asset(key = "models", collection(typed, mapped))] - pub models: HashMap>, -} diff --git a/examples/bevy_gltf_blueprints/basic/src/assets/mod.rs b/examples/bevy_gltf_blueprints/basic/src/assets/mod.rs deleted file mode 100644 index a2c8b22..0000000 --- a/examples/bevy_gltf_blueprints/basic/src/assets/mod.rs +++ /dev/null @@ -1,35 +0,0 @@ -pub mod assets_core; -pub use assets_core::*; - -pub mod assets_game; -pub use assets_game::*; - -use bevy::prelude::*; -use bevy_asset_loader::prelude::*; - -use crate::state::AppState; - -pub struct AssetsPlugin; -impl Plugin for AssetsPlugin { - fn build(&self, app: &mut App) { - 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), - ) - .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); - } -} diff --git a/examples/bevy_gltf_blueprints/basic/src/core/camera/camera_replace_proxies.rs b/examples/bevy_gltf_blueprints/basic/src/core/camera/camera_replace_proxies.rs deleted file mode 100644 index 9055c95..0000000 --- a/examples/bevy_gltf_blueprints/basic/src/core/camera/camera_replace_proxies.rs +++ /dev/null @@ -1,24 +0,0 @@ -use bevy::core_pipeline::bloom::{BloomCompositeMode, BloomSettings}; -use bevy::core_pipeline::tonemapping::{DebandDither, Tonemapping}; -use bevy::prelude::*; - -use super::CameraTrackingOffset; - -pub fn camera_replace_proxies( - mut commands: Commands, - mut added_cameras: Query<(Entity, &mut Camera), (Added, With)>, -) { - for (entity, mut camera) in added_cameras.iter_mut() { - info!("detected added camera, updating proxy"); - camera.hdr = true; - commands - .entity(entity) - .insert(DebandDither::Enabled) - .insert(Tonemapping::BlenderFilmic) - .insert(BloomSettings { - intensity: 0.01, - composite_mode: BloomCompositeMode::Additive, - ..default() - }); - } -} diff --git a/examples/bevy_gltf_blueprints/basic/src/core/camera/camera_tracking.rs b/examples/bevy_gltf_blueprints/basic/src/core/camera/camera_tracking.rs deleted file mode 100644 index 62da84d..0000000 --- a/examples/bevy_gltf_blueprints/basic/src/core/camera/camera_tracking.rs +++ /dev/null @@ -1,58 +0,0 @@ -use bevy::prelude::*; - -#[derive(Component, Reflect, Debug)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -/// -pub struct CameraTracking { - pub offset: Vec3, -} -impl Default for CameraTracking { - fn default() -> Self { - CameraTracking { - offset: Vec3::new(0.0, 6.0, 8.0), - } - } -} - -#[derive(Component, Reflect, Debug, Deref, DerefMut)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -pub struct CameraTrackingOffset(Vec3); -impl Default for CameraTrackingOffset { - fn default() -> Self { - CameraTrackingOffset(Vec3::new(0.0, 6.0, 8.0)) - } -} - -impl CameraTrackingOffset { - fn new(input: Vec3) -> Self { - CameraTrackingOffset(input) - } -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Add this component to an entity if you want it to be tracked by a Camera -pub struct CameraTrackable; - -pub fn camera_track( - mut tracking_cameras: Query< - (&mut Transform, &CameraTrackingOffset), - ( - With, - With, - Without, - ), - >, - camera_tracked: Query<&Transform, With>, -) { - for (mut camera_transform, tracking_offset) in tracking_cameras.iter_mut() { - for tracked_transform in camera_tracked.iter() { - let target_position = tracked_transform.translation + tracking_offset.0; - let eased_position = camera_transform.translation.lerp(target_position, 0.1); - camera_transform.translation = eased_position; // + tracking.offset;// tracked_transform.translation + tracking.offset; - *camera_transform = camera_transform.looking_at(tracked_transform.translation, Vec3::Y); - } - } -} diff --git a/examples/bevy_gltf_blueprints/basic/src/core/camera/mod.rs b/examples/bevy_gltf_blueprints/basic/src/core/camera/mod.rs deleted file mode 100644 index a6bbb65..0000000 --- a/examples/bevy_gltf_blueprints/basic/src/core/camera/mod.rs +++ /dev/null @@ -1,24 +0,0 @@ -pub mod camera_tracking; -pub use camera_tracking::*; - -pub mod camera_replace_proxies; -pub use camera_replace_proxies::*; - -use bevy::prelude::*; -use bevy_gltf_blueprints::GltfBlueprintsSet; - -pub struct CameraPlugin; -impl Plugin for CameraPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .register_type::() - .register_type::() - .add_systems( - Update, - ( - camera_replace_proxies.after(GltfBlueprintsSet::AfterSpawn), - camera_track, - ), - ); - } -} diff --git a/examples/bevy_gltf_blueprints/basic/src/core/lighting/lighting_replace_proxies.rs b/examples/bevy_gltf_blueprints/basic/src/core/lighting/lighting_replace_proxies.rs deleted file mode 100644 index 48c0908..0000000 --- a/examples/bevy_gltf_blueprints/basic/src/core/lighting/lighting_replace_proxies.rs +++ /dev/null @@ -1,25 +0,0 @@ -use bevy::prelude::*; - -use bevy::pbr::{CascadeShadowConfig, CascadeShadowConfigBuilder}; - -// fixme might be too specific to might needs, should it be moved out ? also these are all for lights, not models -pub fn lighting_replace_proxies( - mut added_dirights: Query<(Entity, &mut DirectionalLight), Added>, - mut added_spotlights: Query<&mut SpotLight, Added>, - mut commands: Commands, -) { - for (entity, mut light) in added_dirights.iter_mut() { - light.illuminance *= 5.0; - light.shadows_enabled = true; - let shadow_config: CascadeShadowConfig = CascadeShadowConfigBuilder { - first_cascade_far_bound: 15.0, - maximum_distance: 135.0, - ..default() - } - .into(); - commands.entity(entity).insert(shadow_config); - } - for mut light in added_spotlights.iter_mut() { - light.shadows_enabled = true; - } -} diff --git a/examples/bevy_gltf_blueprints/basic/src/core/lighting/mod.rs b/examples/bevy_gltf_blueprints/basic/src/core/lighting/mod.rs deleted file mode 100644 index c9688cd..0000000 --- a/examples/bevy_gltf_blueprints/basic/src/core/lighting/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -mod lighting_replace_proxies; -use lighting_replace_proxies::*; - -use bevy::pbr::{DirectionalLightShadowMap, NotShadowCaster}; -use bevy::prelude::*; - -pub struct LightingPlugin; -impl Plugin for LightingPlugin { - fn build(&self, app: &mut App) { - app - .insert_resource(DirectionalLightShadowMap { size: 4096 }) - // FIXME: adding these since they are missing - .register_type::() - - .add_systems(PreUpdate, lighting_replace_proxies) // FIXME: you should actually run this in a specific state most likely - ; - } -} diff --git a/examples/bevy_gltf_blueprints/basic/src/core/mod.rs b/examples/bevy_gltf_blueprints/basic/src/core/mod.rs index 9c38fa7..6db036e 100644 --- a/examples/bevy_gltf_blueprints/basic/src/core/mod.rs +++ b/examples/bevy_gltf_blueprints/basic/src/core/mod.rs @@ -1,31 +1,14 @@ -pub mod camera; -pub use camera::*; - -pub mod lighting; -pub use lighting::*; - -pub mod relationships; -pub use relationships::*; - -pub mod physics; -pub use physics::*; - use bevy::prelude::*; use bevy_gltf_blueprints::*; pub struct CorePlugin; impl Plugin for CorePlugin { fn build(&self, app: &mut App) { - app.add_plugins(( - LightingPlugin, - CameraPlugin, - PhysicsPlugin, - BlueprintsPlugin { - library_folder: "models/library".into(), - format: GltfFormat::GLB, - aabbs: true, - ..Default::default() - }, - )); + app.add_plugins((BlueprintsPlugin { + library_folder: "models/library".into(), + format: GltfFormat::GLB, + aabbs: true, + ..Default::default() + },)); } } diff --git a/examples/bevy_gltf_blueprints/basic/src/core/physics/controls.rs b/examples/bevy_gltf_blueprints/basic/src/core/physics/controls.rs deleted file mode 100644 index 9ff42c9..0000000 --- a/examples/bevy_gltf_blueprints/basic/src/core/physics/controls.rs +++ /dev/null @@ -1,12 +0,0 @@ -use bevy::prelude::{info, ResMut}; -use bevy_rapier3d::prelude::RapierConfiguration; - -pub fn pause_physics(mut physics_config: ResMut) { - info!("pausing physics"); - physics_config.physics_pipeline_active = false; -} - -pub fn resume_physics(mut physics_config: ResMut) { - info!("unpausing physics"); - physics_config.physics_pipeline_active = true; -} diff --git a/examples/bevy_gltf_blueprints/basic/src/core/physics/mod.rs b/examples/bevy_gltf_blueprints/basic/src/core/physics/mod.rs deleted file mode 100644 index cd7d523..0000000 --- a/examples/bevy_gltf_blueprints/basic/src/core/physics/mod.rs +++ /dev/null @@ -1,37 +0,0 @@ -pub mod physics_replace_proxies; -use bevy_rapier3d::{ - prelude::{NoUserData, RapierPhysicsPlugin}, - render::RapierDebugRenderPlugin, -}; -pub use physics_replace_proxies::*; - -pub mod utils; - -pub mod controls; -pub use controls::*; - -use crate::state::GameState; -use bevy::prelude::*; -// use super::blueprints::GltfBlueprintsSet; -use bevy_gltf_blueprints::GltfBlueprintsSet; -// use crate::Collider; -pub struct PhysicsPlugin; -impl Plugin for PhysicsPlugin { - fn build(&self, app: &mut App) { - app.add_plugins(( - RapierPhysicsPlugin::::default(), - RapierDebugRenderPlugin::default(), - )) - .register_type::() - .register_type::() - // find a way to make serde's stuff serializable - // .register_type::() - //bevy_rapier3d::dynamics::CoefficientCombineRule - .add_systems( - Update, - physics_replace_proxies.after(GltfBlueprintsSet::AfterSpawn), - ) - .add_systems(OnEnter(GameState::InGame), resume_physics) - .add_systems(OnExit(GameState::InGame), pause_physics); - } -} diff --git a/examples/bevy_gltf_blueprints/basic/src/core/physics/physics_replace_proxies.rs b/examples/bevy_gltf_blueprints/basic/src/core/physics/physics_replace_proxies.rs deleted file mode 100644 index b91462c..0000000 --- a/examples/bevy_gltf_blueprints/basic/src/core/physics/physics_replace_proxies.rs +++ /dev/null @@ -1,101 +0,0 @@ -use bevy::prelude::*; -// use bevy::render::primitives::Aabb; -use bevy_rapier3d::geometry::Collider as RapierCollider; -use bevy_rapier3d::prelude::{ActiveCollisionTypes, ActiveEvents, ComputedColliderShape}; - -use super::utils::*; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum Collider { - Ball(f32), - Cuboid(Vec3), - Capsule(Vec3, Vec3, f32), - #[default] - Mesh, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum AutoAABBCollider { - #[default] - Cuboid, - Ball, - Capsule, -} - -// replaces all physics stand-ins with the actual rapier types -pub fn physics_replace_proxies( - meshes: Res>, - mesh_handles: Query<&Handle>, - mut proxy_colliders: Query< - (Entity, &Collider, &Name, &mut Visibility), - (Without, Added), - >, - // needed for tri meshes - children: Query<&Children>, - - mut commands: Commands, -) { - for proxy_colider in proxy_colliders.iter_mut() { - let (entity, collider_proxy, name, mut visibility) = proxy_colider; - // we hide the collider meshes: perhaps they should be removed altogether once processed ? - if name.ends_with("_collider") || name.ends_with("_sensor") { - *visibility = Visibility::Hidden; - } - - let mut rapier_collider: RapierCollider; - match collider_proxy { - Collider::Ball(radius) => { - info!("generating collider from proxy: ball"); - rapier_collider = RapierCollider::ball(*radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Cuboid(size) => { - info!("generating collider from proxy: cuboid"); - rapier_collider = RapierCollider::cuboid(size.x, size.y, size.z); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Capsule(a, b, radius) => { - info!("generating collider from proxy: capsule"); - rapier_collider = RapierCollider::capsule(*a, *b, *radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Mesh => { - info!("generating collider from proxy: mesh"); - for (_, collider_mesh) in - Mesh::search_in_children(entity, &children, &meshes, &mesh_handles) - { - rapier_collider = RapierCollider::from_bevy_mesh( - collider_mesh, - &ComputedColliderShape::TriMesh, - ) - .unwrap(); - commands - .entity(entity) - .insert(rapier_collider) - // FIXME: this is just for demo purposes !!! - .insert( - ActiveCollisionTypes::default() - | ActiveCollisionTypes::KINEMATIC_STATIC - | ActiveCollisionTypes::STATIC_STATIC - | ActiveCollisionTypes::DYNAMIC_STATIC, - ) - .insert(ActiveEvents::COLLISION_EVENTS); - // .insert(ActiveEvents::COLLISION_EVENTS) - // break; - // RapierCollider::convex_hull(points) - } - } - } - } -} diff --git a/examples/bevy_gltf_blueprints/basic/src/core/physics/utils.rs b/examples/bevy_gltf_blueprints/basic/src/core/physics/utils.rs deleted file mode 100644 index 7886710..0000000 --- a/examples/bevy_gltf_blueprints/basic/src/core/physics/utils.rs +++ /dev/null @@ -1,175 +0,0 @@ -use bevy::prelude::*; -use bevy::render::mesh::{MeshVertexAttributeId, PrimitiveTopology, VertexAttributeValues}; -// TAKEN VERBATIB FROM https://github.com/janhohenheim/foxtrot/blob/src/util/trait_extension.rs - -pub(crate) trait Vec3Ext: Copy { - fn is_approx_zero(self) -> bool; - fn split(self, up: Vec3) -> SplitVec3; -} -impl Vec3Ext for Vec3 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn split(self, up: Vec3) -> SplitVec3 { - let vertical = up * self.dot(up); - let horizontal = self - vertical; - SplitVec3 { - vertical, - horizontal, - } - } -} - -#[derive(Debug, Clone, Copy, PartialEq)] -pub(crate) struct SplitVec3 { - pub(crate) vertical: Vec3, - pub(crate) horizontal: Vec3, -} - -pub(crate) trait Vec2Ext: Copy { - fn is_approx_zero(self) -> bool; - fn x0y(self) -> Vec3; -} -impl Vec2Ext for Vec2 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn x0y(self) -> Vec3 { - Vec3::new(self.x, 0., self.y) - } -} - -pub(crate) trait MeshExt { - fn transform(&mut self, transform: Transform); - fn transformed(&self, transform: Transform) -> Mesh; - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]>; - fn search_in_children<'a>( - parent: Entity, - children: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)>; -} - -impl MeshExt for Mesh { - fn transform(&mut self, transform: Transform) { - for coords in self.read_coords_mut(Mesh::ATTRIBUTE_POSITION.clone()) { - let vec3 = (*coords).into(); - let transformed = transform.transform_point(vec3); - *coords = transformed.into(); - } - for normal in self.read_coords_mut(Mesh::ATTRIBUTE_NORMAL.clone()) { - let vec3 = (*normal).into(); - let transformed = transform.rotation.mul_vec3(vec3); - *normal = transformed.into(); - } - } - - fn transformed(&self, transform: Transform) -> Mesh { - let mut mesh = self.clone(); - mesh.transform(transform); - mesh - } - - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]> { - // Guaranteed by Bevy for the current usage - match self - .attribute_mut(id) - .expect("Failed to read unknown mesh attribute") - { - VertexAttributeValues::Float32x3(values) => values, - // Guaranteed by Bevy for the current usage - _ => unreachable!(), - } - } - - fn search_in_children<'a>( - parent: Entity, - children_query: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)> { - if let Ok(children) = children_query.get(parent) { - let mut result: Vec<_> = children - .iter() - .filter_map(|entity| mesh_handles.get(*entity).ok().map(|mesh| (*entity, mesh))) - .map(|(entity, mesh_handle)| { - ( - entity, - meshes - .get(mesh_handle) - .expect("Failed to get mesh from handle"), - ) - }) - .map(|(entity, mesh)| { - assert_eq!(mesh.primitive_topology(), PrimitiveTopology::TriangleList); - (entity, mesh) - }) - .collect(); - let mut inner_result = children - .iter() - .flat_map(|entity| { - Self::search_in_children(*entity, children_query, meshes, mesh_handles) - }) - .collect(); - result.append(&mut inner_result); - result - } else { - Vec::new() - } - } -} - -pub(crate) trait F32Ext: Copy { - fn is_approx_zero(self) -> bool; - fn squared(self) -> f32; - fn lerp(self, other: f32, ratio: f32) -> f32; -} - -impl F32Ext for f32 { - #[inline] - fn is_approx_zero(self) -> bool { - self.abs() < 1e-5 - } - - #[inline] - fn squared(self) -> f32 { - self * self - } - - #[inline] - fn lerp(self, other: f32, ratio: f32) -> f32 { - self.mul_add(1. - ratio, other * ratio) - } -} - -pub(crate) trait TransformExt: Copy { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform; - fn lerp(self, other: Transform, ratio: f32) -> Transform; -} - -impl TransformExt for Transform { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform { - let direction = target - self.translation; - let horizontal_direction = direction - up * direction.dot(up); - let look_target = self.translation + horizontal_direction; - self.looking_at(look_target, up) - } - - fn lerp(self, other: Transform, ratio: f32) -> Transform { - let translation = self.translation.lerp(other.translation, ratio); - let rotation = self.rotation.slerp(other.rotation, ratio); - let scale = self.scale.lerp(other.scale, ratio); - Transform { - translation, - rotation, - scale, - } - } -} diff --git a/examples/bevy_gltf_blueprints/basic/src/core/physics/utils_old.rs b/examples/bevy_gltf_blueprints/basic/src/core/physics/utils_old.rs deleted file mode 100644 index c210dd3..0000000 --- a/examples/bevy_gltf_blueprints/basic/src/core/physics/utils_old.rs +++ /dev/null @@ -1,75 +0,0 @@ -use bevy::prelude::*; -use bevy::render::mesh::{MeshVertexAttributeId, PrimitiveTopology, VertexAttributeValues}; -// TAKEN VERBATIB FROM https://github.com/janhohenheim/foxtrot/blob/6e31fc02652fc9d085a4adde0a73ab007dbbb0dc/src/util/trait_extension.rs - -pub trait Vec3Ext { - #[allow(clippy::wrong_self_convention)] // Because [`Vec3`] is [`Copy`] - fn is_approx_zero(self) -> bool; - fn x0z(self) -> Vec3; -} -impl Vec3Ext for Vec3 { - fn is_approx_zero(self) -> bool { - [self.x, self.y, self.z].iter().all(|&x| x.abs() < 1e-5) - } - fn x0z(self) -> Vec3 { - Vec3::new(self.x, 0., self.z) - } -} - -pub trait MeshExt { - fn transform(&mut self, transform: Transform); - fn transformed(&self, transform: Transform) -> Mesh; - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]>; - fn search_in_children<'a>( - children: &'a Children, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> (Entity, &'a Mesh); -} - -impl MeshExt for Mesh { - fn transform(&mut self, transform: Transform) { - for attribute in [Mesh::ATTRIBUTE_POSITION, Mesh::ATTRIBUTE_NORMAL] { - for coords in self.read_coords_mut(attribute.clone()) { - let vec3 = (*coords).into(); - let transformed = transform.transform_point(vec3); - *coords = transformed.into(); - } - } - } - - fn transformed(&self, transform: Transform) -> Mesh { - let mut mesh = self.clone(); - mesh.transform(transform); - mesh - } - - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]> { - match self.attribute_mut(id).unwrap() { - VertexAttributeValues::Float32x3(values) => values, - // Guaranteed by Bevy - _ => unreachable!(), - } - } - - fn search_in_children<'a>( - children: &'a Children, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> (Entity, &'a Mesh) { - let entity_handles: Vec<_> = children - .iter() - .filter_map(|entity| mesh_handles.get(*entity).ok().map(|mesh| (*entity, mesh))) - .collect(); - assert_eq!( - entity_handles.len(), - 1, - "Collider must contain exactly one mesh, but found {}", - entity_handles.len() - ); - let (entity, mesh_handle) = entity_handles.first().unwrap(); - let mesh = meshes.get(mesh_handle).unwrap(); - assert_eq!(mesh.primitive_topology(), PrimitiveTopology::TriangleList); - (*entity, mesh) - } -} diff --git a/examples/bevy_gltf_blueprints/basic/src/core/relationships/mod.rs b/examples/bevy_gltf_blueprints/basic/src/core/relationships/mod.rs deleted file mode 100644 index 4128453..0000000 --- a/examples/bevy_gltf_blueprints/basic/src/core/relationships/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub mod relationships_insert_dependant_components; -pub use relationships_insert_dependant_components::*; - -use bevy::prelude::*; - -pub struct EcsRelationshipsPlugin; -impl Plugin for EcsRelationshipsPlugin { - fn build(&self, app: &mut App) { - app; - } -} diff --git a/examples/bevy_gltf_blueprints/basic/src/core/relationships/relationships_insert_dependant_components.rs b/examples/bevy_gltf_blueprints/basic/src/core/relationships/relationships_insert_dependant_components.rs deleted file mode 100644 index 4e9ad17..0000000 --- a/examples/bevy_gltf_blueprints/basic/src/core/relationships/relationships_insert_dependant_components.rs +++ /dev/null @@ -1,15 +0,0 @@ -use bevy::prelude::*; - -pub fn insert_dependant_component< - Dependant: Component, - Dependency: Component + std::default::Default, ->( - mut commands: Commands, - entities_without_depency: Query<(Entity, &Name), (With, Without)>, -) { - for (entity, name) in entities_without_depency.iter() { - let name = name.clone().to_string(); - commands.entity(entity).insert(Dependency::default()); - warn!("found an entity called {} with a {} component but without an {}, please check your assets", name.clone(), std::any::type_name::(), std::any::type_name::()); - } -} diff --git a/examples/bevy_gltf_blueprints/basic/src/game/in_game.rs b/examples/bevy_gltf_blueprints/basic/src/game/in_game.rs index 2a077f7..390a5f9 100644 --- a/examples/bevy_gltf_blueprints/basic/src/game/in_game.rs +++ b/examples/bevy_gltf_blueprints/basic/src/game/in_game.rs @@ -1,10 +1,6 @@ use bevy::prelude::*; - -use crate::{ - assets::GameAssets, - state::{GameState, InAppRunning}, -}; use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag}; +use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning}; use bevy_rapier3d::prelude::Velocity; use rand::Rng; @@ -15,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/basic/src/game/in_main_menu.rs b/examples/bevy_gltf_blueprints/basic/src/game/in_main_menu.rs index cecd13a..c1a4b8b 100644 --- a/examples/bevy_gltf_blueprints/basic/src/game/in_main_menu.rs +++ b/examples/bevy_gltf_blueprints/basic/src/game/in_main_menu.rs @@ -1,6 +1,5 @@ use bevy::prelude::*; - -use crate::state::{AppState, GameState, InMainMenu}; +use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu}; pub fn setup_main_menu(mut commands: Commands) { commands.spawn((Camera2dBundle::default(), InMainMenu)); diff --git a/examples/bevy_gltf_blueprints/basic/src/game/mod.rs b/examples/bevy_gltf_blueprints/basic/src/game/mod.rs index 00689c2..b236141 100644 --- a/examples/bevy_gltf_blueprints/basic/src/game/mod.rs +++ b/examples/bevy_gltf_blueprints/basic/src/game/mod.rs @@ -4,113 +4,19 @@ pub use in_game::*; pub mod in_main_menu; pub use in_main_menu::*; -pub mod picking; -pub use picking::*; - -use crate::{ - insert_dependant_component, - state::{AppState, GameState}, -}; use bevy::prelude::*; -use bevy_rapier3d::prelude::*; - -// this file is just for demo purposes, contains various types of components, systems etc - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum SoundMaterial { - Metal, - Wood, - Rock, - Cloth, - Squishy, - #[default] - None, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Player; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo component showing auto injection of components -pub struct ShouldBeWithPlayer; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Interactible; - -fn player_move_demo( - keycode: Res>, - mut players: Query<&mut Transform, With>, -) { - let speed = 0.2; - if let Ok(mut player) = players.get_single_mut() { - if keycode.pressed(KeyCode::Left) { - player.translation.x += speed; - } - if keycode.pressed(KeyCode::Right) { - player.translation.x -= speed; - } - - if keycode.pressed(KeyCode::Up) { - player.translation.z += speed; - } - if keycode.pressed(KeyCode::Down) { - player.translation.z -= speed; - } - } -} - -// collision tests/debug -pub fn test_collision_events( - mut collision_events: EventReader, - mut contact_force_events: EventReader, -) { - for collision_event in collision_events.read() { - println!("collision"); - match collision_event { - CollisionEvent::Started(_entity1, _entity2, _) => { - println!("collision started") - } - CollisionEvent::Stopped(_entity1, _entity2, _) => { - println!("collision ended") - } - } - } - - for contact_force_event in contact_force_events.read() { - println!("Received contact force event: {:?}", contact_force_event); - } -} +use bevy_gltf_worlflow_examples_common::{AppState, GameState}; pub struct GamePlugin; impl Plugin for GamePlugin { fn build(&self, app: &mut App) { - app.add_plugins(PickingPlugin) - .register_type::() - .register_type::() - .register_type::() - // little helper utility, to automatically inject components that are dependant on an other component - // ie, here an Entity with a Player component should also always have a ShouldBeWithPlayer component - // you get a warning if you use this, as I consider this to be stop-gap solution (usually you should have either a bundle, or directly define all needed components) - .add_systems( - Update, - ( - // insert_dependant_component::, - player_move_demo, //.run_if(in_state(AppState::Running)), - // test_collision_events - spawn_test, - spawn_test_unregisted_components, - ) - .run_if(in_state(GameState::InGame)), - ) - .add_systems(OnEnter(AppState::MenuRunning), setup_main_menu) - .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); + app.add_systems( + Update, + (spawn_test, spawn_test_unregisted_components).run_if(in_state(GameState::InGame)), + ) + .add_systems(OnEnter(AppState::MenuRunning), setup_main_menu) + .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); } } diff --git a/examples/bevy_gltf_blueprints/basic/src/game/picking.rs b/examples/bevy_gltf_blueprints/basic/src/game/picking.rs deleted file mode 100644 index 6731bbb..0000000 --- a/examples/bevy_gltf_blueprints/basic/src/game/picking.rs +++ /dev/null @@ -1,34 +0,0 @@ -use super::Player; -use bevy::prelude::*; -use bevy_gltf_blueprints::GltfBlueprintsSet; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub struct Pickable; - -// very simple, crude picking (as in picking up objects) implementation - -pub fn picking( - players: Query<&GlobalTransform, With>, - pickables: Query<(Entity, &GlobalTransform), With>, - mut commands: Commands, -) { - for player_transforms in players.iter() { - for (pickable, pickable_transforms) in pickables.iter() { - let distance = player_transforms - .translation() - .distance(pickable_transforms.translation()); - if distance < 2.5 { - commands.entity(pickable).despawn_recursive(); - } - } - } -} - -pub struct PickingPlugin; -impl Plugin for PickingPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .add_systems(Update, (picking.after(GltfBlueprintsSet::AfterSpawn),)); - } -} diff --git a/examples/bevy_gltf_blueprints/basic/src/main.rs b/examples/bevy_gltf_blueprints/basic/src/main.rs index 6edba33..8fca426 100644 --- a/examples/bevy_gltf_blueprints/basic/src/main.rs +++ b/examples/bevy_gltf_blueprints/basic/src/main.rs @@ -1,15 +1,10 @@ use bevy::prelude::*; use bevy_editor_pls::prelude::*; +use bevy_gltf_worlflow_examples_common::CommonPlugin; mod core; use crate::core::*; -pub mod assets; -use assets::*; - -pub mod state; -use state::*; - mod game; use game::*; @@ -23,8 +18,7 @@ fn main() { // editor EditorPlugin::default(), // our custom plugins - StatePlugin, - AssetsPlugin, + CommonPlugin, CorePlugin, // reusable plugins GamePlugin, // specific to our game ComponentsTestPlugin, // Showcases different type of components /structs diff --git a/examples/bevy_gltf_blueprints/basic/src/state.rs b/examples/bevy_gltf_blueprints/basic/src/state.rs deleted file mode 100644 index 8e983d9..0000000 --- a/examples/bevy_gltf_blueprints/basic/src/state.rs +++ /dev/null @@ -1,54 +0,0 @@ -use bevy::app::AppExit; -use bevy::prelude::*; - -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, States)] -pub enum AppState { - #[default] - CoreLoading, - MenuRunning, - AppLoading, - AppRunning, - AppEnding, - - // FIXME: not sure - LoadingGame, -} - -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, States)] -pub enum GameState { - #[default] - None, - - InMenu, - InGame, - - InGameOver, - - InSaving, - InLoading, -} - -// tag components for all entities within a certain state (for despawning them if needed) , FIXME: seems kinda hack-ish -#[derive(Component)] -pub struct InCoreLoading; -#[derive(Component, Default)] -pub struct InMenuRunning; -#[derive(Component)] -pub struct InAppLoading; -#[derive(Component)] -pub struct InAppRunning; - -// components for tagging in game vs in game menu stuff -#[derive(Component, Default)] -pub struct InMainMenu; -#[derive(Component, Default)] -pub struct InMenu; -#[derive(Component, Default)] -pub struct InGame; - -pub struct StatePlugin; -impl Plugin for StatePlugin { - fn build(&self, app: &mut App) { - app.add_state::().add_state::(); - } -} diff --git a/examples/bevy_gltf_blueprints/basic/src/test_components.rs b/examples/bevy_gltf_blueprints/basic/src/test_components.rs index d0e6fbd..b5384e2 100644 --- a/examples/bevy_gltf_blueprints/basic/src/test_components.rs +++ b/examples/bevy_gltf_blueprints/basic/src/test_components.rs @@ -6,39 +6,39 @@ struct UnitTest; #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -struct TuppleTestF32(f32); +struct TupleTestF32(f32); #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -struct TuppleTestU64(u64); +struct TupleTestU64(u64); #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -pub struct TuppleTestStr(String); +pub struct TupleTestStr(String); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTest2(f32, u64, String); +struct TupleTest2(f32, u64, String); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTestBool(bool); +struct TupleTestBool(bool); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec2(Vec2); +struct TupleVec2(Vec2); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec3(Vec3); +struct TupleVec3(Vec3); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec(Vec); +struct TupleVec(Vec); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTestColor(Color); +struct TupleTestColor(Color); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] @@ -65,16 +65,16 @@ impl Plugin for ComponentsTestPlugin { fn build(&self, app: &mut App) { app.register_type::() .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() .register_type::() - .register_type::() - .register_type::() + .register_type::() + .register_type::() .register_type::>(); } } diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/Cargo.toml b/examples/bevy_gltf_blueprints/basic_scene_components/Cargo.toml deleted file mode 100644 index 65465e6..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "bevy_gltf_blueprints_basic_scene_components_example" -version = "0.3.0" -edition = "2021" -license = "MIT OR Apache-2.0" - -[dependencies] -bevy="0.12" -bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" } -bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] } -bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]} -bevy_editor_pls = { version = "0.6" } -rand = "0.8.5" diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/README.md b/examples/bevy_gltf_blueprints/basic_scene_components/README.md deleted file mode 100644 index ac2dd21..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/README.md +++ /dev/null @@ -1,11 +0,0 @@ -# Basic scene components demo - -This example showcases the use of "scene" components ie components that are injected into the root scene/level so that you can control things -like ambient lighting, bloom, shadowmap resolution, & ao directly from Blender. - -## Running this example - -``` -cargo run --features bevy/dynamic_linking -``` - diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/assets/assets_core.assets.ron b/examples/bevy_gltf_blueprints/basic_scene_components/assets/assets_core.assets.ron deleted file mode 100644 index 8d0a099..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/assets/assets_core.assets.ron +++ /dev/null @@ -1 +0,0 @@ -({}) \ No newline at end of file diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/assets/assets_game.assets.ron b/examples/bevy_gltf_blueprints/basic_scene_components/assets/assets_game.assets.ron deleted file mode 100644 index 5b1e969..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/assets/assets_game.assets.ron +++ /dev/null @@ -1,6 +0,0 @@ -({ - "world":File (path: "models/World.glb"), - "models": Folder ( - path: "models/library", - ), -}) \ No newline at end of file diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/World.glb b/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/World.glb deleted file mode 100644 index 3ecc7c2..0000000 Binary files a/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/World.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/library/Container.glb b/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/library/Container.glb deleted file mode 100644 index 72ff5ca..0000000 Binary files a/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/library/Container.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/library/Health_Pickup.glb b/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/library/Health_Pickup.glb deleted file mode 100644 index 4643320..0000000 Binary files a/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/library/Health_Pickup.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/library/MagicTeapot.glb b/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/library/MagicTeapot.glb deleted file mode 100644 index 7a7020b..0000000 Binary files a/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/library/MagicTeapot.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/library/Pillar.glb b/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/library/Pillar.glb deleted file mode 100644 index 891122c..0000000 Binary files a/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/library/Pillar.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/library/Player.glb b/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/library/Player.glb deleted file mode 100644 index a7ef15f..0000000 Binary files a/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/library/Player.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/library/Unused_in_level_test.glb b/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/library/Unused_in_level_test.glb deleted file mode 100644 index b5937bb..0000000 Binary files a/examples/bevy_gltf_blueprints/basic_scene_components/assets/models/library/Unused_in_level_test.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/assets/scene_components.bin b/examples/bevy_gltf_blueprints/basic_scene_components/assets/scene_components.bin deleted file mode 100644 index 4c8e88c..0000000 Binary files a/examples/bevy_gltf_blueprints/basic_scene_components/assets/scene_components.bin and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/assets/scene_components.blend b/examples/bevy_gltf_blueprints/basic_scene_components/assets/scene_components.blend deleted file mode 100644 index 96f0b19..0000000 Binary files a/examples/bevy_gltf_blueprints/basic_scene_components/assets/scene_components.blend and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/assets/scene_components.gltf b/examples/bevy_gltf_blueprints/basic_scene_components/assets/scene_components.gltf deleted file mode 100644 index 84e2fda..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/assets/scene_components.gltf +++ /dev/null @@ -1,1752 +0,0 @@ -{ - "asset":{ - "generator":"Khronos glTF Blender I/O v4.0.43", - "version":"2.0" - }, - "extensionsUsed":[ - "KHR_lights_punctual", - "KHR_materials_emissive_strength" - ], - "extensionsRequired":[ - "KHR_lights_punctual" - ], - "extensions":{ - "KHR_lights_punctual":{ - "lights":[ - { - "color":[ - 1, - 0.8328787684440613, - 0.48654258251190186 - ], - "intensity":17075, - "type":"directional", - "name":"Light" - } - ] - } - }, - "scene":0, - "scenes":[ - { - "extras":{ - "skinify":{ - "connect_mesh":0, - "connect_parents":0, - "generate_all":0, - "thickness":0.800000011920929, - "finger_thickness":0.25, - "apply_mod":1, - "parent_armature":1, - "sub_level":1 - }, - "changedScene":"Scene", - "foo":"blabla", - "changedObjects":[], - "auto_gltfExportSettings":{ - "export_output_folder":"models", - "main_scene_names":[ - "World" - ], - "library_scene_names":[ - "Library" - ] - } - }, - "name":"World", - "nodes":[ - 0, - 5, - 6, - 7, - 11, - 15, - 20, - 23, - 27, - 28, - 31, - 36, - 40, - 44, - 48, - 52, - 53 - ] - } - ], - "nodes":[ - { - "camera":0, - "extras":{ - "CameraTrackingOffset":[ - 26.0, - 48.0, - -26.0 - ], - "Saveable":"" - }, - "name":"Camera", - "rotation":[ - -0.38303452730178833, - -0.4371166229248047, - -0.21319502592086792, - 0.7853416800498962 - ], - "translation":[ - -37.79844665527344, - 57.50745391845703, - 26.346900939941406 - ] - }, - { - "mesh":0, - "name":"Container.005" - }, - { - "extras":{ - "RigidBodyProxy":"Fixed" - }, - "name":"container_components" - }, - { - "extras":{ - "Collider":"Mesh" - }, - "mesh":1, - "name":"container_collider", - "scale":[ - 1.1186447143554688, - 1.1186447143554688, - 1.1186447143554688 - ], - "translation":[ - 0, - -0.10222256183624268, - 0 - ] - }, - { - "extras":{ - "Sensor":"", - "Collider":"Mesh" - }, - "mesh":2, - "name":"container_sensor", - "scale":[ - 1.1186447143554688, - 1.1186447143554688, - 1.1186447143554688 - ], - "translation":[ - 0, - -0.10222256183624268, - 0 - ] - }, - { - "children":[ - 1, - 2, - 3, - 4 - ], - "extras":{ - "Pickable":"", - "Saveable":"" - }, - "name":"Container.001", - "translation":[ - -14.426772117614746, - 0.7828251123428345, - 6.00043249130249 - ] - }, - { - "extras":{ - "Collider":"Mesh" - }, - "mesh":3, - "name":"Ground", - "scale":[ - 0.9353691935539246, - 0.4676845967769623, - 0.9353691935539246 - ] - }, - { - "extensions":{ - "KHR_lights_punctual":{ - "light":0 - } - }, - "name":"Light", - "rotation":[ - -0.44001275300979614, - 0.6989604234695435, - 0.4932750165462494, - 0.27298879623413086 - ], - "translation":[ - 4.076245307922363, - 18.686649322509766, - -1.0054539442062378 - ] - }, - { - "mesh":4, - "name":"Pillar_geometry", - "translation":[ - 2.1457672119140625e-06, - 0, - 0 - ] - }, - { - "extras":{ - "Collider":"Mesh", - "RigidBody":"Fixed" - }, - "name":"Pillar_components", - "translation":[ - 2.1457672119140625e-06, - 0, - 0 - ] - }, - { - "mesh":5, - "name":"Pillar_collider", - "translation":[ - 2.1457672119140625e-06, - 0, - 0 - ] - }, - { - "children":[ - 8, - 9, - 10 - ], - "name":"Pillar.001", - "rotation":[ - -0.16778354346752167, - -0.15213392674922943, - 0.12012217193841934, - 0.9665788412094116 - ], - "translation":[ - 23.445295333862305, - -1.4132944345474243, - -1.1635456085205078 - ] - }, - { - "mesh":4, - "name":"Pillar_geometry" - }, - { - "extras":{ - "Collider":"Mesh", - "RigidBody":"Fixed" - }, - "name":"Pillar_components" - }, - { - "mesh":5, - "name":"Pillar_collider" - }, - { - "children":[ - 12, - 13, - 14 - ], - "name":"Pillar.002", - "translation":[ - 12.394309997558594, - 0, - 11.361231803894043 - ] - }, - { - "mesh":6, - "name":"player_geometry", - "scale":[ - 0.666326105594635, - 0.666326105594635, - 0.666326105594635 - ] - }, - { - "extras":{ - "Player":"", - "CameraTrackable":"", - "SoundMaterial":"Wood", - "Saveable":"" - }, - "name":"player_components" - }, - { - "extras":{ - "Collider":"Mesh" - }, - "mesh":7, - "name":"player_collider" - }, - { - "extras":{ - "Sensor":"", - "Collider":"Mesh" - }, - "mesh":8, - "name":"player_sensor" - }, - { - "children":[ - 16, - 17, - 18, - 19 - ], - "name":"Player", - "translation":[ - 0, - 1.024839997291565, - 0 - ] - }, - { - "mesh":9, - "name":"Health_Pickup_geometry" - }, - { - "extras":{ - "Healer":"(amount:20)", - "Collider":"Capsule( (x:0.0, y:-1.1, z:0.0) , (x: 0.0, y:1.1, z:0.0), 0.5 )", - "Saveable":"", - "Pickable":"", - "RigidBody":"Dynamic" - }, - "name":"Health_Pickup_components" - }, - { - "children":[ - 21, - 22 - ], - "name":"Health_Pickup.001", - "translation":[ - 4.697511196136475, - 1.5506305694580078, - 8.962273597717285 - ] - }, - { - "mesh":10, - "name":"Geometry", - "scale":[ - 0.45072945952415466, - 0.45072945952415466, - 0.45072945952415466 - ], - "translation":[ - 0, - -0.5528948307037354, - 0 - ] - }, - { - "extras":{ - "RigidBody":"Dynamic", - "Saveable":"" - }, - "name":"teapot_components" - }, - { - "extras":{ - "Collider":"Mesh" - }, - "mesh":11, - "name":"teapot_collider", - "translation":[ - 0, - 0.371091365814209, - -0.4852890968322754 - ] - }, - { - "children":[ - 24, - 25, - 26 - ], - "name":"MagicTeapot.001", - "translation":[ - 3.6351966857910156, - 3.872074604034424, - -7.313272953033447 - ] - }, - { - "mesh":12, - "name":"Cube", - "scale":[ - 3.8055825233459473, - 3.8055825233459473, - 3.8055825233459473 - ], - "translation":[ - -14.974735260009766, - 13.351404190063477, - -17.45383644104004 - ] - }, - { - "mesh":9, - "name":"Health_Pickup_geometry" - }, - { - "extras":{ - "Healer":"(amount:20)", - "Collider":"Capsule( (x:0.0, y:-1.1, z:0.0) , (x: 0.0, y:1.1, z:0.0), 0.5 )", - "Saveable":"", - "Pickable":"", - "RigidBody":"Dynamic" - }, - "name":"Health_Pickup_components" - }, - { - "children":[ - 29, - 30 - ], - "name":"Health_Pickup.002", - "translation":[ - -1.2373764514923096, - 1.9034390449523926, - -14.737571716308594 - ] - }, - { - "mesh":0, - "name":"Container.005" - }, - { - "extras":{ - "RigidBodyProxy":"Fixed" - }, - "name":"container_components" - }, - { - "extras":{ - "Collider":"Mesh" - }, - "mesh":1, - "name":"container_collider", - "scale":[ - 1.1186447143554688, - 1.1186447143554688, - 1.1186447143554688 - ], - "translation":[ - 0, - -0.10222259163856506, - 0 - ] - }, - { - "extras":{ - "Sensor":"", - "Collider":"Mesh" - }, - "mesh":2, - "name":"container_sensor", - "scale":[ - 1.1186447143554688, - 1.1186447143554688, - 1.1186447143554688 - ], - "translation":[ - 0, - -0.10222259163856506, - 0 - ] - }, - { - "children":[ - 32, - 33, - 34, - 35 - ], - "extras":{ - "Pickable":"", - "Saveable":"" - }, - "name":"Container.002", - "translation":[ - -21.397857666015625, - 0.3833189010620117, - -0.32418346405029297 - ] - }, - { - "mesh":4, - "name":"Pillar_geometry" - }, - { - "extras":{ - "Collider":"Mesh", - "RigidBody":"Fixed" - }, - "name":"Pillar_components" - }, - { - "mesh":5, - "name":"Pillar_collider" - }, - { - "children":[ - 37, - 38, - 39 - ], - "name":"Pillar.003", - "translation":[ - 10.687894821166992, - -1.161834716796875, - -21.835617065429688 - ] - }, - { - "mesh":4, - "name":"Pillar_geometry" - }, - { - "extras":{ - "Collider":"Mesh", - "RigidBody":"Fixed" - }, - "name":"Pillar_components" - }, - { - "mesh":5, - "name":"Pillar_collider" - }, - { - "children":[ - 41, - 42, - 43 - ], - "name":"Pillar.004", - "rotation":[ - 0.0626998022198677, - 0.056851621717214584, - -0.04488899186253548, - 0.9954002499580383 - ], - "translation":[ - -6.337947845458984, - -1.161834716796875, - -19.345294952392578 - ] - }, - { - "mesh":4, - "name":"Pillar_geometry" - }, - { - "extras":{ - "Collider":"Mesh", - "RigidBody":"Fixed" - }, - "name":"Pillar_components" - }, - { - "mesh":5, - "name":"Pillar_collider" - }, - { - "children":[ - 45, - 46, - 47 - ], - "name":"Pillar.005", - "rotation":[ - -0.10973918437957764, - -0.13786573708057404, - 0.13505353033542633, - 0.9750440716743469 - ], - "scale":[ - 0.5077471733093262, - 0.5077471733093262, - 0.507747232913971 - ], - "translation":[ - -8.707667350769043, - 1.5589470863342285, - -10.38162899017334 - ] - }, - { - "mesh":4, - "name":"Pillar_geometry" - }, - { - "extras":{ - "Collider":"Mesh", - "RigidBody":"Fixed" - }, - "name":"Pillar_components" - }, - { - "mesh":5, - "name":"Pillar_collider" - }, - { - "children":[ - 49, - 50, - 51 - ], - "name":"Pillar.056", - "rotation":[ - 0.11627969890832901, - 0.14539803564548492, - -0.14209510385990143, - 0.9721870422363281 - ], - "scale":[ - 1.9112937450408936, - 1.9112941026687622, - 1.911293864250183 - ], - "translation":[ - -8.150419235229492, - 1.558946132659912, - 13.774781227111816 - ] - }, - { - "extras":{ - "AmbientLightP":"( color:[0.0, 0.0, 0.0, 0.0], brightness:0.5)", - "TuppleTestColor":[ - 1.0, - 0.07497033476829529, - 0.11196978390216827, - 1.0 - ] - }, - "name":"lighting_components", - "scale":[ - 0, - 0, - 0 - ] - } - ], - "cameras":[ - { - "name":"Camera", - "perspective":{ - "aspectRatio":1.7777777777777777, - "yfov":0.39959652046304894, - "zfar":100, - "znear":0.10000000149011612 - }, - "type":"perspective" - } - ], - "materials":[ - { - "doubleSided":true, - "name":"Env_blue", - "pbrMetallicRoughness":{ - "baseColorFactor":[ - 0.001640412723645568, - 0.09032226353883743, - 0.8000000715255737, - 1 - ], - "metallicFactor":0, - "roughnessFactor":0.5 - } - }, - { - "alphaMode":"BLEND", - "doubleSided":true, - "name":"Collider_material", - "pbrMetallicRoughness":{ - "baseColorFactor":[ - 0.8000000715255737, - 0.6398285031318665, - 0.6603161692619324, - 0.1595744490623474 - ], - "metallicFactor":0, - "roughnessFactor":0.5 - } - }, - { - "alphaMode":"BLEND", - "doubleSided":true, - "name":"Sensor_material", - "pbrMetallicRoughness":{ - "baseColorFactor":[ - 0.8000000715255737, - 0.3992782533168793, - 0.3992782533168793, - 0.1595744490623474 - ], - "metallicFactor":0, - "roughnessFactor":0.5 - } - }, - { - "doubleSided":true, - "name":"Material.005", - "pbrMetallicRoughness":{ - "baseColorFactor":[ - 0.22025755047798157, - 0.22025755047798157, - 0.22025755047798157, - 1 - ], - "metallicFactor":0, - "roughnessFactor":0.5 - } - }, - { - "doubleSided":true, - "name":"Env_orange", - "pbrMetallicRoughness":{ - "baseColorFactor":[ - 0.8000000715255737, - 0.23425878584384918, - 0, - 1 - ], - "metallicFactor":0, - "roughnessFactor":0.5 - } - }, - { - "doubleSided":true, - "emissiveFactor":[ - 0.03310476616024971, - 1, - 1 - ], - "extensions":{ - "KHR_materials_emissive_strength":{ - "emissiveStrength":157.59999084472656 - } - }, - "extras":{ - "prop":"1.0" - }, - "name":"Glowy", - "pbrMetallicRoughness":{ - "baseColorFactor":[ - 0.3805106282234192, - 0.8000000715255737, - 0.27123215794563293, - 1 - ], - "metallicFactor":0, - "roughnessFactor":0.5 - } - } - ], - "meshes":[ - { - "name":"Cube.013", - "primitives":[ - { - "attributes":{ - "POSITION":0, - "NORMAL":1, - "TEXCOORD_0":2, - "TANGENT":3 - }, - "indices":4, - "material":0 - } - ] - }, - { - "name":"Cube.001", - "primitives":[ - { - "attributes":{ - "POSITION":5, - "NORMAL":6, - "TEXCOORD_0":7, - "TANGENT":8 - }, - "indices":4, - "material":1 - } - ] - }, - { - "name":"Cube.003", - "primitives":[ - { - "attributes":{ - "POSITION":9, - "NORMAL":10, - "TEXCOORD_0":11, - "TANGENT":12 - }, - "indices":4, - "material":2 - } - ] - }, - { - "name":"Plane", - "primitives":[ - { - "attributes":{ - "POSITION":13, - "NORMAL":14, - "TEXCOORD_0":15, - "TANGENT":16 - }, - "indices":17, - "material":3 - } - ] - }, - { - "name":"Cube.009", - "primitives":[ - { - "attributes":{ - "POSITION":18, - "NORMAL":19, - "TEXCOORD_0":20, - "TANGENT":21 - }, - "indices":4, - "material":4 - } - ] - }, - { - "name":"Cube.005", - "primitives":[ - { - "attributes":{ - "POSITION":22, - "NORMAL":23, - "TEXCOORD_0":24, - "TANGENT":25 - }, - "indices":4, - "material":1 - } - ] - }, - { - "extras":{ - "Roundcube":true, - "change":false, - "radius":0.5, - "size":[ - 0.0, - 0.0, - 3.0 - ], - "arc_div":4, - "lin_div":0.0, - "div_type":"CORNERS", - "odd_axis_align":false, - "no_limit":false - }, - "name":"Roundcube.001", - "primitives":[ - { - "attributes":{ - "POSITION":26, - "NORMAL":27 - }, - "indices":28, - "material":0 - } - ] - }, - { - "extras":{ - "Roundcube":true, - "change":false, - "radius":0.5, - "size":[ - 0.0, - 0.0, - 3.0 - ], - "arc_div":4, - "lin_div":0.0, - "div_type":"CORNERS", - "odd_axis_align":false, - "no_limit":false - }, - "name":"Roundcube.002", - "primitives":[ - { - "attributes":{ - "POSITION":29, - "NORMAL":30 - }, - "indices":28, - "material":1 - } - ] - }, - { - "extras":{ - "Roundcube":true, - "change":false, - "radius":0.5, - "size":[ - 0.0, - 0.0, - 3.0 - ], - "arc_div":4, - "lin_div":0.0, - "div_type":"CORNERS", - "odd_axis_align":false, - "no_limit":false - }, - "name":"Roundcube.003", - "primitives":[ - { - "attributes":{ - "POSITION":31, - "NORMAL":32, - "TEXCOORD_0":33 - }, - "indices":34, - "material":2 - } - ] - }, - { - "extras":{ - "Roundcube":true, - "change":false, - "radius":0.6000000238418579, - "size":[ - 0.0, - 0.0, - 3.0 - ], - "arc_div":2, - "lin_div":0.0, - "div_type":"CORNERS", - "odd_axis_align":false, - "no_limit":false - }, - "name":"Roundcube", - "primitives":[ - { - "attributes":{ - "POSITION":35, - "NORMAL":36 - }, - "indices":37, - "material":5 - } - ] - }, - { - "name":"Teapot", - "primitives":[ - { - "attributes":{ - "POSITION":38, - "NORMAL":39 - }, - "indices":40 - } - ] - }, - { - "name":"Icosphere", - "primitives":[ - { - "attributes":{ - "POSITION":41, - "NORMAL":42, - "TEXCOORD_0":43, - "TANGENT":44 - }, - "indices":45, - "material":1 - } - ] - }, - { - "name":"Cube.002", - "primitives":[ - { - "attributes":{ - "POSITION":46, - "NORMAL":47, - "TEXCOORD_0":48, - "TANGENT":49 - }, - "indices":4 - } - ] - } - ], - "accessors":[ - { - "bufferView":0, - "componentType":5126, - "count":24, - "max":[ - 1, - 2, - 1 - ], - "min":[ - -1, - 0, - -1 - ], - "type":"VEC3" - }, - { - "bufferView":1, - "componentType":5126, - "count":24, - "type":"VEC3" - }, - { - "bufferView":2, - "componentType":5126, - "count":24, - "type":"VEC2" - }, - { - "bufferView":3, - "componentType":5126, - "count":24, - "type":"VEC4" - }, - { - "bufferView":4, - "componentType":5123, - "count":36, - "type":"SCALAR" - }, - { - "bufferView":5, - "componentType":5126, - "count":24, - "max":[ - 1, - 2, - 1 - ], - "min":[ - -1, - 0, - -1 - ], - "type":"VEC3" - }, - { - "bufferView":6, - "componentType":5126, - "count":24, - "type":"VEC3" - }, - { - "bufferView":7, - "componentType":5126, - "count":24, - "type":"VEC2" - }, - { - "bufferView":8, - "componentType":5126, - "count":24, - "type":"VEC4" - }, - { - "bufferView":9, - "componentType":5126, - "count":24, - "max":[ - 2.2210752964019775, - 3.2210755348205566, - 2.2210752964019775 - ], - "min":[ - -2.2210752964019775, - -1.2210750579833984, - -2.2210752964019775 - ], - "type":"VEC3" - }, - { - "bufferView":10, - "componentType":5126, - "count":24, - "type":"VEC3" - }, - { - "bufferView":11, - "componentType":5126, - "count":24, - "type":"VEC2" - }, - { - "bufferView":12, - "componentType":5126, - "count":24, - "type":"VEC4" - }, - { - "bufferView":13, - "componentType":5126, - "count":4, - "max":[ - 50, - 0, - 50 - ], - "min":[ - -50, - 0, - -50 - ], - "type":"VEC3" - }, - { - "bufferView":14, - "componentType":5126, - "count":4, - "type":"VEC3" - }, - { - "bufferView":15, - "componentType":5126, - "count":4, - "type":"VEC2" - }, - { - "bufferView":16, - "componentType":5126, - "count":4, - "type":"VEC4" - }, - { - "bufferView":17, - "componentType":5123, - "count":6, - "type":"SCALAR" - }, - { - "bufferView":18, - "componentType":5126, - "count":24, - "max":[ - 1, - 7, - 1 - ], - "min":[ - -1, - 0, - -1 - ], - "type":"VEC3" - }, - { - "bufferView":19, - "componentType":5126, - "count":24, - "type":"VEC3" - }, - { - "bufferView":20, - "componentType":5126, - "count":24, - "type":"VEC2" - }, - { - "bufferView":21, - "componentType":5126, - "count":24, - "type":"VEC4" - }, - { - "bufferView":22, - "componentType":5126, - "count":24, - "max":[ - 1, - 7, - 1 - ], - "min":[ - -1, - 0, - -1 - ], - "type":"VEC3" - }, - { - "bufferView":23, - "componentType":5126, - "count":24, - "type":"VEC3" - }, - { - "bufferView":24, - "componentType":5126, - "count":24, - "type":"VEC2" - }, - { - "bufferView":25, - "componentType":5126, - "count":24, - "type":"VEC4" - }, - { - "bufferView":26, - "componentType":5126, - "count":448, - "max":[ - 0.5, - 1.5, - 0.5 - ], - "min":[ - -0.5, - -1.5, - -0.5 - ], - "type":"VEC3" - }, - { - "bufferView":27, - "componentType":5126, - "count":448, - "type":"VEC3" - }, - { - "bufferView":28, - "componentType":5123, - "count":672, - "type":"SCALAR" - }, - { - "bufferView":29, - "componentType":5126, - "count":448, - "max":[ - 0.34540826082229614, - 1.0362248420715332, - 0.34540826082229614 - ], - "min":[ - -0.34540826082229614, - -1.0362248420715332, - -0.34540826082229614 - ], - "type":"VEC3" - }, - { - "bufferView":30, - "componentType":5126, - "count":448, - "type":"VEC3" - }, - { - "bufferView":31, - "componentType":5126, - "count":54, - "max":[ - 1.8612866401672363, - 0.9900000095367432, - 1.7760189771652222 - ], - "min":[ - -1.8612866401672363, - -0.9900000095367432, - -1.8899999856948853 - ], - "type":"VEC3" - }, - { - "bufferView":32, - "componentType":5126, - "count":54, - "type":"VEC3" - }, - { - "bufferView":33, - "componentType":5126, - "count":54, - "type":"VEC2" - }, - { - "bufferView":34, - "componentType":5123, - "count":96, - "type":"SCALAR" - }, - { - "bufferView":35, - "componentType":5126, - "count":128, - "max":[ - 0.5, - 1.5, - 0.5 - ], - "min":[ - -0.5, - -1.5, - -0.5 - ], - "type":"VEC3" - }, - { - "bufferView":36, - "componentType":5126, - "count":128, - "type":"VEC3" - }, - { - "bufferView":37, - "componentType":5123, - "count":192, - "type":"SCALAR" - }, - { - "bufferView":38, - "componentType":5126, - "count":496, - "max":[ - 3.4281253814697266, - 3.1500000953674316, - 2 - ], - "min":[ - -3, - 0, - -2 - ], - "type":"VEC3" - }, - { - "bufferView":39, - "componentType":5126, - "count":496, - "type":"VEC3" - }, - { - "bufferView":40, - "componentType":5123, - "count":720, - "type":"SCALAR" - }, - { - "bufferView":41, - "componentType":5126, - "count":240, - "max":[ - 1.6461009979248047, - 1.7308106422424316, - 1.730810523033142 - ], - "min":[ - -1.6461009979248047, - -1.7308106422424316, - -1.730810523033142 - ], - "type":"VEC3" - }, - { - "bufferView":42, - "componentType":5126, - "count":240, - "type":"VEC3" - }, - { - "bufferView":43, - "componentType":5126, - "count":240, - "type":"VEC2" - }, - { - "bufferView":44, - "componentType":5126, - "count":240, - "type":"VEC4" - }, - { - "bufferView":45, - "componentType":5123, - "count":240, - "type":"SCALAR" - }, - { - "bufferView":46, - "componentType":5126, - "count":24, - "max":[ - 1, - 1, - 1 - ], - "min":[ - -1, - -1, - -1 - ], - "type":"VEC3" - }, - { - "bufferView":47, - "componentType":5126, - "count":24, - "type":"VEC3" - }, - { - "bufferView":48, - "componentType":5126, - "count":24, - "type":"VEC2" - }, - { - "bufferView":49, - "componentType":5126, - "count":24, - "type":"VEC4" - } - ], - "bufferViews":[ - { - "buffer":0, - "byteLength":288, - "byteOffset":0, - "target":34962 - }, - { - "buffer":0, - "byteLength":288, - "byteOffset":288, - "target":34962 - }, - { - "buffer":0, - "byteLength":192, - "byteOffset":576, - "target":34962 - }, - { - "buffer":0, - "byteLength":384, - "byteOffset":768, - "target":34962 - }, - { - "buffer":0, - "byteLength":72, - "byteOffset":1152, - "target":34963 - }, - { - "buffer":0, - "byteLength":288, - "byteOffset":1224, - "target":34962 - }, - { - "buffer":0, - "byteLength":288, - "byteOffset":1512, - "target":34962 - }, - { - "buffer":0, - "byteLength":192, - "byteOffset":1800, - "target":34962 - }, - { - "buffer":0, - "byteLength":384, - "byteOffset":1992, - "target":34962 - }, - { - "buffer":0, - "byteLength":288, - "byteOffset":2376, - "target":34962 - }, - { - "buffer":0, - "byteLength":288, - "byteOffset":2664, - "target":34962 - }, - { - "buffer":0, - "byteLength":192, - "byteOffset":2952, - "target":34962 - }, - { - "buffer":0, - "byteLength":384, - "byteOffset":3144, - "target":34962 - }, - { - "buffer":0, - "byteLength":48, - "byteOffset":3528, - "target":34962 - }, - { - "buffer":0, - "byteLength":48, - "byteOffset":3576, - "target":34962 - }, - { - "buffer":0, - "byteLength":32, - "byteOffset":3624, - "target":34962 - }, - { - "buffer":0, - "byteLength":64, - "byteOffset":3656, - "target":34962 - }, - { - "buffer":0, - "byteLength":12, - "byteOffset":3720, - "target":34963 - }, - { - "buffer":0, - "byteLength":288, - "byteOffset":3732, - "target":34962 - }, - { - "buffer":0, - "byteLength":288, - "byteOffset":4020, - "target":34962 - }, - { - "buffer":0, - "byteLength":192, - "byteOffset":4308, - "target":34962 - }, - { - "buffer":0, - "byteLength":384, - "byteOffset":4500, - "target":34962 - }, - { - "buffer":0, - "byteLength":288, - "byteOffset":4884, - "target":34962 - }, - { - "buffer":0, - "byteLength":288, - "byteOffset":5172, - "target":34962 - }, - { - "buffer":0, - "byteLength":192, - "byteOffset":5460, - "target":34962 - }, - { - "buffer":0, - "byteLength":384, - "byteOffset":5652, - "target":34962 - }, - { - "buffer":0, - "byteLength":5376, - "byteOffset":6036, - "target":34962 - }, - { - "buffer":0, - "byteLength":5376, - "byteOffset":11412, - "target":34962 - }, - { - "buffer":0, - "byteLength":1344, - "byteOffset":16788, - "target":34963 - }, - { - "buffer":0, - "byteLength":5376, - "byteOffset":18132, - "target":34962 - }, - { - "buffer":0, - "byteLength":5376, - "byteOffset":23508, - "target":34962 - }, - { - "buffer":0, - "byteLength":648, - "byteOffset":28884, - "target":34962 - }, - { - "buffer":0, - "byteLength":648, - "byteOffset":29532, - "target":34962 - }, - { - "buffer":0, - "byteLength":432, - "byteOffset":30180, - "target":34962 - }, - { - "buffer":0, - "byteLength":192, - "byteOffset":30612, - "target":34963 - }, - { - "buffer":0, - "byteLength":1536, - "byteOffset":30804, - "target":34962 - }, - { - "buffer":0, - "byteLength":1536, - "byteOffset":32340, - "target":34962 - }, - { - "buffer":0, - "byteLength":384, - "byteOffset":33876, - "target":34963 - }, - { - "buffer":0, - "byteLength":5952, - "byteOffset":34260, - "target":34962 - }, - { - "buffer":0, - "byteLength":5952, - "byteOffset":40212, - "target":34962 - }, - { - "buffer":0, - "byteLength":1440, - "byteOffset":46164, - "target":34963 - }, - { - "buffer":0, - "byteLength":2880, - "byteOffset":47604, - "target":34962 - }, - { - "buffer":0, - "byteLength":2880, - "byteOffset":50484, - "target":34962 - }, - { - "buffer":0, - "byteLength":1920, - "byteOffset":53364, - "target":34962 - }, - { - "buffer":0, - "byteLength":3840, - "byteOffset":55284, - "target":34962 - }, - { - "buffer":0, - "byteLength":480, - "byteOffset":59124, - "target":34963 - }, - { - "buffer":0, - "byteLength":288, - "byteOffset":59604, - "target":34962 - }, - { - "buffer":0, - "byteLength":288, - "byteOffset":59892, - "target":34962 - }, - { - "buffer":0, - "byteLength":192, - "byteOffset":60180, - "target":34962 - }, - { - "buffer":0, - "byteLength":384, - "byteOffset":60372, - "target":34962 - } - ], - "buffers":[ - { - "byteLength":60756, - "uri":"scene_components.bin" - } - ] -} diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/assets/scenes/save.scn.ron b/examples/bevy_gltf_blueprints/basic_scene_components/assets/scenes/save.scn.ron deleted file mode 100644 index ed30389..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/assets/scenes/save.scn.ron +++ /dev/null @@ -1,485 +0,0 @@ -( - resources: {}, - entities: { - 20: ( - components: { - "bevy_render::camera::projection::Projection": Perspective(( - fov: 0.3995965, - aspect_ratio: 1.7777778, - near: 0.1, - far: 100.0, - )), - "bevy_render::primitives::Frustum": (), - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 34.821884, - y: 49.024857, - z: -36.79615, - ), - rotation: (-0.1694689, 0.82838506, 0.40884802, 0.3433684), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core_pipeline::tonemapping::Tonemapping": BlenderFilmic, - "bevy_core_pipeline::tonemapping::DebandDither": Enabled, - "bevy_render::view::ColorGrading": ( - exposure: 0.0, - gamma: 1.0, - pre_saturation: 1.0, - post_saturation: 1.0, - ), - "bevy_core::name::Name": ( - hash: 17702508670109176045, - name: "Camera", - ), - "advanced::core::camera::camera_tracking::CameraTrackingOffset": (( - x: 26.0, - y: 48.0, - z: -26.0, - )), - "bevy_pbr::light::ClusterConfig": FixedZ( - total: 4096, - z_slices: 24, - z_config: ( - first_slice_depth: 5.0, - far_z_mode: MaxLightRange, - ), - dynamic_resizing: true, - ), - "bevy_core_pipeline::bloom::settings::BloomSettings": ( - intensity: 0.01, - low_frequency_boost: 0.7, - low_frequency_boost_curvature: 0.95, - high_pass_frequency: 1.0, - prefilter_settings: ( - threshold: 0.0, - threshold_softness: 0.0, - ), - composite_mode: Additive, - ), - }, - ), - 34: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 4.697565, - y: 1.5983224, - z: 8.962274, - ), - rotation: (0.000000000000000031724054, -0.00000000000000000000647681, -0.000013119204, 1.0), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 9837288155836662016, - name: "Health_Pickup.001", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "advanced::game::picking::Pickable": (), - }, - ), - 54: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 8.799996, - y: 1.02484, - z: -10.799994, - ), - rotation: (0.0, 0.0, 0.0, 1.0), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 17978181434632022651, - name: "Player", - ), - "advanced::core::camera::camera_tracking::CameraTrackable": (), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Player"), - "advanced::game::Player": (), - "advanced::game::SoundMaterial": Wood, - }, - ), - 60: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 3.6351967, - y: 1.7298106, - z: -7.313273, - ), - rotation: (0.0, 0.0, 0.0, 1.0), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 7225506896223411979, - name: "MagicTeapot.001", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("MagicTeapot"), - }, - ), - 64: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -4.6068983, - y: 1.5983224, - z: -10.579347, - ), - rotation: (0.000000000000000031724054, 0.00000000000000000000647681, 0.000013119204, 1.0), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 3089896164553476909, - name: "Health_Pickup.002", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "advanced::game::picking::Pickable": (), - }, - ), - 72: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -11.560788, - y: 0.0, - z: 7.6554174, - ), - rotation: (0.0, 0.0, 0.0, 1.0), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 16961132108296874979, - name: "Container.001", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Container"), - "advanced::game::picking::Pickable": (), - }, - ), - 80: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -21.397858, - y: 0.3833189, - z: -0.32418346, - ), - rotation: (0.0, 0.0, 0.0, 1.0), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 5104740624378885265, - name: "Container.002", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Container"), - "advanced::game::picking::Pickable": (), - }, - ), - 82: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 2.9156065, - y: 1.4984571, - z: 2.1909573, - ), - rotation: (0.058853183, 0.0726243, 0.2048649, 0.97431636), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 107557640935939866, - name: "test5159735758431545549", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "advanced::game::picking::Pickable": (), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: -1.2580805, - y: -0.39687577, - z: 0.4816798, - ), - angvel: ( - x: 0.2979751, - y: 0.07926611, - z: 0.8434645, - ), - ), - }, - ), - 86: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 0.26087752, - y: 1.5525806, - z: 1.5980839, - ), - rotation: (0.059497803, -0.0000018232388, 0.13145457, 0.9895351), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 3398656236303073559, - name: "test7470642598731063943", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "advanced::game::picking::Pickable": (), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: -0.9268077, - y: -0.19806683, - z: 0.41948256, - ), - angvel: ( - x: 0.26946256, - y: -0.000006710977, - z: 0.5953494, - ), - ), - }, - ), - 90: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 2.6515265, - y: 1.5944021, - z: -4.391837, - ), - rotation: (-0.030030435, -0.0000006527225, 0.029748484, 0.9991062), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 12541900054595385134, - name: "test3938024405863834719", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "advanced::game::picking::Pickable": (), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: -0.28430828, - y: -0.022357654, - z: -0.2870027, - ), - angvel: ( - x: -0.17986917, - y: -0.0000035613396, - z: 0.17818078, - ), - ), - }, - ), - 94: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -4.2356462, - y: 1.596993, - z: 0.7254991, - ), - rotation: (-0.0221751, -0.0000000001891749, 0.011065631, 0.99969286), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 6757906322211730861, - name: "test11007490954016878479", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "advanced::game::picking::Pickable": (), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: -0.21747473, - y: -0.014912919, - z: -0.43581253, - ), - angvel: ( - x: -0.2727097, - y: -0.0000000034594905, - z: 0.13608481, - ), - ), - }, - ), - 98: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 3.1525247, - y: 1.5518407, - z: -2.9611976, - ), - rotation: (-0.09219627, 0.1602262, -0.11205085, 0.9763565), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 12588565107899185946, - name: "test5980867849331267699", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "advanced::game::picking::Pickable": (), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: 0.8323179, - y: -0.20597076, - z: -0.68975484, - ), - angvel: ( - x: -0.37971017, - y: 0.49603412, - z: -0.6079359, - ), - ), - }, - ), - 4294967310: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 4.826278, - y: 1.2710563, - z: -3.1997645, - ), - rotation: (-0.303028, 0.00000087800436, -0.23889118, 0.9225535), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 15533546218717453536, - name: "test12380979123759326444", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "advanced::game::picking::Pickable": (), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: 1.2146912, - y: -1.1640646, - z: -1.5408095, - ), - angvel: ( - x: -1.1932359, - y: 0.000002945365, - z: -0.94068503, - ), - ), - }, - ), - 4294967314: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 3.9906094, - y: 1.4824095, - z: 2.4394412, - ), - rotation: (0.06015042, 0.085218765, 0.2215642, 0.9695509), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 2466794778849297109, - name: "test12475628281920299197", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "advanced::game::picking::Pickable": (), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: -1.0818624, - y: -0.37798148, - z: 0.45334253, - ), - angvel: ( - x: 0.25961447, - y: 0.14854014, - z: 0.7426717, - ), - ), - }, - ), - 4294967321: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 2.2306876, - y: 0.989814, - z: -1.3596333, - ), - rotation: (0.30614096, 0.002587511, -0.42789298, 0.8503991), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_core::name::Name": ( - hash: 1545925632270385398, - name: "test15780367212768138828", - ), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "advanced::game::picking::Pickable": (), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: 1.3027526, - y: -1.8947054, - z: 1.6179247, - ), - angvel: ( - x: 1.4565696, - y: -0.16299045, - z: -1.3631926, - ), - ), - }, - ), - }, -) \ No newline at end of file diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/assets/assets_core.rs b/examples/bevy_gltf_blueprints/basic_scene_components/src/assets/assets_core.rs deleted file mode 100644 index 29b577a..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/src/assets/assets_core.rs +++ /dev/null @@ -1,5 +0,0 @@ -use bevy::prelude::*; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct CoreAssets {} diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/assets/assets_game.rs b/examples/bevy_gltf_blueprints/basic_scene_components/src/assets/assets_game.rs deleted file mode 100644 index b8e0665..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/src/assets/assets_game.rs +++ /dev/null @@ -1,13 +0,0 @@ -use bevy::gltf::Gltf; -use bevy::prelude::*; -use bevy::utils::HashMap; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct GameAssets { - #[asset(key = "world")] - pub world: Handle, - - #[asset(key = "models", collection(typed, mapped))] - pub models: HashMap>, -} diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/assets/mod.rs b/examples/bevy_gltf_blueprints/basic_scene_components/src/assets/mod.rs deleted file mode 100644 index a2c8b22..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/src/assets/mod.rs +++ /dev/null @@ -1,35 +0,0 @@ -pub mod assets_core; -pub use assets_core::*; - -pub mod assets_game; -pub use assets_game::*; - -use bevy::prelude::*; -use bevy_asset_loader::prelude::*; - -use crate::state::AppState; - -pub struct AssetsPlugin; -impl Plugin for AssetsPlugin { - fn build(&self, app: &mut App) { - 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), - ) - .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); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/core/camera/camera_tracking.rs b/examples/bevy_gltf_blueprints/basic_scene_components/src/core/camera/camera_tracking.rs deleted file mode 100644 index 62da84d..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/src/core/camera/camera_tracking.rs +++ /dev/null @@ -1,58 +0,0 @@ -use bevy::prelude::*; - -#[derive(Component, Reflect, Debug)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -/// -pub struct CameraTracking { - pub offset: Vec3, -} -impl Default for CameraTracking { - fn default() -> Self { - CameraTracking { - offset: Vec3::new(0.0, 6.0, 8.0), - } - } -} - -#[derive(Component, Reflect, Debug, Deref, DerefMut)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -pub struct CameraTrackingOffset(Vec3); -impl Default for CameraTrackingOffset { - fn default() -> Self { - CameraTrackingOffset(Vec3::new(0.0, 6.0, 8.0)) - } -} - -impl CameraTrackingOffset { - fn new(input: Vec3) -> Self { - CameraTrackingOffset(input) - } -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Add this component to an entity if you want it to be tracked by a Camera -pub struct CameraTrackable; - -pub fn camera_track( - mut tracking_cameras: Query< - (&mut Transform, &CameraTrackingOffset), - ( - With, - With, - Without, - ), - >, - camera_tracked: Query<&Transform, With>, -) { - for (mut camera_transform, tracking_offset) in tracking_cameras.iter_mut() { - for tracked_transform in camera_tracked.iter() { - let target_position = tracked_transform.translation + tracking_offset.0; - let eased_position = camera_transform.translation.lerp(target_position, 0.1); - camera_transform.translation = eased_position; // + tracking.offset;// tracked_transform.translation + tracking.offset; - *camera_transform = camera_transform.looking_at(tracked_transform.translation, Vec3::Y); - } - } -} diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/core/mod.rs b/examples/bevy_gltf_blueprints/basic_scene_components/src/core/mod.rs deleted file mode 100644 index 9c38fa7..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/src/core/mod.rs +++ /dev/null @@ -1,31 +0,0 @@ -pub mod camera; -pub use camera::*; - -pub mod lighting; -pub use lighting::*; - -pub mod relationships; -pub use relationships::*; - -pub mod physics; -pub use physics::*; - -use bevy::prelude::*; -use bevy_gltf_blueprints::*; - -pub struct CorePlugin; -impl Plugin for CorePlugin { - fn build(&self, app: &mut App) { - app.add_plugins(( - LightingPlugin, - CameraPlugin, - PhysicsPlugin, - BlueprintsPlugin { - library_folder: "models/library".into(), - format: GltfFormat::GLB, - aabbs: true, - ..Default::default() - }, - )); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/core/physics/controls.rs b/examples/bevy_gltf_blueprints/basic_scene_components/src/core/physics/controls.rs deleted file mode 100644 index a138d7c..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/src/core/physics/controls.rs +++ /dev/null @@ -1,25 +0,0 @@ -use bevy::{ - ecs::system::Res, - input::{keyboard::KeyCode, Input}, - prelude::{info, ResMut}, -}; -use bevy_rapier3d::{prelude::RapierConfiguration, render::DebugRenderContext}; - -pub fn pause_physics(mut physics_config: ResMut) { - info!("pausing physics"); - physics_config.physics_pipeline_active = false; -} - -pub fn resume_physics(mut physics_config: ResMut) { - info!("unpausing physics"); - physics_config.physics_pipeline_active = true; -} - -pub fn toggle_physics_debug( - mut debug_config: ResMut, - keycode: Res>, -) { - if keycode.just_pressed(KeyCode::D) { - debug_config.enabled = !debug_config.enabled; - } -} diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/core/physics/physics_replace_proxies.rs b/examples/bevy_gltf_blueprints/basic_scene_components/src/core/physics/physics_replace_proxies.rs deleted file mode 100644 index b91462c..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/src/core/physics/physics_replace_proxies.rs +++ /dev/null @@ -1,101 +0,0 @@ -use bevy::prelude::*; -// use bevy::render::primitives::Aabb; -use bevy_rapier3d::geometry::Collider as RapierCollider; -use bevy_rapier3d::prelude::{ActiveCollisionTypes, ActiveEvents, ComputedColliderShape}; - -use super::utils::*; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum Collider { - Ball(f32), - Cuboid(Vec3), - Capsule(Vec3, Vec3, f32), - #[default] - Mesh, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum AutoAABBCollider { - #[default] - Cuboid, - Ball, - Capsule, -} - -// replaces all physics stand-ins with the actual rapier types -pub fn physics_replace_proxies( - meshes: Res>, - mesh_handles: Query<&Handle>, - mut proxy_colliders: Query< - (Entity, &Collider, &Name, &mut Visibility), - (Without, Added), - >, - // needed for tri meshes - children: Query<&Children>, - - mut commands: Commands, -) { - for proxy_colider in proxy_colliders.iter_mut() { - let (entity, collider_proxy, name, mut visibility) = proxy_colider; - // we hide the collider meshes: perhaps they should be removed altogether once processed ? - if name.ends_with("_collider") || name.ends_with("_sensor") { - *visibility = Visibility::Hidden; - } - - let mut rapier_collider: RapierCollider; - match collider_proxy { - Collider::Ball(radius) => { - info!("generating collider from proxy: ball"); - rapier_collider = RapierCollider::ball(*radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Cuboid(size) => { - info!("generating collider from proxy: cuboid"); - rapier_collider = RapierCollider::cuboid(size.x, size.y, size.z); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Capsule(a, b, radius) => { - info!("generating collider from proxy: capsule"); - rapier_collider = RapierCollider::capsule(*a, *b, *radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Mesh => { - info!("generating collider from proxy: mesh"); - for (_, collider_mesh) in - Mesh::search_in_children(entity, &children, &meshes, &mesh_handles) - { - rapier_collider = RapierCollider::from_bevy_mesh( - collider_mesh, - &ComputedColliderShape::TriMesh, - ) - .unwrap(); - commands - .entity(entity) - .insert(rapier_collider) - // FIXME: this is just for demo purposes !!! - .insert( - ActiveCollisionTypes::default() - | ActiveCollisionTypes::KINEMATIC_STATIC - | ActiveCollisionTypes::STATIC_STATIC - | ActiveCollisionTypes::DYNAMIC_STATIC, - ) - .insert(ActiveEvents::COLLISION_EVENTS); - // .insert(ActiveEvents::COLLISION_EVENTS) - // break; - // RapierCollider::convex_hull(points) - } - } - } - } -} diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/core/physics/utils.rs b/examples/bevy_gltf_blueprints/basic_scene_components/src/core/physics/utils.rs deleted file mode 100644 index 7886710..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/src/core/physics/utils.rs +++ /dev/null @@ -1,175 +0,0 @@ -use bevy::prelude::*; -use bevy::render::mesh::{MeshVertexAttributeId, PrimitiveTopology, VertexAttributeValues}; -// TAKEN VERBATIB FROM https://github.com/janhohenheim/foxtrot/blob/src/util/trait_extension.rs - -pub(crate) trait Vec3Ext: Copy { - fn is_approx_zero(self) -> bool; - fn split(self, up: Vec3) -> SplitVec3; -} -impl Vec3Ext for Vec3 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn split(self, up: Vec3) -> SplitVec3 { - let vertical = up * self.dot(up); - let horizontal = self - vertical; - SplitVec3 { - vertical, - horizontal, - } - } -} - -#[derive(Debug, Clone, Copy, PartialEq)] -pub(crate) struct SplitVec3 { - pub(crate) vertical: Vec3, - pub(crate) horizontal: Vec3, -} - -pub(crate) trait Vec2Ext: Copy { - fn is_approx_zero(self) -> bool; - fn x0y(self) -> Vec3; -} -impl Vec2Ext for Vec2 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn x0y(self) -> Vec3 { - Vec3::new(self.x, 0., self.y) - } -} - -pub(crate) trait MeshExt { - fn transform(&mut self, transform: Transform); - fn transformed(&self, transform: Transform) -> Mesh; - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]>; - fn search_in_children<'a>( - parent: Entity, - children: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)>; -} - -impl MeshExt for Mesh { - fn transform(&mut self, transform: Transform) { - for coords in self.read_coords_mut(Mesh::ATTRIBUTE_POSITION.clone()) { - let vec3 = (*coords).into(); - let transformed = transform.transform_point(vec3); - *coords = transformed.into(); - } - for normal in self.read_coords_mut(Mesh::ATTRIBUTE_NORMAL.clone()) { - let vec3 = (*normal).into(); - let transformed = transform.rotation.mul_vec3(vec3); - *normal = transformed.into(); - } - } - - fn transformed(&self, transform: Transform) -> Mesh { - let mut mesh = self.clone(); - mesh.transform(transform); - mesh - } - - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]> { - // Guaranteed by Bevy for the current usage - match self - .attribute_mut(id) - .expect("Failed to read unknown mesh attribute") - { - VertexAttributeValues::Float32x3(values) => values, - // Guaranteed by Bevy for the current usage - _ => unreachable!(), - } - } - - fn search_in_children<'a>( - parent: Entity, - children_query: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)> { - if let Ok(children) = children_query.get(parent) { - let mut result: Vec<_> = children - .iter() - .filter_map(|entity| mesh_handles.get(*entity).ok().map(|mesh| (*entity, mesh))) - .map(|(entity, mesh_handle)| { - ( - entity, - meshes - .get(mesh_handle) - .expect("Failed to get mesh from handle"), - ) - }) - .map(|(entity, mesh)| { - assert_eq!(mesh.primitive_topology(), PrimitiveTopology::TriangleList); - (entity, mesh) - }) - .collect(); - let mut inner_result = children - .iter() - .flat_map(|entity| { - Self::search_in_children(*entity, children_query, meshes, mesh_handles) - }) - .collect(); - result.append(&mut inner_result); - result - } else { - Vec::new() - } - } -} - -pub(crate) trait F32Ext: Copy { - fn is_approx_zero(self) -> bool; - fn squared(self) -> f32; - fn lerp(self, other: f32, ratio: f32) -> f32; -} - -impl F32Ext for f32 { - #[inline] - fn is_approx_zero(self) -> bool { - self.abs() < 1e-5 - } - - #[inline] - fn squared(self) -> f32 { - self * self - } - - #[inline] - fn lerp(self, other: f32, ratio: f32) -> f32 { - self.mul_add(1. - ratio, other * ratio) - } -} - -pub(crate) trait TransformExt: Copy { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform; - fn lerp(self, other: Transform, ratio: f32) -> Transform; -} - -impl TransformExt for Transform { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform { - let direction = target - self.translation; - let horizontal_direction = direction - up * direction.dot(up); - let look_target = self.translation + horizontal_direction; - self.looking_at(look_target, up) - } - - fn lerp(self, other: Transform, ratio: f32) -> Transform { - let translation = self.translation.lerp(other.translation, ratio); - let rotation = self.rotation.slerp(other.rotation, ratio); - let scale = self.scale.lerp(other.scale, ratio); - Transform { - translation, - rotation, - scale, - } - } -} diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/core/relationships/mod.rs b/examples/bevy_gltf_blueprints/basic_scene_components/src/core/relationships/mod.rs deleted file mode 100644 index 4128453..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/src/core/relationships/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub mod relationships_insert_dependant_components; -pub use relationships_insert_dependant_components::*; - -use bevy::prelude::*; - -pub struct EcsRelationshipsPlugin; -impl Plugin for EcsRelationshipsPlugin { - fn build(&self, app: &mut App) { - app; - } -} diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/core/relationships/relationships_insert_dependant_components.rs b/examples/bevy_gltf_blueprints/basic_scene_components/src/core/relationships/relationships_insert_dependant_components.rs deleted file mode 100644 index 4e9ad17..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/src/core/relationships/relationships_insert_dependant_components.rs +++ /dev/null @@ -1,15 +0,0 @@ -use bevy::prelude::*; - -pub fn insert_dependant_component< - Dependant: Component, - Dependency: Component + std::default::Default, ->( - mut commands: Commands, - entities_without_depency: Query<(Entity, &Name), (With, Without)>, -) { - for (entity, name) in entities_without_depency.iter() { - let name = name.clone().to_string(); - commands.entity(entity).insert(Dependency::default()); - warn!("found an entity called {} with a {} component but without an {}, please check your assets", name.clone(), std::any::type_name::(), std::any::type_name::()); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/game/in_game.rs b/examples/bevy_gltf_blueprints/basic_scene_components/src/game/in_game.rs deleted file mode 100644 index e8090fa..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/src/game/in_game.rs +++ /dev/null @@ -1,80 +0,0 @@ -use bevy::prelude::*; - -use crate::{ - assets::GameAssets, - state::{GameState, InAppRunning}, -}; -use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag}; - -use bevy_rapier3d::prelude::Velocity; -use rand::Rng; - -pub fn setup_game( - mut commands: Commands, - game_assets: Res, - models: Res>, - mut next_game_state: ResMut>, -) { - println!("setting up all stuff"); - // here we actually spawn our game world/level - - commands.spawn(( - SceneBundle { - // note: because of this issue https://github.com/bevyengine/bevy/issues/10436, "world" is now a gltf file instead of a scene - scene: models - .get(game_assets.world.id()) - .expect("main level should have been loaded") - .scenes[0] - .clone(), - ..default() - }, - bevy::prelude::Name::from("world"), - GameWorldTag, - InAppRunning, - )); - - next_game_state.set(GameState::InGame) -} - -pub fn spawn_test( - keycode: Res>, - mut commands: Commands, - - mut game_world: Query<(Entity, &Children), With>, -) { - if keycode.just_pressed(KeyCode::T) { - 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), - }, - )) - .id(); - commands.entity(world).add_child(new_entity); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/game/in_main_menu.rs b/examples/bevy_gltf_blueprints/basic_scene_components/src/game/in_main_menu.rs deleted file mode 100644 index cecd13a..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/src/game/in_main_menu.rs +++ /dev/null @@ -1,113 +0,0 @@ -use bevy::prelude::*; - -use crate::state::{AppState, GameState, InMainMenu}; - -pub fn setup_main_menu(mut commands: Commands) { - commands.spawn((Camera2dBundle::default(), InMainMenu)); - - commands.spawn(( - TextBundle::from_section( - "SOME GAME TITLE !!", - TextStyle { - //font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 18.0, - color: Color::WHITE, - ..Default::default() - }, - ) - .with_style(Style { - position_type: PositionType::Absolute, - top: Val::Px(100.0), - left: Val::Px(200.0), - ..default() - }), - InMainMenu, - )); - - commands.spawn(( - TextBundle::from_section( - "New Game (press Enter to start, press T once the game is started for demo spawning)", - TextStyle { - //font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 18.0, - color: Color::WHITE, - ..Default::default() - }, - ) - .with_style(Style { - position_type: PositionType::Absolute, - top: Val::Px(200.0), - left: Val::Px(200.0), - ..default() - }), - InMainMenu, - )); - - /* - commands.spawn(( - TextBundle::from_section( - "Load Game", - TextStyle { - //font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 18.0, - color: Color::WHITE, - ..Default::default() - }, - ) - .with_style(Style { - position_type: PositionType::Absolute, - top: Val::Px(250.0), - left: Val::Px(200.0), - ..default() - }), - InMainMenu - )); - - commands.spawn(( - TextBundle::from_section( - "Exit Game", - TextStyle { - //font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 18.0, - color: Color::WHITE, - ..Default::default() - }, - ) - .with_style(Style { - position_type: PositionType::Absolute, - top: Val::Px(300.0), - left: Val::Px(200.0), - ..default() - }), - InMainMenu - ));*/ -} - -pub fn teardown_main_menu(bla: Query>, mut commands: Commands) { - for bli in bla.iter() { - commands.entity(bli).despawn_recursive(); - } -} - -pub fn main_menu( - 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) { - 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() }) - } -} diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/game/mod.rs b/examples/bevy_gltf_blueprints/basic_scene_components/src/game/mod.rs deleted file mode 100644 index a650314..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/src/game/mod.rs +++ /dev/null @@ -1,115 +0,0 @@ -pub mod in_game; -pub use in_game::*; - -pub mod in_main_menu; -pub use in_main_menu::*; - -pub mod picking; -pub use picking::*; - -use crate::{ - insert_dependant_component, - state::{AppState, GameState}, -}; -use bevy::prelude::*; -use bevy_rapier3d::prelude::*; - -// this file is just for demo purposes, contains various types of components, systems etc - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum SoundMaterial { - Metal, - Wood, - Rock, - Cloth, - Squishy, - #[default] - None, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Player; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo component showing auto injection of components -pub struct ShouldBeWithPlayer; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Interactible; - -fn player_move_demo( - keycode: Res>, - mut players: Query<&mut Transform, With>, -) { - let speed = 0.2; - if let Ok(mut player) = players.get_single_mut() { - if keycode.pressed(KeyCode::Left) { - player.translation.x += speed; - } - if keycode.pressed(KeyCode::Right) { - player.translation.x -= speed; - } - - if keycode.pressed(KeyCode::Up) { - player.translation.z += speed; - } - if keycode.pressed(KeyCode::Down) { - player.translation.z -= speed; - } - } -} - -// collision tests/debug -pub fn test_collision_events( - mut collision_events: EventReader, - mut contact_force_events: EventReader, -) { - for collision_event in collision_events.read() { - println!("collision"); - match collision_event { - CollisionEvent::Started(_entity1, _entity2, _) => { - println!("collision started") - } - CollisionEvent::Stopped(_entity1, _entity2, _) => { - println!("collision ended") - } - } - } - - for contact_force_event in contact_force_events.read() { - println!("Received contact force event: {:?}", contact_force_event); - } -} - -pub struct GamePlugin; -impl Plugin for GamePlugin { - fn build(&self, app: &mut App) { - app.add_plugins(PickingPlugin) - .register_type::() - .register_type::() - .register_type::() - // little helper utility, to automatically inject components that are dependant on an other component - // ie, here an Entity with a Player component should also always have a ShouldBeWithPlayer component - // you get a warning if you use this, as I consider this to be stop-gap solution (usually you should have either a bundle, or directly define all needed components) - .add_systems( - Update, - ( - // insert_dependant_component::, - player_move_demo, //.run_if(in_state(AppState::Running)), - // test_collision_events - spawn_test, - ) - .run_if(in_state(GameState::InGame)), - ) - .add_systems(OnEnter(AppState::MenuRunning), setup_main_menu) - .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); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/main.rs b/examples/bevy_gltf_blueprints/basic_scene_components/src/main.rs deleted file mode 100644 index 6edba33..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/src/main.rs +++ /dev/null @@ -1,33 +0,0 @@ -use bevy::prelude::*; -use bevy_editor_pls::prelude::*; - -mod core; -use crate::core::*; - -pub mod assets; -use assets::*; - -pub mod state; -use state::*; - -mod game; -use game::*; - -mod test_components; -use test_components::*; - -fn main() { - App::new() - .add_plugins(( - DefaultPlugins.set(AssetPlugin::default()), - // editor - EditorPlugin::default(), - // our custom plugins - StatePlugin, - AssetsPlugin, - CorePlugin, // reusable plugins - GamePlugin, // specific to our game - ComponentsTestPlugin, // Showcases different type of components /structs - )) - .run(); -} diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/state.rs b/examples/bevy_gltf_blueprints/basic_scene_components/src/state.rs deleted file mode 100644 index 8e983d9..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/src/state.rs +++ /dev/null @@ -1,54 +0,0 @@ -use bevy::app::AppExit; -use bevy::prelude::*; - -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, States)] -pub enum AppState { - #[default] - CoreLoading, - MenuRunning, - AppLoading, - AppRunning, - AppEnding, - - // FIXME: not sure - LoadingGame, -} - -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, States)] -pub enum GameState { - #[default] - None, - - InMenu, - InGame, - - InGameOver, - - InSaving, - InLoading, -} - -// tag components for all entities within a certain state (for despawning them if needed) , FIXME: seems kinda hack-ish -#[derive(Component)] -pub struct InCoreLoading; -#[derive(Component, Default)] -pub struct InMenuRunning; -#[derive(Component)] -pub struct InAppLoading; -#[derive(Component)] -pub struct InAppRunning; - -// components for tagging in game vs in game menu stuff -#[derive(Component, Default)] -pub struct InMainMenu; -#[derive(Component, Default)] -pub struct InMenu; -#[derive(Component, Default)] -pub struct InGame; - -pub struct StatePlugin; -impl Plugin for StatePlugin { - fn build(&self, app: &mut App) { - app.add_state::().add_state::(); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/test_components.rs b/examples/bevy_gltf_blueprints/basic_scene_components/src/test_components.rs deleted file mode 100644 index d0e6fbd..0000000 --- a/examples/bevy_gltf_blueprints/basic_scene_components/src/test_components.rs +++ /dev/null @@ -1,80 +0,0 @@ -use bevy::prelude::*; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct UnitTest; - -#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] -#[reflect(Component)] -struct TuppleTestF32(f32); - -#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] -#[reflect(Component)] -struct TuppleTestU64(u64); - -#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] -#[reflect(Component)] -pub struct TuppleTestStr(String); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleTest2(f32, u64, String); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleTestBool(bool); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleVec2(Vec2); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleVec3(Vec3); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleVec(Vec); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleTestColor(Color); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct BasicTest { - a: f32, - b: u64, - c: String, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum EnumTest { - Metal, - Wood, - Rock, - Cloth, - Squishy, - #[default] - None, -} - -pub struct ComponentsTestPlugin; -impl Plugin for ComponentsTestPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::>(); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/Cargo.toml b/examples/bevy_gltf_blueprints/basic_wasm/Cargo.toml deleted file mode 100644 index 97f1e0e..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "bevy_gltf_blueprints_basic_wasm_example" -version = "0.3.0" -edition = "2021" -license = "MIT OR Apache-2.0" - -[dependencies] -bevy="0.12" -bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" } -bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] } -bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]} -bevy_editor_pls = { version = "0.6" } -rand = "0.8.5" diff --git a/examples/bevy_gltf_blueprints/basic_wasm/README.md b/examples/bevy_gltf_blueprints/basic_wasm/README.md deleted file mode 100644 index a8c33f3..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/README.md +++ /dev/null @@ -1,31 +0,0 @@ -# Basic wasm example/demo - -This example showcases various components & blueprints extracted from the gltf files, including physics colliders & rigid bodies, in wasm - -## Setup - -as per the bevy documentation: - -```shell -rustup target add wasm32-unknown-unknown -cargo install wasm-bindgen-cli -``` - - -## Building this example - -navigate to the current folder , and then - -```shell -cargo build --release --target wasm32-unknown-unknown --target-dir ./target -wasm-bindgen --out-name wasm_example \ - --out-dir ./target/wasm \ - --target web target/wasm32-unknown-unknown/release/bevy_gltf_blueprints_basic_wasm_example.wasm - -``` - -## Running this example - -run a web server in the current folder, and navigate to the page, you should see the example in your browser - - diff --git a/examples/bevy_gltf_blueprints/basic_wasm/assets/advanced.blend b/examples/bevy_gltf_blueprints/basic_wasm/assets/advanced.blend deleted file mode 100644 index 0c555de..0000000 Binary files a/examples/bevy_gltf_blueprints/basic_wasm/assets/advanced.blend and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/basic_wasm/assets/assets_core.assets.ron b/examples/bevy_gltf_blueprints/basic_wasm/assets/assets_core.assets.ron deleted file mode 100644 index 8d0a099..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/assets/assets_core.assets.ron +++ /dev/null @@ -1 +0,0 @@ -({}) \ No newline at end of file diff --git a/examples/bevy_gltf_blueprints/basic_wasm/assets/assets_game.assets.ron b/examples/bevy_gltf_blueprints/basic_wasm/assets/assets_game.assets.ron deleted file mode 100644 index 82111ed..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/assets/assets_game.assets.ron +++ /dev/null @@ -1,14 +0,0 @@ -({ - "world":File (path: "models/World.glb"), - /*"models": Files ( - paths: [ - "models/library/Container.glb", - "models/library/Health_Pickup.glb", - "models/library/MagicTeapot.glb", - "models/library/Pillar.glb", - "models/library/Player.glb", - "models/library/Unused_in_level_test.glb" - ], - )*/ - -}) \ No newline at end of file diff --git a/examples/bevy_gltf_blueprints/basic_wasm/assets/models/World.glb b/examples/bevy_gltf_blueprints/basic_wasm/assets/models/World.glb deleted file mode 100644 index b71d240..0000000 Binary files a/examples/bevy_gltf_blueprints/basic_wasm/assets/models/World.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/basic_wasm/assets/models/library/Container.glb b/examples/bevy_gltf_blueprints/basic_wasm/assets/models/library/Container.glb deleted file mode 100644 index 72ff5ca..0000000 Binary files a/examples/bevy_gltf_blueprints/basic_wasm/assets/models/library/Container.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/basic_wasm/assets/models/library/Health_Pickup.glb b/examples/bevy_gltf_blueprints/basic_wasm/assets/models/library/Health_Pickup.glb deleted file mode 100644 index 4643320..0000000 Binary files a/examples/bevy_gltf_blueprints/basic_wasm/assets/models/library/Health_Pickup.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/basic_wasm/assets/models/library/MagicTeapot.glb b/examples/bevy_gltf_blueprints/basic_wasm/assets/models/library/MagicTeapot.glb deleted file mode 100644 index 7a7020b..0000000 Binary files a/examples/bevy_gltf_blueprints/basic_wasm/assets/models/library/MagicTeapot.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/basic_wasm/assets/models/library/Pillar.glb b/examples/bevy_gltf_blueprints/basic_wasm/assets/models/library/Pillar.glb deleted file mode 100644 index 891122c..0000000 Binary files a/examples/bevy_gltf_blueprints/basic_wasm/assets/models/library/Pillar.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/basic_wasm/assets/models/library/Player.glb b/examples/bevy_gltf_blueprints/basic_wasm/assets/models/library/Player.glb deleted file mode 100644 index a7ef15f..0000000 Binary files a/examples/bevy_gltf_blueprints/basic_wasm/assets/models/library/Player.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/basic_wasm/assets/models/library/Unused_in_level_test.glb b/examples/bevy_gltf_blueprints/basic_wasm/assets/models/library/Unused_in_level_test.glb deleted file mode 100644 index b5937bb..0000000 Binary files a/examples/bevy_gltf_blueprints/basic_wasm/assets/models/library/Unused_in_level_test.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/assets/assets_core.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/assets/assets_core.rs deleted file mode 100644 index 29b577a..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/assets/assets_core.rs +++ /dev/null @@ -1,5 +0,0 @@ -use bevy::prelude::*; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct CoreAssets {} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/assets/assets_game.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/assets/assets_game.rs deleted file mode 100644 index 066f7db..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/assets/assets_game.rs +++ /dev/null @@ -1,29 +0,0 @@ -use bevy::gltf::Gltf; -use bevy::prelude::*; -use bevy::utils::HashMap; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct GameAssets { - #[asset(key = "world")] - pub world: Handle, - - #[asset( - paths( - "models/library/Container.glb", - "models/library/Health_Pickup.glb", - "models/library/MagicTeapot.glb", - "models/library/Pillar.glb", - "models/library/Player.glb", - "models/library/Unused_in_level_test.glb" - ), - collection(typed) - )] - pub models: Vec>, - /* - #[asset(key = "models", collection(typed, mapped))] - pub models: HashMap>, - - #[asset(key = "models", collection(typed))] - pub models: Vec>,*/ -} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/assets/mod.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/assets/mod.rs deleted file mode 100644 index a2c8b22..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/assets/mod.rs +++ /dev/null @@ -1,35 +0,0 @@ -pub mod assets_core; -pub use assets_core::*; - -pub mod assets_game; -pub use assets_game::*; - -use bevy::prelude::*; -use bevy_asset_loader::prelude::*; - -use crate::state::AppState; - -pub struct AssetsPlugin; -impl Plugin for AssetsPlugin { - fn build(&self, app: &mut App) { - 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), - ) - .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); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/core/camera/camera_replace_proxies.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/core/camera/camera_replace_proxies.rs deleted file mode 100644 index 9055c95..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/core/camera/camera_replace_proxies.rs +++ /dev/null @@ -1,24 +0,0 @@ -use bevy::core_pipeline::bloom::{BloomCompositeMode, BloomSettings}; -use bevy::core_pipeline::tonemapping::{DebandDither, Tonemapping}; -use bevy::prelude::*; - -use super::CameraTrackingOffset; - -pub fn camera_replace_proxies( - mut commands: Commands, - mut added_cameras: Query<(Entity, &mut Camera), (Added, With)>, -) { - for (entity, mut camera) in added_cameras.iter_mut() { - info!("detected added camera, updating proxy"); - camera.hdr = true; - commands - .entity(entity) - .insert(DebandDither::Enabled) - .insert(Tonemapping::BlenderFilmic) - .insert(BloomSettings { - intensity: 0.01, - composite_mode: BloomCompositeMode::Additive, - ..default() - }); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/core/camera/camera_tracking.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/core/camera/camera_tracking.rs deleted file mode 100644 index 62da84d..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/core/camera/camera_tracking.rs +++ /dev/null @@ -1,58 +0,0 @@ -use bevy::prelude::*; - -#[derive(Component, Reflect, Debug)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -/// -pub struct CameraTracking { - pub offset: Vec3, -} -impl Default for CameraTracking { - fn default() -> Self { - CameraTracking { - offset: Vec3::new(0.0, 6.0, 8.0), - } - } -} - -#[derive(Component, Reflect, Debug, Deref, DerefMut)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -pub struct CameraTrackingOffset(Vec3); -impl Default for CameraTrackingOffset { - fn default() -> Self { - CameraTrackingOffset(Vec3::new(0.0, 6.0, 8.0)) - } -} - -impl CameraTrackingOffset { - fn new(input: Vec3) -> Self { - CameraTrackingOffset(input) - } -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Add this component to an entity if you want it to be tracked by a Camera -pub struct CameraTrackable; - -pub fn camera_track( - mut tracking_cameras: Query< - (&mut Transform, &CameraTrackingOffset), - ( - With, - With, - Without, - ), - >, - camera_tracked: Query<&Transform, With>, -) { - for (mut camera_transform, tracking_offset) in tracking_cameras.iter_mut() { - for tracked_transform in camera_tracked.iter() { - let target_position = tracked_transform.translation + tracking_offset.0; - let eased_position = camera_transform.translation.lerp(target_position, 0.1); - camera_transform.translation = eased_position; // + tracking.offset;// tracked_transform.translation + tracking.offset; - *camera_transform = camera_transform.looking_at(tracked_transform.translation, Vec3::Y); - } - } -} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/core/camera/mod.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/core/camera/mod.rs deleted file mode 100644 index a6bbb65..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/core/camera/mod.rs +++ /dev/null @@ -1,24 +0,0 @@ -pub mod camera_tracking; -pub use camera_tracking::*; - -pub mod camera_replace_proxies; -pub use camera_replace_proxies::*; - -use bevy::prelude::*; -use bevy_gltf_blueprints::GltfBlueprintsSet; - -pub struct CameraPlugin; -impl Plugin for CameraPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .register_type::() - .register_type::() - .add_systems( - Update, - ( - camera_replace_proxies.after(GltfBlueprintsSet::AfterSpawn), - camera_track, - ), - ); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/core/lighting/lighting_replace_proxies.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/core/lighting/lighting_replace_proxies.rs deleted file mode 100644 index 48c0908..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/core/lighting/lighting_replace_proxies.rs +++ /dev/null @@ -1,25 +0,0 @@ -use bevy::prelude::*; - -use bevy::pbr::{CascadeShadowConfig, CascadeShadowConfigBuilder}; - -// fixme might be too specific to might needs, should it be moved out ? also these are all for lights, not models -pub fn lighting_replace_proxies( - mut added_dirights: Query<(Entity, &mut DirectionalLight), Added>, - mut added_spotlights: Query<&mut SpotLight, Added>, - mut commands: Commands, -) { - for (entity, mut light) in added_dirights.iter_mut() { - light.illuminance *= 5.0; - light.shadows_enabled = true; - let shadow_config: CascadeShadowConfig = CascadeShadowConfigBuilder { - first_cascade_far_bound: 15.0, - maximum_distance: 135.0, - ..default() - } - .into(); - commands.entity(entity).insert(shadow_config); - } - for mut light in added_spotlights.iter_mut() { - light.shadows_enabled = true; - } -} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/core/lighting/mod.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/core/lighting/mod.rs deleted file mode 100644 index c9688cd..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/core/lighting/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -mod lighting_replace_proxies; -use lighting_replace_proxies::*; - -use bevy::pbr::{DirectionalLightShadowMap, NotShadowCaster}; -use bevy::prelude::*; - -pub struct LightingPlugin; -impl Plugin for LightingPlugin { - fn build(&self, app: &mut App) { - app - .insert_resource(DirectionalLightShadowMap { size: 4096 }) - // FIXME: adding these since they are missing - .register_type::() - - .add_systems(PreUpdate, lighting_replace_proxies) // FIXME: you should actually run this in a specific state most likely - ; - } -} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/core/mod.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/core/mod.rs deleted file mode 100644 index 9c38fa7..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/core/mod.rs +++ /dev/null @@ -1,31 +0,0 @@ -pub mod camera; -pub use camera::*; - -pub mod lighting; -pub use lighting::*; - -pub mod relationships; -pub use relationships::*; - -pub mod physics; -pub use physics::*; - -use bevy::prelude::*; -use bevy_gltf_blueprints::*; - -pub struct CorePlugin; -impl Plugin for CorePlugin { - fn build(&self, app: &mut App) { - app.add_plugins(( - LightingPlugin, - CameraPlugin, - PhysicsPlugin, - BlueprintsPlugin { - library_folder: "models/library".into(), - format: GltfFormat::GLB, - aabbs: true, - ..Default::default() - }, - )); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/core/physics/controls.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/core/physics/controls.rs deleted file mode 100644 index 9ff42c9..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/core/physics/controls.rs +++ /dev/null @@ -1,12 +0,0 @@ -use bevy::prelude::{info, ResMut}; -use bevy_rapier3d::prelude::RapierConfiguration; - -pub fn pause_physics(mut physics_config: ResMut) { - info!("pausing physics"); - physics_config.physics_pipeline_active = false; -} - -pub fn resume_physics(mut physics_config: ResMut) { - info!("unpausing physics"); - physics_config.physics_pipeline_active = true; -} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/core/physics/mod.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/core/physics/mod.rs deleted file mode 100644 index cd7d523..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/core/physics/mod.rs +++ /dev/null @@ -1,37 +0,0 @@ -pub mod physics_replace_proxies; -use bevy_rapier3d::{ - prelude::{NoUserData, RapierPhysicsPlugin}, - render::RapierDebugRenderPlugin, -}; -pub use physics_replace_proxies::*; - -pub mod utils; - -pub mod controls; -pub use controls::*; - -use crate::state::GameState; -use bevy::prelude::*; -// use super::blueprints::GltfBlueprintsSet; -use bevy_gltf_blueprints::GltfBlueprintsSet; -// use crate::Collider; -pub struct PhysicsPlugin; -impl Plugin for PhysicsPlugin { - fn build(&self, app: &mut App) { - app.add_plugins(( - RapierPhysicsPlugin::::default(), - RapierDebugRenderPlugin::default(), - )) - .register_type::() - .register_type::() - // find a way to make serde's stuff serializable - // .register_type::() - //bevy_rapier3d::dynamics::CoefficientCombineRule - .add_systems( - Update, - physics_replace_proxies.after(GltfBlueprintsSet::AfterSpawn), - ) - .add_systems(OnEnter(GameState::InGame), resume_physics) - .add_systems(OnExit(GameState::InGame), pause_physics); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/core/physics/physics_replace_proxies.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/core/physics/physics_replace_proxies.rs deleted file mode 100644 index b91462c..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/core/physics/physics_replace_proxies.rs +++ /dev/null @@ -1,101 +0,0 @@ -use bevy::prelude::*; -// use bevy::render::primitives::Aabb; -use bevy_rapier3d::geometry::Collider as RapierCollider; -use bevy_rapier3d::prelude::{ActiveCollisionTypes, ActiveEvents, ComputedColliderShape}; - -use super::utils::*; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum Collider { - Ball(f32), - Cuboid(Vec3), - Capsule(Vec3, Vec3, f32), - #[default] - Mesh, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum AutoAABBCollider { - #[default] - Cuboid, - Ball, - Capsule, -} - -// replaces all physics stand-ins with the actual rapier types -pub fn physics_replace_proxies( - meshes: Res>, - mesh_handles: Query<&Handle>, - mut proxy_colliders: Query< - (Entity, &Collider, &Name, &mut Visibility), - (Without, Added), - >, - // needed for tri meshes - children: Query<&Children>, - - mut commands: Commands, -) { - for proxy_colider in proxy_colliders.iter_mut() { - let (entity, collider_proxy, name, mut visibility) = proxy_colider; - // we hide the collider meshes: perhaps they should be removed altogether once processed ? - if name.ends_with("_collider") || name.ends_with("_sensor") { - *visibility = Visibility::Hidden; - } - - let mut rapier_collider: RapierCollider; - match collider_proxy { - Collider::Ball(radius) => { - info!("generating collider from proxy: ball"); - rapier_collider = RapierCollider::ball(*radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Cuboid(size) => { - info!("generating collider from proxy: cuboid"); - rapier_collider = RapierCollider::cuboid(size.x, size.y, size.z); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Capsule(a, b, radius) => { - info!("generating collider from proxy: capsule"); - rapier_collider = RapierCollider::capsule(*a, *b, *radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Mesh => { - info!("generating collider from proxy: mesh"); - for (_, collider_mesh) in - Mesh::search_in_children(entity, &children, &meshes, &mesh_handles) - { - rapier_collider = RapierCollider::from_bevy_mesh( - collider_mesh, - &ComputedColliderShape::TriMesh, - ) - .unwrap(); - commands - .entity(entity) - .insert(rapier_collider) - // FIXME: this is just for demo purposes !!! - .insert( - ActiveCollisionTypes::default() - | ActiveCollisionTypes::KINEMATIC_STATIC - | ActiveCollisionTypes::STATIC_STATIC - | ActiveCollisionTypes::DYNAMIC_STATIC, - ) - .insert(ActiveEvents::COLLISION_EVENTS); - // .insert(ActiveEvents::COLLISION_EVENTS) - // break; - // RapierCollider::convex_hull(points) - } - } - } - } -} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/core/physics/utils.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/core/physics/utils.rs deleted file mode 100644 index 7886710..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/core/physics/utils.rs +++ /dev/null @@ -1,175 +0,0 @@ -use bevy::prelude::*; -use bevy::render::mesh::{MeshVertexAttributeId, PrimitiveTopology, VertexAttributeValues}; -// TAKEN VERBATIB FROM https://github.com/janhohenheim/foxtrot/blob/src/util/trait_extension.rs - -pub(crate) trait Vec3Ext: Copy { - fn is_approx_zero(self) -> bool; - fn split(self, up: Vec3) -> SplitVec3; -} -impl Vec3Ext for Vec3 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn split(self, up: Vec3) -> SplitVec3 { - let vertical = up * self.dot(up); - let horizontal = self - vertical; - SplitVec3 { - vertical, - horizontal, - } - } -} - -#[derive(Debug, Clone, Copy, PartialEq)] -pub(crate) struct SplitVec3 { - pub(crate) vertical: Vec3, - pub(crate) horizontal: Vec3, -} - -pub(crate) trait Vec2Ext: Copy { - fn is_approx_zero(self) -> bool; - fn x0y(self) -> Vec3; -} -impl Vec2Ext for Vec2 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn x0y(self) -> Vec3 { - Vec3::new(self.x, 0., self.y) - } -} - -pub(crate) trait MeshExt { - fn transform(&mut self, transform: Transform); - fn transformed(&self, transform: Transform) -> Mesh; - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]>; - fn search_in_children<'a>( - parent: Entity, - children: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)>; -} - -impl MeshExt for Mesh { - fn transform(&mut self, transform: Transform) { - for coords in self.read_coords_mut(Mesh::ATTRIBUTE_POSITION.clone()) { - let vec3 = (*coords).into(); - let transformed = transform.transform_point(vec3); - *coords = transformed.into(); - } - for normal in self.read_coords_mut(Mesh::ATTRIBUTE_NORMAL.clone()) { - let vec3 = (*normal).into(); - let transformed = transform.rotation.mul_vec3(vec3); - *normal = transformed.into(); - } - } - - fn transformed(&self, transform: Transform) -> Mesh { - let mut mesh = self.clone(); - mesh.transform(transform); - mesh - } - - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]> { - // Guaranteed by Bevy for the current usage - match self - .attribute_mut(id) - .expect("Failed to read unknown mesh attribute") - { - VertexAttributeValues::Float32x3(values) => values, - // Guaranteed by Bevy for the current usage - _ => unreachable!(), - } - } - - fn search_in_children<'a>( - parent: Entity, - children_query: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)> { - if let Ok(children) = children_query.get(parent) { - let mut result: Vec<_> = children - .iter() - .filter_map(|entity| mesh_handles.get(*entity).ok().map(|mesh| (*entity, mesh))) - .map(|(entity, mesh_handle)| { - ( - entity, - meshes - .get(mesh_handle) - .expect("Failed to get mesh from handle"), - ) - }) - .map(|(entity, mesh)| { - assert_eq!(mesh.primitive_topology(), PrimitiveTopology::TriangleList); - (entity, mesh) - }) - .collect(); - let mut inner_result = children - .iter() - .flat_map(|entity| { - Self::search_in_children(*entity, children_query, meshes, mesh_handles) - }) - .collect(); - result.append(&mut inner_result); - result - } else { - Vec::new() - } - } -} - -pub(crate) trait F32Ext: Copy { - fn is_approx_zero(self) -> bool; - fn squared(self) -> f32; - fn lerp(self, other: f32, ratio: f32) -> f32; -} - -impl F32Ext for f32 { - #[inline] - fn is_approx_zero(self) -> bool { - self.abs() < 1e-5 - } - - #[inline] - fn squared(self) -> f32 { - self * self - } - - #[inline] - fn lerp(self, other: f32, ratio: f32) -> f32 { - self.mul_add(1. - ratio, other * ratio) - } -} - -pub(crate) trait TransformExt: Copy { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform; - fn lerp(self, other: Transform, ratio: f32) -> Transform; -} - -impl TransformExt for Transform { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform { - let direction = target - self.translation; - let horizontal_direction = direction - up * direction.dot(up); - let look_target = self.translation + horizontal_direction; - self.looking_at(look_target, up) - } - - fn lerp(self, other: Transform, ratio: f32) -> Transform { - let translation = self.translation.lerp(other.translation, ratio); - let rotation = self.rotation.slerp(other.rotation, ratio); - let scale = self.scale.lerp(other.scale, ratio); - Transform { - translation, - rotation, - scale, - } - } -} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/core/relationships/mod.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/core/relationships/mod.rs deleted file mode 100644 index 4128453..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/core/relationships/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub mod relationships_insert_dependant_components; -pub use relationships_insert_dependant_components::*; - -use bevy::prelude::*; - -pub struct EcsRelationshipsPlugin; -impl Plugin for EcsRelationshipsPlugin { - fn build(&self, app: &mut App) { - app; - } -} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/core/relationships/relationships_insert_dependant_components.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/core/relationships/relationships_insert_dependant_components.rs deleted file mode 100644 index 4e9ad17..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/core/relationships/relationships_insert_dependant_components.rs +++ /dev/null @@ -1,15 +0,0 @@ -use bevy::prelude::*; - -pub fn insert_dependant_component< - Dependant: Component, - Dependency: Component + std::default::Default, ->( - mut commands: Commands, - entities_without_depency: Query<(Entity, &Name), (With, Without)>, -) { - for (entity, name) in entities_without_depency.iter() { - let name = name.clone().to_string(); - commands.entity(entity).insert(Dependency::default()); - warn!("found an entity called {} with a {} component but without an {}, please check your assets", name.clone(), std::any::type_name::(), std::any::type_name::()); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/game/in_game.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/game/in_game.rs deleted file mode 100644 index f1861ce..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/game/in_game.rs +++ /dev/null @@ -1,130 +0,0 @@ -use bevy::prelude::*; - -use crate::{ - assets::GameAssets, - state::{GameState, InAppRunning}, -}; -use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag}; - -use bevy_rapier3d::prelude::Velocity; -use rand::Rng; - -pub fn setup_game( - mut commands: Commands, - game_assets: Res, - models: Res>, - mut next_game_state: ResMut>, -) { - println!("setting up all stuff"); - commands.insert_resource(AmbientLight { - color: Color::WHITE, - brightness: 0.2, - }); - // here we actually spawn our game world/level - - commands.spawn(( - SceneBundle { - // note: because of this issue https://github.com/bevyengine/bevy/issues/10436, "world" is now a gltf file instead of a scene - scene: models - .get(game_assets.world.id()) - .expect("main level should have been loaded") - .scenes[0] - .clone(), - ..default() - }, - bevy::prelude::Name::from("world"), - GameWorldTag, - InAppRunning, - )); - - next_game_state.set(GameState::InGame) -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct UnregisteredComponent; - -pub fn spawn_test( - keycode: Res>, - mut commands: Commands, - - mut game_world: Query<(Entity, &Children), With>, -) { - if keycode.just_pressed(KeyCode::T) { - 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), - }, - )) - .id(); - 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)), - 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/examples/bevy_gltf_blueprints/basic_wasm/src/game/in_main_menu.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/game/in_main_menu.rs deleted file mode 100644 index cecd13a..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/game/in_main_menu.rs +++ /dev/null @@ -1,113 +0,0 @@ -use bevy::prelude::*; - -use crate::state::{AppState, GameState, InMainMenu}; - -pub fn setup_main_menu(mut commands: Commands) { - commands.spawn((Camera2dBundle::default(), InMainMenu)); - - commands.spawn(( - TextBundle::from_section( - "SOME GAME TITLE !!", - TextStyle { - //font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 18.0, - color: Color::WHITE, - ..Default::default() - }, - ) - .with_style(Style { - position_type: PositionType::Absolute, - top: Val::Px(100.0), - left: Val::Px(200.0), - ..default() - }), - InMainMenu, - )); - - commands.spawn(( - TextBundle::from_section( - "New Game (press Enter to start, press T once the game is started for demo spawning)", - TextStyle { - //font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 18.0, - color: Color::WHITE, - ..Default::default() - }, - ) - .with_style(Style { - position_type: PositionType::Absolute, - top: Val::Px(200.0), - left: Val::Px(200.0), - ..default() - }), - InMainMenu, - )); - - /* - commands.spawn(( - TextBundle::from_section( - "Load Game", - TextStyle { - //font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 18.0, - color: Color::WHITE, - ..Default::default() - }, - ) - .with_style(Style { - position_type: PositionType::Absolute, - top: Val::Px(250.0), - left: Val::Px(200.0), - ..default() - }), - InMainMenu - )); - - commands.spawn(( - TextBundle::from_section( - "Exit Game", - TextStyle { - //font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 18.0, - color: Color::WHITE, - ..Default::default() - }, - ) - .with_style(Style { - position_type: PositionType::Absolute, - top: Val::Px(300.0), - left: Val::Px(200.0), - ..default() - }), - InMainMenu - ));*/ -} - -pub fn teardown_main_menu(bla: Query>, mut commands: Commands) { - for bli in bla.iter() { - commands.entity(bli).despawn_recursive(); - } -} - -pub fn main_menu( - 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) { - 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() }) - } -} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/game/mod.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/game/mod.rs deleted file mode 100644 index 00689c2..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/game/mod.rs +++ /dev/null @@ -1,116 +0,0 @@ -pub mod in_game; -pub use in_game::*; - -pub mod in_main_menu; -pub use in_main_menu::*; - -pub mod picking; -pub use picking::*; - -use crate::{ - insert_dependant_component, - state::{AppState, GameState}, -}; -use bevy::prelude::*; -use bevy_rapier3d::prelude::*; - -// this file is just for demo purposes, contains various types of components, systems etc - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum SoundMaterial { - Metal, - Wood, - Rock, - Cloth, - Squishy, - #[default] - None, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Player; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo component showing auto injection of components -pub struct ShouldBeWithPlayer; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Interactible; - -fn player_move_demo( - keycode: Res>, - mut players: Query<&mut Transform, With>, -) { - let speed = 0.2; - if let Ok(mut player) = players.get_single_mut() { - if keycode.pressed(KeyCode::Left) { - player.translation.x += speed; - } - if keycode.pressed(KeyCode::Right) { - player.translation.x -= speed; - } - - if keycode.pressed(KeyCode::Up) { - player.translation.z += speed; - } - if keycode.pressed(KeyCode::Down) { - player.translation.z -= speed; - } - } -} - -// collision tests/debug -pub fn test_collision_events( - mut collision_events: EventReader, - mut contact_force_events: EventReader, -) { - for collision_event in collision_events.read() { - println!("collision"); - match collision_event { - CollisionEvent::Started(_entity1, _entity2, _) => { - println!("collision started") - } - CollisionEvent::Stopped(_entity1, _entity2, _) => { - println!("collision ended") - } - } - } - - for contact_force_event in contact_force_events.read() { - println!("Received contact force event: {:?}", contact_force_event); - } -} - -pub struct GamePlugin; -impl Plugin for GamePlugin { - fn build(&self, app: &mut App) { - app.add_plugins(PickingPlugin) - .register_type::() - .register_type::() - .register_type::() - // little helper utility, to automatically inject components that are dependant on an other component - // ie, here an Entity with a Player component should also always have a ShouldBeWithPlayer component - // you get a warning if you use this, as I consider this to be stop-gap solution (usually you should have either a bundle, or directly define all needed components) - .add_systems( - Update, - ( - // insert_dependant_component::, - player_move_demo, //.run_if(in_state(AppState::Running)), - // test_collision_events - spawn_test, - spawn_test_unregisted_components, - ) - .run_if(in_state(GameState::InGame)), - ) - .add_systems(OnEnter(AppState::MenuRunning), setup_main_menu) - .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); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/game/picking.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/game/picking.rs deleted file mode 100644 index 6731bbb..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/game/picking.rs +++ /dev/null @@ -1,34 +0,0 @@ -use super::Player; -use bevy::prelude::*; -use bevy_gltf_blueprints::GltfBlueprintsSet; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub struct Pickable; - -// very simple, crude picking (as in picking up objects) implementation - -pub fn picking( - players: Query<&GlobalTransform, With>, - pickables: Query<(Entity, &GlobalTransform), With>, - mut commands: Commands, -) { - for player_transforms in players.iter() { - for (pickable, pickable_transforms) in pickables.iter() { - let distance = player_transforms - .translation() - .distance(pickable_transforms.translation()); - if distance < 2.5 { - commands.entity(pickable).despawn_recursive(); - } - } - } -} - -pub struct PickingPlugin; -impl Plugin for PickingPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .add_systems(Update, (picking.after(GltfBlueprintsSet::AfterSpawn),)); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/main.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/main.rs deleted file mode 100644 index 6edba33..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/main.rs +++ /dev/null @@ -1,33 +0,0 @@ -use bevy::prelude::*; -use bevy_editor_pls::prelude::*; - -mod core; -use crate::core::*; - -pub mod assets; -use assets::*; - -pub mod state; -use state::*; - -mod game; -use game::*; - -mod test_components; -use test_components::*; - -fn main() { - App::new() - .add_plugins(( - DefaultPlugins.set(AssetPlugin::default()), - // editor - EditorPlugin::default(), - // our custom plugins - StatePlugin, - AssetsPlugin, - CorePlugin, // reusable plugins - GamePlugin, // specific to our game - ComponentsTestPlugin, // Showcases different type of components /structs - )) - .run(); -} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/state.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/state.rs deleted file mode 100644 index 8e983d9..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/state.rs +++ /dev/null @@ -1,54 +0,0 @@ -use bevy::app::AppExit; -use bevy::prelude::*; - -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, States)] -pub enum AppState { - #[default] - CoreLoading, - MenuRunning, - AppLoading, - AppRunning, - AppEnding, - - // FIXME: not sure - LoadingGame, -} - -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, States)] -pub enum GameState { - #[default] - None, - - InMenu, - InGame, - - InGameOver, - - InSaving, - InLoading, -} - -// tag components for all entities within a certain state (for despawning them if needed) , FIXME: seems kinda hack-ish -#[derive(Component)] -pub struct InCoreLoading; -#[derive(Component, Default)] -pub struct InMenuRunning; -#[derive(Component)] -pub struct InAppLoading; -#[derive(Component)] -pub struct InAppRunning; - -// components for tagging in game vs in game menu stuff -#[derive(Component, Default)] -pub struct InMainMenu; -#[derive(Component, Default)] -pub struct InMenu; -#[derive(Component, Default)] -pub struct InGame; - -pub struct StatePlugin; -impl Plugin for StatePlugin { - fn build(&self, app: &mut App) { - app.add_state::().add_state::(); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_wasm/src/test_components.rs b/examples/bevy_gltf_blueprints/basic_wasm/src/test_components.rs deleted file mode 100644 index d0e6fbd..0000000 --- a/examples/bevy_gltf_blueprints/basic_wasm/src/test_components.rs +++ /dev/null @@ -1,80 +0,0 @@ -use bevy::prelude::*; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct UnitTest; - -#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] -#[reflect(Component)] -struct TuppleTestF32(f32); - -#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] -#[reflect(Component)] -struct TuppleTestU64(u64); - -#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] -#[reflect(Component)] -pub struct TuppleTestStr(String); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleTest2(f32, u64, String); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleTestBool(bool); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleVec2(Vec2); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleVec3(Vec3); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleVec(Vec); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleTestColor(Color); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct BasicTest { - a: f32, - b: u64, - c: String, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum EnumTest { - Metal, - Wood, - Rock, - Cloth, - Squishy, - #[default] - None, -} - -pub struct ComponentsTestPlugin; -impl Plugin for ComponentsTestPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::>(); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/Cargo.toml b/examples/bevy_gltf_blueprints/basic_xpbd_physics/Cargo.toml index 3f22383..144cf0d 100644 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/Cargo.toml +++ b/examples/bevy_gltf_blueprints/basic_xpbd_physics/Cargo.toml @@ -7,6 +7,8 @@ license = "MIT OR Apache-2.0" [dependencies] bevy="0.12" bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" } +bevy_gltf_worlflow_examples_common = { path = "../../common" } + bevy_xpbd_3d = "0.3" bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]} bevy_editor_pls = { version = "0.6" } diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/assets/assets_core.rs b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/assets/assets_core.rs deleted file mode 100644 index 29b577a..0000000 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/assets/assets_core.rs +++ /dev/null @@ -1,5 +0,0 @@ -use bevy::prelude::*; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct CoreAssets {} diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/assets/assets_game.rs b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/assets/assets_game.rs deleted file mode 100644 index b8e0665..0000000 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/assets/assets_game.rs +++ /dev/null @@ -1,13 +0,0 @@ -use bevy::gltf::Gltf; -use bevy::prelude::*; -use bevy::utils::HashMap; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct GameAssets { - #[asset(key = "world")] - pub world: Handle, - - #[asset(key = "models", collection(typed, mapped))] - pub models: HashMap>, -} diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/assets/mod.rs b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/assets/mod.rs deleted file mode 100644 index a2c8b22..0000000 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/assets/mod.rs +++ /dev/null @@ -1,35 +0,0 @@ -pub mod assets_core; -pub use assets_core::*; - -pub mod assets_game; -pub use assets_game::*; - -use bevy::prelude::*; -use bevy_asset_loader::prelude::*; - -use crate::state::AppState; - -pub struct AssetsPlugin; -impl Plugin for AssetsPlugin { - fn build(&self, app: &mut App) { - 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), - ) - .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); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/camera/camera_replace_proxies.rs b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/camera/camera_replace_proxies.rs deleted file mode 100644 index 9055c95..0000000 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/camera/camera_replace_proxies.rs +++ /dev/null @@ -1,24 +0,0 @@ -use bevy::core_pipeline::bloom::{BloomCompositeMode, BloomSettings}; -use bevy::core_pipeline::tonemapping::{DebandDither, Tonemapping}; -use bevy::prelude::*; - -use super::CameraTrackingOffset; - -pub fn camera_replace_proxies( - mut commands: Commands, - mut added_cameras: Query<(Entity, &mut Camera), (Added, With)>, -) { - for (entity, mut camera) in added_cameras.iter_mut() { - info!("detected added camera, updating proxy"); - camera.hdr = true; - commands - .entity(entity) - .insert(DebandDither::Enabled) - .insert(Tonemapping::BlenderFilmic) - .insert(BloomSettings { - intensity: 0.01, - composite_mode: BloomCompositeMode::Additive, - ..default() - }); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/camera/camera_tracking.rs b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/camera/camera_tracking.rs deleted file mode 100644 index 62da84d..0000000 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/camera/camera_tracking.rs +++ /dev/null @@ -1,58 +0,0 @@ -use bevy::prelude::*; - -#[derive(Component, Reflect, Debug)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -/// -pub struct CameraTracking { - pub offset: Vec3, -} -impl Default for CameraTracking { - fn default() -> Self { - CameraTracking { - offset: Vec3::new(0.0, 6.0, 8.0), - } - } -} - -#[derive(Component, Reflect, Debug, Deref, DerefMut)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -pub struct CameraTrackingOffset(Vec3); -impl Default for CameraTrackingOffset { - fn default() -> Self { - CameraTrackingOffset(Vec3::new(0.0, 6.0, 8.0)) - } -} - -impl CameraTrackingOffset { - fn new(input: Vec3) -> Self { - CameraTrackingOffset(input) - } -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Add this component to an entity if you want it to be tracked by a Camera -pub struct CameraTrackable; - -pub fn camera_track( - mut tracking_cameras: Query< - (&mut Transform, &CameraTrackingOffset), - ( - With, - With, - Without, - ), - >, - camera_tracked: Query<&Transform, With>, -) { - for (mut camera_transform, tracking_offset) in tracking_cameras.iter_mut() { - for tracked_transform in camera_tracked.iter() { - let target_position = tracked_transform.translation + tracking_offset.0; - let eased_position = camera_transform.translation.lerp(target_position, 0.1); - camera_transform.translation = eased_position; // + tracking.offset;// tracked_transform.translation + tracking.offset; - *camera_transform = camera_transform.looking_at(tracked_transform.translation, Vec3::Y); - } - } -} diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/camera/mod.rs b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/camera/mod.rs deleted file mode 100644 index a6bbb65..0000000 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/camera/mod.rs +++ /dev/null @@ -1,24 +0,0 @@ -pub mod camera_tracking; -pub use camera_tracking::*; - -pub mod camera_replace_proxies; -pub use camera_replace_proxies::*; - -use bevy::prelude::*; -use bevy_gltf_blueprints::GltfBlueprintsSet; - -pub struct CameraPlugin; -impl Plugin for CameraPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .register_type::() - .register_type::() - .add_systems( - Update, - ( - camera_replace_proxies.after(GltfBlueprintsSet::AfterSpawn), - camera_track, - ), - ); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/lighting/lighting_replace_proxies.rs b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/lighting/lighting_replace_proxies.rs deleted file mode 100644 index 48c0908..0000000 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/lighting/lighting_replace_proxies.rs +++ /dev/null @@ -1,25 +0,0 @@ -use bevy::prelude::*; - -use bevy::pbr::{CascadeShadowConfig, CascadeShadowConfigBuilder}; - -// fixme might be too specific to might needs, should it be moved out ? also these are all for lights, not models -pub fn lighting_replace_proxies( - mut added_dirights: Query<(Entity, &mut DirectionalLight), Added>, - mut added_spotlights: Query<&mut SpotLight, Added>, - mut commands: Commands, -) { - for (entity, mut light) in added_dirights.iter_mut() { - light.illuminance *= 5.0; - light.shadows_enabled = true; - let shadow_config: CascadeShadowConfig = CascadeShadowConfigBuilder { - first_cascade_far_bound: 15.0, - maximum_distance: 135.0, - ..default() - } - .into(); - commands.entity(entity).insert(shadow_config); - } - for mut light in added_spotlights.iter_mut() { - light.shadows_enabled = true; - } -} diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/lighting/mod.rs b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/lighting/mod.rs deleted file mode 100644 index c9688cd..0000000 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/lighting/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -mod lighting_replace_proxies; -use lighting_replace_proxies::*; - -use bevy::pbr::{DirectionalLightShadowMap, NotShadowCaster}; -use bevy::prelude::*; - -pub struct LightingPlugin; -impl Plugin for LightingPlugin { - fn build(&self, app: &mut App) { - app - .insert_resource(DirectionalLightShadowMap { size: 4096 }) - // FIXME: adding these since they are missing - .register_type::() - - .add_systems(PreUpdate, lighting_replace_proxies) // FIXME: you should actually run this in a specific state most likely - ; - } -} 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 3271ad4..0571ebc 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,12 +1,3 @@ -pub mod camera; -pub use camera::*; - -pub mod lighting; -pub use lighting::*; - -pub mod relationships; -pub use relationships::*; - pub mod physics; pub use physics::*; @@ -17,8 +8,6 @@ pub struct CorePlugin; impl Plugin for CorePlugin { fn build(&self, app: &mut App) { app.add_plugins(( - LightingPlugin, - CameraPlugin, PhysicsPlugin, BlueprintsPlugin { library_folder: "models/library".into(), diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/controls.rs b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/controls.rs index fa3dc92..1936001 100644 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/controls.rs +++ b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/controls.rs @@ -1,7 +1,5 @@ -use bevy::{ - prelude::{info, ResMut}, - time::Time, -}; +use bevy::log::info; +use bevy::{prelude::ResMut, time::Time}; use bevy_xpbd_3d::prelude::Physics; use bevy_xpbd_3d::prelude::*; diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/mod.rs b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/mod.rs index 55ae083..702294c 100644 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/mod.rs +++ b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/mod.rs @@ -6,12 +6,11 @@ pub mod utils; pub mod controls; pub use controls::*; -use crate::state::GameState; - use bevy::prelude::*; use bevy_xpbd_3d::prelude::*; use bevy_gltf_blueprints::GltfBlueprintsSet; +use bevy_gltf_worlflow_examples_common::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/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/physics_replace_proxies.rs index 8579815..5ec77f3 100644 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/physics_replace_proxies.rs +++ b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/physics/physics_replace_proxies.rs @@ -24,6 +24,7 @@ pub enum AutoAABBCollider { } // replaces all physics stand-ins with the actual xpbd types +#[allow(clippy::type_complexity)] pub fn physics_replace_proxies( meshes: Res>, mesh_handles: Query<&Handle>, @@ -78,7 +79,7 @@ pub fn physics_replace_proxies( for (_, collider_mesh) in Mesh::search_in_children(entity, &children, &meshes, &mesh_handles) { - xpbd_collider = XpbdCollider::trimesh_from_mesh(&collider_mesh).unwrap(); // convex_hull_from_mesh? + xpbd_collider = XpbdCollider::trimesh_from_mesh(collider_mesh).unwrap(); // convex_hull_from_mesh? commands.entity(entity).insert(xpbd_collider); } } diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/relationships/mod.rs b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/relationships/mod.rs deleted file mode 100644 index 4128453..0000000 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/relationships/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub mod relationships_insert_dependant_components; -pub use relationships_insert_dependant_components::*; - -use bevy::prelude::*; - -pub struct EcsRelationshipsPlugin; -impl Plugin for EcsRelationshipsPlugin { - fn build(&self, app: &mut App) { - app; - } -} diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/relationships/relationships_insert_dependant_components.rs b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/relationships/relationships_insert_dependant_components.rs deleted file mode 100644 index 4e9ad17..0000000 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/core/relationships/relationships_insert_dependant_components.rs +++ /dev/null @@ -1,15 +0,0 @@ -use bevy::prelude::*; - -pub fn insert_dependant_component< - Dependant: Component, - Dependency: Component + std::default::Default, ->( - mut commands: Commands, - entities_without_depency: Query<(Entity, &Name), (With, Without)>, -) { - for (entity, name) in entities_without_depency.iter() { - let name = name.clone().to_string(); - commands.entity(entity).insert(Dependency::default()); - warn!("found an entity called {} with a {} component but without an {}, please check your assets", name.clone(), std::any::type_name::(), std::any::type_name::()); - } -} 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 352197b..64559c5 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,11 +1,7 @@ use bevy::prelude::*; - -use crate::{ - assets::GameAssets, - state::{GameState, InAppRunning}, -}; 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::*; diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/game/in_main_menu.rs b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/game/in_main_menu.rs index cecd13a..c1a4b8b 100644 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/game/in_main_menu.rs +++ b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/game/in_main_menu.rs @@ -1,6 +1,5 @@ use bevy::prelude::*; - -use crate::state::{AppState, GameState, InMainMenu}; +use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu}; pub fn setup_main_menu(mut commands: Commands) { commands.spawn((Camera2dBundle::default(), InMainMenu)); diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/game/mod.rs b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/game/mod.rs index c2febcd..438f85e 100644 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/game/mod.rs +++ b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/game/mod.rs @@ -1,104 +1,16 @@ pub mod in_game; -use bevy_xpbd_3d::prelude::{Collision, CollisionEnded, CollisionStarted}; pub use in_game::*; pub mod in_main_menu; pub use in_main_menu::*; -pub mod picking; -pub use picking::*; - -use crate::{ - insert_dependant_component, - state::{AppState, GameState}, -}; use bevy::prelude::*; - -// this file is just for demo purposes, contains various types of components, systems etc - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum SoundMaterial { - Metal, - Wood, - Rock, - Cloth, - Squishy, - #[default] - None, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Player; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo component showing auto injection of components -pub struct ShouldBeWithPlayer; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Interactible; - -fn player_move_demo( - keycode: Res>, - mut players: Query<&mut Transform, With>, -) { - let speed = 0.2; - if let Ok(mut player) = players.get_single_mut() { - if keycode.pressed(KeyCode::Left) { - player.translation.x += speed; - } - if keycode.pressed(KeyCode::Right) { - player.translation.x -= speed; - } - - if keycode.pressed(KeyCode::Up) { - player.translation.z += speed; - } - if keycode.pressed(KeyCode::Down) { - player.translation.z -= speed; - } - } -} - -// collision tests/debug -pub fn test_collision_events( - mut collision_started_events: EventReader, - mut collision_ended_events: EventReader, -) { - for CollisionStarted(entity1, entity2) in collision_started_events.read() { - println!("collision started") - } - - for CollisionEnded(entity1, entity2) in collision_ended_events.read() { - println!("collision ended") - } -} +use bevy_gltf_worlflow_examples_common::{AppState, GameState}; pub struct GamePlugin; impl Plugin for GamePlugin { fn build(&self, app: &mut App) { - app.add_plugins(PickingPlugin) - .register_type::() - .register_type::() - .register_type::() - // little helper utility, to automatically inject components that are dependant on an other component - // ie, here an Entity with a Player component should also always have a ShouldBeWithPlayer component - // you get a warning if you use this, as I consider this to be stop-gap solution (usually you should have either a bundle, or directly define all needed components) - .add_systems( - Update, - ( - // insert_dependant_component::, - player_move_demo, //.run_if(in_state(AppState::Running)), - test_collision_events, - spawn_test, - ) - .run_if(in_state(GameState::InGame)), - ) + app.add_systems(Update, (spawn_test,).run_if(in_state(GameState::InGame))) .add_systems(OnEnter(AppState::MenuRunning), setup_main_menu) .add_systems(OnExit(AppState::MenuRunning), teardown_main_menu) .add_systems(Update, main_menu.run_if(in_state(AppState::MenuRunning))) diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/game/picking.rs b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/game/picking.rs deleted file mode 100644 index 6731bbb..0000000 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/game/picking.rs +++ /dev/null @@ -1,34 +0,0 @@ -use super::Player; -use bevy::prelude::*; -use bevy_gltf_blueprints::GltfBlueprintsSet; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub struct Pickable; - -// very simple, crude picking (as in picking up objects) implementation - -pub fn picking( - players: Query<&GlobalTransform, With>, - pickables: Query<(Entity, &GlobalTransform), With>, - mut commands: Commands, -) { - for player_transforms in players.iter() { - for (pickable, pickable_transforms) in pickables.iter() { - let distance = player_transforms - .translation() - .distance(pickable_transforms.translation()); - if distance < 2.5 { - commands.entity(pickable).despawn_recursive(); - } - } - } -} - -pub struct PickingPlugin; -impl Plugin for PickingPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .add_systems(Update, (picking.after(GltfBlueprintsSet::AfterSpawn),)); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/main.rs b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/main.rs index 6edba33..8fca426 100644 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/main.rs +++ b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/main.rs @@ -1,15 +1,10 @@ use bevy::prelude::*; use bevy_editor_pls::prelude::*; +use bevy_gltf_worlflow_examples_common::CommonPlugin; mod core; use crate::core::*; -pub mod assets; -use assets::*; - -pub mod state; -use state::*; - mod game; use game::*; @@ -23,8 +18,7 @@ fn main() { // editor EditorPlugin::default(), // our custom plugins - StatePlugin, - AssetsPlugin, + CommonPlugin, CorePlugin, // reusable plugins GamePlugin, // specific to our game ComponentsTestPlugin, // Showcases different type of components /structs diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/state.rs b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/state.rs deleted file mode 100644 index 8e983d9..0000000 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/state.rs +++ /dev/null @@ -1,54 +0,0 @@ -use bevy::app::AppExit; -use bevy::prelude::*; - -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, States)] -pub enum AppState { - #[default] - CoreLoading, - MenuRunning, - AppLoading, - AppRunning, - AppEnding, - - // FIXME: not sure - LoadingGame, -} - -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, States)] -pub enum GameState { - #[default] - None, - - InMenu, - InGame, - - InGameOver, - - InSaving, - InLoading, -} - -// tag components for all entities within a certain state (for despawning them if needed) , FIXME: seems kinda hack-ish -#[derive(Component)] -pub struct InCoreLoading; -#[derive(Component, Default)] -pub struct InMenuRunning; -#[derive(Component)] -pub struct InAppLoading; -#[derive(Component)] -pub struct InAppRunning; - -// components for tagging in game vs in game menu stuff -#[derive(Component, Default)] -pub struct InMainMenu; -#[derive(Component, Default)] -pub struct InMenu; -#[derive(Component, Default)] -pub struct InGame; - -pub struct StatePlugin; -impl Plugin for StatePlugin { - fn build(&self, app: &mut App) { - app.add_state::().add_state::(); - } -} diff --git a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/test_components.rs b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/test_components.rs index d0e6fbd..b5384e2 100644 --- a/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/test_components.rs +++ b/examples/bevy_gltf_blueprints/basic_xpbd_physics/src/test_components.rs @@ -6,39 +6,39 @@ struct UnitTest; #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -struct TuppleTestF32(f32); +struct TupleTestF32(f32); #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -struct TuppleTestU64(u64); +struct TupleTestU64(u64); #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -pub struct TuppleTestStr(String); +pub struct TupleTestStr(String); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTest2(f32, u64, String); +struct TupleTest2(f32, u64, String); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTestBool(bool); +struct TupleTestBool(bool); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec2(Vec2); +struct TupleVec2(Vec2); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec3(Vec3); +struct TupleVec3(Vec3); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec(Vec); +struct TupleVec(Vec); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTestColor(Color); +struct TupleTestColor(Color); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] @@ -65,16 +65,16 @@ impl Plugin for ComponentsTestPlugin { fn build(&self, app: &mut App) { app.register_type::() .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() .register_type::() - .register_type::() - .register_type::() + .register_type::() + .register_type::() .register_type::>(); } } diff --git a/examples/bevy_gltf_blueprints/materials/Cargo.toml b/examples/bevy_gltf_blueprints/materials/Cargo.toml index b5862d1..7a4098d 100644 --- a/examples/bevy_gltf_blueprints/materials/Cargo.toml +++ b/examples/bevy_gltf_blueprints/materials/Cargo.toml @@ -7,6 +7,8 @@ license = "MIT OR Apache-2.0" [dependencies] bevy="0.12" bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" } +bevy_gltf_worlflow_examples_common = { path = "../../common" } + bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] } bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]} bevy_editor_pls = { version = "0.6" } diff --git a/examples/bevy_gltf_blueprints/materials/src/assets/assets_core.rs b/examples/bevy_gltf_blueprints/materials/src/assets/assets_core.rs deleted file mode 100644 index 29b577a..0000000 --- a/examples/bevy_gltf_blueprints/materials/src/assets/assets_core.rs +++ /dev/null @@ -1,5 +0,0 @@ -use bevy::prelude::*; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct CoreAssets {} diff --git a/examples/bevy_gltf_blueprints/materials/src/assets/assets_game.rs b/examples/bevy_gltf_blueprints/materials/src/assets/assets_game.rs deleted file mode 100644 index 2176b33..0000000 --- a/examples/bevy_gltf_blueprints/materials/src/assets/assets_game.rs +++ /dev/null @@ -1,16 +0,0 @@ -use bevy::gltf::Gltf; -use bevy::prelude::*; -use bevy::utils::HashMap; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct GameAssets { - #[asset(key = "world")] - pub world: Handle, - - #[asset(key = "models", collection(typed, mapped))] - pub models: HashMap>, - - #[asset(key = "materials", collection(typed, mapped))] - pub materials: HashMap>, -} diff --git a/examples/bevy_gltf_blueprints/materials/src/assets/mod.rs b/examples/bevy_gltf_blueprints/materials/src/assets/mod.rs deleted file mode 100644 index a2c8b22..0000000 --- a/examples/bevy_gltf_blueprints/materials/src/assets/mod.rs +++ /dev/null @@ -1,35 +0,0 @@ -pub mod assets_core; -pub use assets_core::*; - -pub mod assets_game; -pub use assets_game::*; - -use bevy::prelude::*; -use bevy_asset_loader::prelude::*; - -use crate::state::AppState; - -pub struct AssetsPlugin; -impl Plugin for AssetsPlugin { - fn build(&self, app: &mut App) { - 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), - ) - .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); - } -} diff --git a/examples/bevy_gltf_blueprints/materials/src/core/camera/camera_replace_proxies.rs b/examples/bevy_gltf_blueprints/materials/src/core/camera/camera_replace_proxies.rs deleted file mode 100644 index 9055c95..0000000 --- a/examples/bevy_gltf_blueprints/materials/src/core/camera/camera_replace_proxies.rs +++ /dev/null @@ -1,24 +0,0 @@ -use bevy::core_pipeline::bloom::{BloomCompositeMode, BloomSettings}; -use bevy::core_pipeline::tonemapping::{DebandDither, Tonemapping}; -use bevy::prelude::*; - -use super::CameraTrackingOffset; - -pub fn camera_replace_proxies( - mut commands: Commands, - mut added_cameras: Query<(Entity, &mut Camera), (Added, With)>, -) { - for (entity, mut camera) in added_cameras.iter_mut() { - info!("detected added camera, updating proxy"); - camera.hdr = true; - commands - .entity(entity) - .insert(DebandDither::Enabled) - .insert(Tonemapping::BlenderFilmic) - .insert(BloomSettings { - intensity: 0.01, - composite_mode: BloomCompositeMode::Additive, - ..default() - }); - } -} diff --git a/examples/bevy_gltf_blueprints/materials/src/core/camera/camera_tracking.rs b/examples/bevy_gltf_blueprints/materials/src/core/camera/camera_tracking.rs deleted file mode 100644 index 62da84d..0000000 --- a/examples/bevy_gltf_blueprints/materials/src/core/camera/camera_tracking.rs +++ /dev/null @@ -1,58 +0,0 @@ -use bevy::prelude::*; - -#[derive(Component, Reflect, Debug)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -/// -pub struct CameraTracking { - pub offset: Vec3, -} -impl Default for CameraTracking { - fn default() -> Self { - CameraTracking { - offset: Vec3::new(0.0, 6.0, 8.0), - } - } -} - -#[derive(Component, Reflect, Debug, Deref, DerefMut)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -pub struct CameraTrackingOffset(Vec3); -impl Default for CameraTrackingOffset { - fn default() -> Self { - CameraTrackingOffset(Vec3::new(0.0, 6.0, 8.0)) - } -} - -impl CameraTrackingOffset { - fn new(input: Vec3) -> Self { - CameraTrackingOffset(input) - } -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Add this component to an entity if you want it to be tracked by a Camera -pub struct CameraTrackable; - -pub fn camera_track( - mut tracking_cameras: Query< - (&mut Transform, &CameraTrackingOffset), - ( - With, - With, - Without, - ), - >, - camera_tracked: Query<&Transform, With>, -) { - for (mut camera_transform, tracking_offset) in tracking_cameras.iter_mut() { - for tracked_transform in camera_tracked.iter() { - let target_position = tracked_transform.translation + tracking_offset.0; - let eased_position = camera_transform.translation.lerp(target_position, 0.1); - camera_transform.translation = eased_position; // + tracking.offset;// tracked_transform.translation + tracking.offset; - *camera_transform = camera_transform.looking_at(tracked_transform.translation, Vec3::Y); - } - } -} diff --git a/examples/bevy_gltf_blueprints/materials/src/core/camera/mod.rs b/examples/bevy_gltf_blueprints/materials/src/core/camera/mod.rs deleted file mode 100644 index a6bbb65..0000000 --- a/examples/bevy_gltf_blueprints/materials/src/core/camera/mod.rs +++ /dev/null @@ -1,24 +0,0 @@ -pub mod camera_tracking; -pub use camera_tracking::*; - -pub mod camera_replace_proxies; -pub use camera_replace_proxies::*; - -use bevy::prelude::*; -use bevy_gltf_blueprints::GltfBlueprintsSet; - -pub struct CameraPlugin; -impl Plugin for CameraPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .register_type::() - .register_type::() - .add_systems( - Update, - ( - camera_replace_proxies.after(GltfBlueprintsSet::AfterSpawn), - camera_track, - ), - ); - } -} diff --git a/examples/bevy_gltf_blueprints/materials/src/core/lighting/lighting_replace_proxies.rs b/examples/bevy_gltf_blueprints/materials/src/core/lighting/lighting_replace_proxies.rs deleted file mode 100644 index 48c0908..0000000 --- a/examples/bevy_gltf_blueprints/materials/src/core/lighting/lighting_replace_proxies.rs +++ /dev/null @@ -1,25 +0,0 @@ -use bevy::prelude::*; - -use bevy::pbr::{CascadeShadowConfig, CascadeShadowConfigBuilder}; - -// fixme might be too specific to might needs, should it be moved out ? also these are all for lights, not models -pub fn lighting_replace_proxies( - mut added_dirights: Query<(Entity, &mut DirectionalLight), Added>, - mut added_spotlights: Query<&mut SpotLight, Added>, - mut commands: Commands, -) { - for (entity, mut light) in added_dirights.iter_mut() { - light.illuminance *= 5.0; - light.shadows_enabled = true; - let shadow_config: CascadeShadowConfig = CascadeShadowConfigBuilder { - first_cascade_far_bound: 15.0, - maximum_distance: 135.0, - ..default() - } - .into(); - commands.entity(entity).insert(shadow_config); - } - for mut light in added_spotlights.iter_mut() { - light.shadows_enabled = true; - } -} diff --git a/examples/bevy_gltf_blueprints/materials/src/core/lighting/mod.rs b/examples/bevy_gltf_blueprints/materials/src/core/lighting/mod.rs deleted file mode 100644 index c9688cd..0000000 --- a/examples/bevy_gltf_blueprints/materials/src/core/lighting/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -mod lighting_replace_proxies; -use lighting_replace_proxies::*; - -use bevy::pbr::{DirectionalLightShadowMap, NotShadowCaster}; -use bevy::prelude::*; - -pub struct LightingPlugin; -impl Plugin for LightingPlugin { - fn build(&self, app: &mut App) { - app - .insert_resource(DirectionalLightShadowMap { size: 4096 }) - // FIXME: adding these since they are missing - .register_type::() - - .add_systems(PreUpdate, lighting_replace_proxies) // FIXME: you should actually run this in a specific state most likely - ; - } -} diff --git a/examples/bevy_gltf_blueprints/materials/src/core/mod.rs b/examples/bevy_gltf_blueprints/materials/src/core/mod.rs index 610f205..37d9f8c 100644 --- a/examples/bevy_gltf_blueprints/materials/src/core/mod.rs +++ b/examples/bevy_gltf_blueprints/materials/src/core/mod.rs @@ -1,30 +1,13 @@ -pub mod camera; -pub use camera::*; - -pub mod lighting; -pub use lighting::*; - -pub mod relationships; -pub use relationships::*; - -pub mod physics; -pub use physics::*; - use bevy::prelude::*; use bevy_gltf_blueprints::*; pub struct CorePlugin; impl Plugin for CorePlugin { fn build(&self, app: &mut App) { - app.add_plugins(( - LightingPlugin, - CameraPlugin, - PhysicsPlugin, - BlueprintsPlugin { - library_folder: "models/library".into(), - material_library: true, - ..Default::default() - }, - )); + app.add_plugins((BlueprintsPlugin { + library_folder: "models/library".into(), + material_library: true, + ..Default::default() + },)); } } diff --git a/examples/bevy_gltf_blueprints/materials/src/core/physics/controls.rs b/examples/bevy_gltf_blueprints/materials/src/core/physics/controls.rs deleted file mode 100644 index a138d7c..0000000 --- a/examples/bevy_gltf_blueprints/materials/src/core/physics/controls.rs +++ /dev/null @@ -1,25 +0,0 @@ -use bevy::{ - ecs::system::Res, - input::{keyboard::KeyCode, Input}, - prelude::{info, ResMut}, -}; -use bevy_rapier3d::{prelude::RapierConfiguration, render::DebugRenderContext}; - -pub fn pause_physics(mut physics_config: ResMut) { - info!("pausing physics"); - physics_config.physics_pipeline_active = false; -} - -pub fn resume_physics(mut physics_config: ResMut) { - info!("unpausing physics"); - physics_config.physics_pipeline_active = true; -} - -pub fn toggle_physics_debug( - mut debug_config: ResMut, - keycode: Res>, -) { - if keycode.just_pressed(KeyCode::D) { - debug_config.enabled = !debug_config.enabled; - } -} diff --git a/examples/bevy_gltf_blueprints/materials/src/core/physics/mod.rs b/examples/bevy_gltf_blueprints/materials/src/core/physics/mod.rs deleted file mode 100644 index 3b64090..0000000 --- a/examples/bevy_gltf_blueprints/materials/src/core/physics/mod.rs +++ /dev/null @@ -1,34 +0,0 @@ -pub mod physics_replace_proxies; -pub use physics_replace_proxies::*; - -pub mod utils; - -pub mod controls; -pub use controls::*; - -use crate::state::GameState; -use bevy::prelude::*; -use bevy_gltf_blueprints::GltfBlueprintsSet; -use bevy_rapier3d::{ - prelude::{NoUserData, RapierPhysicsPlugin}, - render::RapierDebugRenderPlugin, -}; - -pub struct PhysicsPlugin; -impl Plugin for PhysicsPlugin { - fn build(&self, app: &mut App) { - app.add_plugins(( - RapierPhysicsPlugin::::default(), - RapierDebugRenderPlugin::default(), - )) - .register_type::() - .register_type::() - .add_systems( - Update, - physics_replace_proxies.after(GltfBlueprintsSet::AfterSpawn), - ) - .add_systems(Update, toggle_physics_debug) - .add_systems(OnEnter(GameState::InGame), resume_physics) - .add_systems(OnExit(GameState::InGame), pause_physics); - } -} diff --git a/examples/bevy_gltf_blueprints/materials/src/core/physics/physics_replace_proxies.rs b/examples/bevy_gltf_blueprints/materials/src/core/physics/physics_replace_proxies.rs deleted file mode 100644 index b91462c..0000000 --- a/examples/bevy_gltf_blueprints/materials/src/core/physics/physics_replace_proxies.rs +++ /dev/null @@ -1,101 +0,0 @@ -use bevy::prelude::*; -// use bevy::render::primitives::Aabb; -use bevy_rapier3d::geometry::Collider as RapierCollider; -use bevy_rapier3d::prelude::{ActiveCollisionTypes, ActiveEvents, ComputedColliderShape}; - -use super::utils::*; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum Collider { - Ball(f32), - Cuboid(Vec3), - Capsule(Vec3, Vec3, f32), - #[default] - Mesh, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum AutoAABBCollider { - #[default] - Cuboid, - Ball, - Capsule, -} - -// replaces all physics stand-ins with the actual rapier types -pub fn physics_replace_proxies( - meshes: Res>, - mesh_handles: Query<&Handle>, - mut proxy_colliders: Query< - (Entity, &Collider, &Name, &mut Visibility), - (Without, Added), - >, - // needed for tri meshes - children: Query<&Children>, - - mut commands: Commands, -) { - for proxy_colider in proxy_colliders.iter_mut() { - let (entity, collider_proxy, name, mut visibility) = proxy_colider; - // we hide the collider meshes: perhaps they should be removed altogether once processed ? - if name.ends_with("_collider") || name.ends_with("_sensor") { - *visibility = Visibility::Hidden; - } - - let mut rapier_collider: RapierCollider; - match collider_proxy { - Collider::Ball(radius) => { - info!("generating collider from proxy: ball"); - rapier_collider = RapierCollider::ball(*radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Cuboid(size) => { - info!("generating collider from proxy: cuboid"); - rapier_collider = RapierCollider::cuboid(size.x, size.y, size.z); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Capsule(a, b, radius) => { - info!("generating collider from proxy: capsule"); - rapier_collider = RapierCollider::capsule(*a, *b, *radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Mesh => { - info!("generating collider from proxy: mesh"); - for (_, collider_mesh) in - Mesh::search_in_children(entity, &children, &meshes, &mesh_handles) - { - rapier_collider = RapierCollider::from_bevy_mesh( - collider_mesh, - &ComputedColliderShape::TriMesh, - ) - .unwrap(); - commands - .entity(entity) - .insert(rapier_collider) - // FIXME: this is just for demo purposes !!! - .insert( - ActiveCollisionTypes::default() - | ActiveCollisionTypes::KINEMATIC_STATIC - | ActiveCollisionTypes::STATIC_STATIC - | ActiveCollisionTypes::DYNAMIC_STATIC, - ) - .insert(ActiveEvents::COLLISION_EVENTS); - // .insert(ActiveEvents::COLLISION_EVENTS) - // break; - // RapierCollider::convex_hull(points) - } - } - } - } -} diff --git a/examples/bevy_gltf_blueprints/materials/src/core/physics/utils.rs b/examples/bevy_gltf_blueprints/materials/src/core/physics/utils.rs deleted file mode 100644 index 7886710..0000000 --- a/examples/bevy_gltf_blueprints/materials/src/core/physics/utils.rs +++ /dev/null @@ -1,175 +0,0 @@ -use bevy::prelude::*; -use bevy::render::mesh::{MeshVertexAttributeId, PrimitiveTopology, VertexAttributeValues}; -// TAKEN VERBATIB FROM https://github.com/janhohenheim/foxtrot/blob/src/util/trait_extension.rs - -pub(crate) trait Vec3Ext: Copy { - fn is_approx_zero(self) -> bool; - fn split(self, up: Vec3) -> SplitVec3; -} -impl Vec3Ext for Vec3 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn split(self, up: Vec3) -> SplitVec3 { - let vertical = up * self.dot(up); - let horizontal = self - vertical; - SplitVec3 { - vertical, - horizontal, - } - } -} - -#[derive(Debug, Clone, Copy, PartialEq)] -pub(crate) struct SplitVec3 { - pub(crate) vertical: Vec3, - pub(crate) horizontal: Vec3, -} - -pub(crate) trait Vec2Ext: Copy { - fn is_approx_zero(self) -> bool; - fn x0y(self) -> Vec3; -} -impl Vec2Ext for Vec2 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn x0y(self) -> Vec3 { - Vec3::new(self.x, 0., self.y) - } -} - -pub(crate) trait MeshExt { - fn transform(&mut self, transform: Transform); - fn transformed(&self, transform: Transform) -> Mesh; - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]>; - fn search_in_children<'a>( - parent: Entity, - children: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)>; -} - -impl MeshExt for Mesh { - fn transform(&mut self, transform: Transform) { - for coords in self.read_coords_mut(Mesh::ATTRIBUTE_POSITION.clone()) { - let vec3 = (*coords).into(); - let transformed = transform.transform_point(vec3); - *coords = transformed.into(); - } - for normal in self.read_coords_mut(Mesh::ATTRIBUTE_NORMAL.clone()) { - let vec3 = (*normal).into(); - let transformed = transform.rotation.mul_vec3(vec3); - *normal = transformed.into(); - } - } - - fn transformed(&self, transform: Transform) -> Mesh { - let mut mesh = self.clone(); - mesh.transform(transform); - mesh - } - - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]> { - // Guaranteed by Bevy for the current usage - match self - .attribute_mut(id) - .expect("Failed to read unknown mesh attribute") - { - VertexAttributeValues::Float32x3(values) => values, - // Guaranteed by Bevy for the current usage - _ => unreachable!(), - } - } - - fn search_in_children<'a>( - parent: Entity, - children_query: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)> { - if let Ok(children) = children_query.get(parent) { - let mut result: Vec<_> = children - .iter() - .filter_map(|entity| mesh_handles.get(*entity).ok().map(|mesh| (*entity, mesh))) - .map(|(entity, mesh_handle)| { - ( - entity, - meshes - .get(mesh_handle) - .expect("Failed to get mesh from handle"), - ) - }) - .map(|(entity, mesh)| { - assert_eq!(mesh.primitive_topology(), PrimitiveTopology::TriangleList); - (entity, mesh) - }) - .collect(); - let mut inner_result = children - .iter() - .flat_map(|entity| { - Self::search_in_children(*entity, children_query, meshes, mesh_handles) - }) - .collect(); - result.append(&mut inner_result); - result - } else { - Vec::new() - } - } -} - -pub(crate) trait F32Ext: Copy { - fn is_approx_zero(self) -> bool; - fn squared(self) -> f32; - fn lerp(self, other: f32, ratio: f32) -> f32; -} - -impl F32Ext for f32 { - #[inline] - fn is_approx_zero(self) -> bool { - self.abs() < 1e-5 - } - - #[inline] - fn squared(self) -> f32 { - self * self - } - - #[inline] - fn lerp(self, other: f32, ratio: f32) -> f32 { - self.mul_add(1. - ratio, other * ratio) - } -} - -pub(crate) trait TransformExt: Copy { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform; - fn lerp(self, other: Transform, ratio: f32) -> Transform; -} - -impl TransformExt for Transform { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform { - let direction = target - self.translation; - let horizontal_direction = direction - up * direction.dot(up); - let look_target = self.translation + horizontal_direction; - self.looking_at(look_target, up) - } - - fn lerp(self, other: Transform, ratio: f32) -> Transform { - let translation = self.translation.lerp(other.translation, ratio); - let rotation = self.rotation.slerp(other.rotation, ratio); - let scale = self.scale.lerp(other.scale, ratio); - Transform { - translation, - rotation, - scale, - } - } -} diff --git a/examples/bevy_gltf_blueprints/materials/src/core/relationships/mod.rs b/examples/bevy_gltf_blueprints/materials/src/core/relationships/mod.rs deleted file mode 100644 index 4128453..0000000 --- a/examples/bevy_gltf_blueprints/materials/src/core/relationships/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub mod relationships_insert_dependant_components; -pub use relationships_insert_dependant_components::*; - -use bevy::prelude::*; - -pub struct EcsRelationshipsPlugin; -impl Plugin for EcsRelationshipsPlugin { - fn build(&self, app: &mut App) { - app; - } -} diff --git a/examples/bevy_gltf_blueprints/materials/src/core/relationships/relationships_insert_dependant_components.rs b/examples/bevy_gltf_blueprints/materials/src/core/relationships/relationships_insert_dependant_components.rs deleted file mode 100644 index 4e9ad17..0000000 --- a/examples/bevy_gltf_blueprints/materials/src/core/relationships/relationships_insert_dependant_components.rs +++ /dev/null @@ -1,15 +0,0 @@ -use bevy::prelude::*; - -pub fn insert_dependant_component< - Dependant: Component, - Dependency: Component + std::default::Default, ->( - mut commands: Commands, - entities_without_depency: Query<(Entity, &Name), (With, Without)>, -) { - for (entity, name) in entities_without_depency.iter() { - let name = name.clone().to_string(); - commands.entity(entity).insert(Dependency::default()); - warn!("found an entity called {} with a {} component but without an {}, please check your assets", name.clone(), std::any::type_name::(), std::any::type_name::()); - } -} 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 579f193..2338956 100644 --- a/examples/bevy_gltf_blueprints/materials/src/game/in_game.rs +++ b/examples/bevy_gltf_blueprints/materials/src/game/in_game.rs @@ -1,26 +1,17 @@ +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 rand::Rng; -use std::time::Duration; - -use bevy::prelude::*; - -use crate::{ - assets::GameAssets, - state::{GameState, InAppRunning}, -}; -use bevy_gltf_blueprints::{ - AnimationPlayerLink, Animations, BluePrintBundle, BlueprintName, GameWorldTag, -}; - -use super::{Fox, Player, Robot}; pub fn setup_game( mut commands: Commands, game_assets: Res, models: Res>, - mut next_game_state: ResMut>, ) { + println!("setting up all stuff"); commands.insert_resource(AmbientLight { color: Color::WHITE, brightness: 0.2, @@ -45,6 +36,10 @@ pub fn setup_game( next_game_state.set(GameState::InGame) } +#[derive(Component, Reflect, Default, Debug)] +#[reflect(Component)] +struct UnregisteredComponent; + pub fn spawn_test( keycode: Res>, mut commands: Commands, @@ -56,7 +51,7 @@ pub fn spawn_test( let world = world.1[0]; let mut rng = rand::thread_rng(); - let range = 8.5; + let range = 5.5; let x: f32 = rng.gen_range(-range..range); let y: f32 = rng.gen_range(-range..range); @@ -71,13 +66,13 @@ pub fn spawn_test( let new_entity = commands .spawn(( BluePrintBundle { - blueprint: BlueprintName("Watermelon2".to_string()), + blueprint: BlueprintName("Health_Pickup".to_string()), ..Default::default() }, - bevy::prelude::Name::from(format!("Watermelon{}", name_index)), + bevy::prelude::Name::from(format!("test{}", name_index)), // BlueprintName("Health_Pickup".to_string()), // SpawnHere, - TransformBundle::from_transform(Transform::from_xyz(x, 3.0, y)), + 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), @@ -88,220 +83,46 @@ pub fn spawn_test( } } -// example of changing animation of entities based on proximity to the player, for "fox" entities (Tag component) -pub fn animation_change_on_proximity_foxes( - players: Query<&GlobalTransform, With>, - animated_foxes: Query<(&GlobalTransform, &AnimationPlayerLink, &Animations), With>, - - mut animation_players: Query<&mut AnimationPlayer>, -) { - for player_transforms in players.iter() { - for (fox_tranforms, link, animations) in animated_foxes.iter() { - let distance = player_transforms - .translation() - .distance(fox_tranforms.translation()); - let mut anim_name = "Walk"; - if distance < 8.5 { - anim_name = "Run"; - } else if distance >= 8.5 && distance < 10.0 { - anim_name = "Walk"; - } else if distance >= 10.0 && distance < 15.0 { - anim_name = "Survey"; - } - // now play the animation based on the chosen animation name - let mut animation_player = animation_players.get_mut(link.0).unwrap(); - animation_player - .play_with_transition( - animations - .named_animations - .get(anim_name) - .expect("animation name should be in the list") - .clone(), - Duration::from_secs(3), - ) - .repeat(); - } - } -} - -// example of changing animation of entities based on proximity to the player, this time for the "robot" entities (Tag component) -pub fn animation_change_on_proximity_robots( - players: Query<&GlobalTransform, With>, - animated_robots: Query<(&GlobalTransform, &AnimationPlayerLink, &Animations), With>, - - mut animation_players: Query<&mut AnimationPlayer>, -) { - for player_transforms in players.iter() { - for (robot_tranforms, link, animations) in animated_robots.iter() { - let distance = player_transforms - .translation() - .distance(robot_tranforms.translation()); - - let mut anim_name = "Idle"; - if distance < 8.5 { - anim_name = "Jump"; - } else if distance >= 8.5 && distance < 10.0 { - anim_name = "Scan"; - } else if distance >= 10.0 && distance < 15.0 { - anim_name = "Idle"; - } - - // now play the animation based on the chosen animation name - let mut animation_player = animation_players.get_mut(link.0).unwrap(); - animation_player - .play_with_transition( - animations - .named_animations - .get(anim_name) - .expect("animation name should be in the list") - .clone(), - Duration::from_secs(3), - ) - .repeat(); - } - } -} - -pub fn animation_control( - animated_enemies: Query<(&AnimationPlayerLink, &Animations), With>, - animated_foxes: Query<(&AnimationPlayerLink, &Animations), With>, - - mut animation_players: Query<&mut AnimationPlayer>, - +pub fn spawn_test_unregisted_components( keycode: Res>, - // mut entities_with_animations : Query<(&mut AnimationPlayer, &mut Animations)>, + mut commands: Commands, + + mut game_world: Query<(Entity, &Children), With>, ) { - // robots - if keycode.just_pressed(KeyCode::B) { - for (link, animations) in animated_enemies.iter() { - let mut animation_player = animation_players.get_mut(link.0).unwrap(); - let anim_name = "Scan"; - animation_player - .play_with_transition( - animations - .named_animations - .get(anim_name) - .expect("animation name should be in the list") - .clone(), - Duration::from_secs(5), - ) - .repeat(); - } + 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); } - - // foxes - if keycode.just_pressed(KeyCode::W) { - for (link, animations) in animated_foxes.iter() { - let mut animation_player = animation_players.get_mut(link.0).unwrap(); - let anim_name = "Walk"; - animation_player - .play_with_transition( - animations - .named_animations - .get(anim_name) - .expect("animation name should be in the list") - .clone(), - Duration::from_secs(5), - ) - .repeat(); - } - } - - if keycode.just_pressed(KeyCode::X) { - for (link, animations) in animated_foxes.iter() { - let mut animation_player = animation_players.get_mut(link.0).unwrap(); - let anim_name = "Run"; - animation_player - .play_with_transition( - animations - .named_animations - .get(anim_name) - .expect("animation name should be in the list") - .clone(), - Duration::from_secs(5), - ) - .repeat(); - } - } - - if keycode.just_pressed(KeyCode::C) { - for (link, animations) in animated_foxes.iter() { - let mut animation_player = animation_players.get_mut(link.0).unwrap(); - let anim_name = "Survey"; - animation_player - .play_with_transition( - animations - .named_animations - .get(anim_name) - .expect("animation name should be in the list") - .clone(), - Duration::from_secs(5), - ) - .repeat(); - } - } - - /* Improveement ideas for the future - // a bit more ideal API - if keycode.just_pressed(KeyCode::B) { - for (animation_player, animations) in animated_enemies.iter() { - let anim_name = "Scan"; - if animations.named_animations.contains_key(anim_name) { - let clip = animations.named_animations.get(anim_name).unwrap(); - animation_player.play_with_transition(clip.clone(), Duration::from_secs(5)).repeat(); - } - } - } - - // even better API - if keycode.just_pressed(KeyCode::B) { - for (animation_player, animations) in animated_enemies.iter() { - animation_player.play_with_transition("Scan", Duration::from_secs(5)).repeat(); // with a merged animationPlayer + animations storage - // alternative, perhaps more realistic, and better seperation of concerns - animation_player.play_with_transition(animations, "Scan", Duration::from_secs(5)).repeat(); - - } - }*/ - - /*for (mut anim_player, animations) in entities_with_animations.iter_mut(){ - - if keycode.just_pressed(KeyCode::W) { - let anim_name = "Walk"; - if animations.named_animations.contains_key(anim_name) { - let clip = animations.named_animations.get(anim_name).unwrap(); - anim_player.play_with_transition(clip.clone(), Duration::from_secs(5)).repeat(); - } - } - if keycode.just_pressed(KeyCode::X) { - let anim_name = "Run"; - if animations.named_animations.contains_key(anim_name) { - let clip = animations.named_animations.get(anim_name).unwrap(); - anim_player.play_with_transition(clip.clone(), Duration::from_secs(5)).repeat(); - } - } - if keycode.just_pressed(KeyCode::C) { - let anim_name = "Survey"; - if animations.named_animations.contains_key(anim_name) { - let clip = animations.named_animations.get(anim_name).unwrap(); - anim_player.play_with_transition(clip.clone(), Duration::from_secs(5)).repeat(); - } - } - - - - if keycode.just_pressed(KeyCode::S) { - let anim_name = "Scan"; - if animations.named_animations.contains_key(anim_name) { - let clip = animations.named_animations.get(anim_name).unwrap(); - anim_player.play_with_transition(clip.clone(), Duration::from_secs(5)).repeat(); - } - } - if keycode.just_pressed(KeyCode::I) { - let anim_name = "Idle"; - if animations.named_animations.contains_key(anim_name) { - let clip = animations.named_animations.get(anim_name).unwrap(); - anim_player.play_with_transition(clip.clone(), Duration::from_secs(5)).repeat(); - } - } - }*/ } diff --git a/examples/bevy_gltf_blueprints/materials/src/game/in_main_menu.rs b/examples/bevy_gltf_blueprints/materials/src/game/in_main_menu.rs index 0420be5..c1a4b8b 100644 --- a/examples/bevy_gltf_blueprints/materials/src/game/in_main_menu.rs +++ b/examples/bevy_gltf_blueprints/materials/src/game/in_main_menu.rs @@ -1,6 +1,5 @@ use bevy::prelude::*; - -use crate::state::{AppState, GameState, InMainMenu}; +use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu}; pub fn setup_main_menu(mut commands: Commands) { commands.spawn((Camera2dBundle::default(), InMainMenu)); @@ -94,6 +93,8 @@ pub fn main_menu( 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) { next_app_state.set(AppState::AppLoading); diff --git a/examples/bevy_gltf_blueprints/materials/src/game/mod.rs b/examples/bevy_gltf_blueprints/materials/src/game/mod.rs index 69a5ae4..b236141 100644 --- a/examples/bevy_gltf_blueprints/materials/src/game/mod.rs +++ b/examples/bevy_gltf_blueprints/materials/src/game/mod.rs @@ -4,125 +4,19 @@ pub use in_game::*; pub mod in_main_menu; pub use in_main_menu::*; -pub mod picking; -pub use picking::*; - -use crate::{ - insert_dependant_component, - state::{AppState, GameState}, -}; use bevy::prelude::*; -use bevy_rapier3d::prelude::*; - -// this file is just for demo purposes, contains various types of components, systems etc - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum SoundMaterial { - Metal, - Wood, - Rock, - Cloth, - Squishy, - #[default] - None, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Player; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo component showing auto injection of components -pub struct ShouldBeWithPlayer; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Interactible; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Fox; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Robot; - -fn player_move_demo( - keycode: Res>, - mut players: Query<&mut Transform, With>, -) { - let speed = 0.2; - if let Ok(mut player) = players.get_single_mut() { - if keycode.pressed(KeyCode::Left) { - player.translation.x += speed; - } - if keycode.pressed(KeyCode::Right) { - player.translation.x -= speed; - } - - if keycode.pressed(KeyCode::Up) { - player.translation.z += speed; - } - if keycode.pressed(KeyCode::Down) { - player.translation.z -= speed; - } - } -} - -// collision tests/debug -pub fn test_collision_events( - mut collision_events: EventReader, - mut contact_force_events: EventReader, -) { - for collision_event in collision_events.iter() { - println!("collision"); - match collision_event { - CollisionEvent::Started(_entity1, _entity2, _) => { - println!("collision started") - } - CollisionEvent::Stopped(_entity1, _entity2, _) => { - println!("collision ended") - } - } - } - - for contact_force_event in contact_force_events.iter() { - println!("Received contact force event: {:?}", contact_force_event); - } -} +use bevy_gltf_worlflow_examples_common::{AppState, GameState}; pub struct GamePlugin; impl Plugin for GamePlugin { fn build(&self, app: &mut App) { - app.add_plugins(PickingPlugin) - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - // little helper utility, to automatically inject components that are dependant on an other component - // ie, here an Entity with a Player component should also always have a ShouldBeWithPlayer component - // you get a warning if you use this, as I consider this to be stop-gap solution (usually you should have either a bundle, or directly define all needed components) - .add_systems( - Update, - ( - player_move_demo, - spawn_test, - animation_control, - animation_change_on_proximity_foxes, - animation_change_on_proximity_robots, - ) - .run_if(in_state(GameState::InGame)), - ) - .add_systems(OnEnter(AppState::MenuRunning), setup_main_menu) - .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); + app.add_systems( + Update, + (spawn_test, spawn_test_unregisted_components).run_if(in_state(GameState::InGame)), + ) + .add_systems(OnEnter(AppState::MenuRunning), setup_main_menu) + .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); } } diff --git a/examples/bevy_gltf_blueprints/materials/src/game/picking.rs b/examples/bevy_gltf_blueprints/materials/src/game/picking.rs deleted file mode 100644 index 23988c8..0000000 --- a/examples/bevy_gltf_blueprints/materials/src/game/picking.rs +++ /dev/null @@ -1,37 +0,0 @@ -use super::Player; -use bevy::prelude::*; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub struct Pickable; - -// very simple, crude picking (as in picking up objects) implementation - -pub fn picking( - players: Query<&GlobalTransform, With>, - pickables: Query<(Entity, &GlobalTransform), With>, - mut commands: Commands, -) { - for player_transforms in players.iter() { - for (pickable, pickable_transforms) in pickables.iter() { - let distance = player_transforms - .translation() - .distance(pickable_transforms.translation()); - if distance < 2.5 { - commands.entity(pickable).despawn_recursive(); - } - } - } -} - -pub struct PickingPlugin; -impl Plugin for PickingPlugin { - fn build(&self, app: &mut App) { - app.register_type::().add_systems( - Update, - ( - picking, //.run_if(in_state(AppState::Running)), - ), - ); - } -} diff --git a/examples/bevy_gltf_blueprints/materials/src/main.rs b/examples/bevy_gltf_blueprints/materials/src/main.rs index 6edba33..8fca426 100644 --- a/examples/bevy_gltf_blueprints/materials/src/main.rs +++ b/examples/bevy_gltf_blueprints/materials/src/main.rs @@ -1,15 +1,10 @@ use bevy::prelude::*; use bevy_editor_pls::prelude::*; +use bevy_gltf_worlflow_examples_common::CommonPlugin; mod core; use crate::core::*; -pub mod assets; -use assets::*; - -pub mod state; -use state::*; - mod game; use game::*; @@ -23,8 +18,7 @@ fn main() { // editor EditorPlugin::default(), // our custom plugins - StatePlugin, - AssetsPlugin, + CommonPlugin, CorePlugin, // reusable plugins GamePlugin, // specific to our game ComponentsTestPlugin, // Showcases different type of components /structs diff --git a/examples/bevy_gltf_blueprints/materials/src/state.rs b/examples/bevy_gltf_blueprints/materials/src/state.rs deleted file mode 100644 index 8e983d9..0000000 --- a/examples/bevy_gltf_blueprints/materials/src/state.rs +++ /dev/null @@ -1,54 +0,0 @@ -use bevy::app::AppExit; -use bevy::prelude::*; - -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, States)] -pub enum AppState { - #[default] - CoreLoading, - MenuRunning, - AppLoading, - AppRunning, - AppEnding, - - // FIXME: not sure - LoadingGame, -} - -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, States)] -pub enum GameState { - #[default] - None, - - InMenu, - InGame, - - InGameOver, - - InSaving, - InLoading, -} - -// tag components for all entities within a certain state (for despawning them if needed) , FIXME: seems kinda hack-ish -#[derive(Component)] -pub struct InCoreLoading; -#[derive(Component, Default)] -pub struct InMenuRunning; -#[derive(Component)] -pub struct InAppLoading; -#[derive(Component)] -pub struct InAppRunning; - -// components for tagging in game vs in game menu stuff -#[derive(Component, Default)] -pub struct InMainMenu; -#[derive(Component, Default)] -pub struct InMenu; -#[derive(Component, Default)] -pub struct InGame; - -pub struct StatePlugin; -impl Plugin for StatePlugin { - fn build(&self, app: &mut App) { - app.add_state::().add_state::(); - } -} diff --git a/examples/bevy_gltf_blueprints/materials/src/test_components.rs b/examples/bevy_gltf_blueprints/materials/src/test_components.rs index 52ca6ca..fd78506 100644 --- a/examples/bevy_gltf_blueprints/materials/src/test_components.rs +++ b/examples/bevy_gltf_blueprints/materials/src/test_components.rs @@ -2,39 +2,39 @@ use bevy::prelude::*; #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -struct TuppleTestF32(f32); +struct TupleTestF32(f32); #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -struct TuppleTestU64(u64); +struct TupleTestU64(u64); #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -pub struct TuppleTestStr(String); +pub struct TupleTestStr(String); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTest2(f32, u64, String); +struct TupleTest2(f32, u64, String); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTestBool(bool); +struct TupleTestBool(bool); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec2(Vec2); +struct TupleVec2(Vec2); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec3(Vec3); +struct TupleVec3(Vec3); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec(Vec); +struct TupleVec(Vec); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTestColor(Color); +struct TupleTestColor(Color); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] @@ -60,16 +60,16 @@ pub struct ComponentsTestPlugin; impl Plugin for ComponentsTestPlugin { fn build(&self, app: &mut App) { app.register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() .register_type::() - .register_type::() - .register_type::() + .register_type::() + .register_type::() .register_type::>(); } } diff --git a/examples/bevy_gltf_blueprints/multiple_levels/README.md b/examples/bevy_gltf_blueprints/multiple_levels/README.md deleted file mode 100644 index 9db2461..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/README.md +++ /dev/null @@ -1,12 +0,0 @@ -# Multiple levels example/demo - -This example showcases multiple levels, and using triggers to load another level. -It currently has NO state persistence between levels. -You can press "D" to toggle the physics debug view. - - -## Running this example - -``` -cargo run --features bevy/dynamic_linking -``` diff --git a/examples/bevy_gltf_blueprints/multiple_levels/assets/assets_core.assets.ron b/examples/bevy_gltf_blueprints/multiple_levels/assets/assets_core.assets.ron deleted file mode 100644 index 8d0a099..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/assets/assets_core.assets.ron +++ /dev/null @@ -1 +0,0 @@ -({}) \ No newline at end of file diff --git a/examples/bevy_gltf_blueprints/multiple_levels/assets/assets_game.assets.ron b/examples/bevy_gltf_blueprints/multiple_levels/assets/assets_game.assets.ron deleted file mode 100644 index 974fc50..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/assets/assets_game.assets.ron +++ /dev/null @@ -1,9 +0,0 @@ -({ - "world":File (path: "models/StartLevel.glb"), - "level1":File (path: "models/Level1.glb"), - "level2":File (path: "models/Level2.glb"), - - "models": Folder ( - path: "models/library", - ), -}) \ No newline at end of file diff --git a/examples/bevy_gltf_blueprints/multiple_levels/assets/models/Level1.glb b/examples/bevy_gltf_blueprints/multiple_levels/assets/models/Level1.glb deleted file mode 100644 index e92ef5e..0000000 Binary files a/examples/bevy_gltf_blueprints/multiple_levels/assets/models/Level1.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/multiple_levels/assets/models/Level2.glb b/examples/bevy_gltf_blueprints/multiple_levels/assets/models/Level2.glb deleted file mode 100644 index 19e30e7..0000000 Binary files a/examples/bevy_gltf_blueprints/multiple_levels/assets/models/Level2.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/multiple_levels/assets/models/StartLevel.glb b/examples/bevy_gltf_blueprints/multiple_levels/assets/models/StartLevel.glb deleted file mode 100644 index b4899f5..0000000 Binary files a/examples/bevy_gltf_blueprints/multiple_levels/assets/models/StartLevel.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/Container.glb b/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/Container.glb deleted file mode 100644 index 9bf40cc..0000000 Binary files a/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/Container.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/Health_Pickup.glb b/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/Health_Pickup.glb deleted file mode 100644 index 4643320..0000000 Binary files a/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/Health_Pickup.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/LevelTransition.glb b/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/LevelTransition.glb deleted file mode 100644 index 99e7325..0000000 Binary files a/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/LevelTransition.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/MagicTeapot.glb b/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/MagicTeapot.glb deleted file mode 100644 index 63dc035..0000000 Binary files a/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/MagicTeapot.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/Pillar.glb b/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/Pillar.glb deleted file mode 100644 index 891122c..0000000 Binary files a/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/Pillar.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/Player.glb b/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/Player.glb deleted file mode 100644 index a7ef15f..0000000 Binary files a/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/Player.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/Unused_in_level_test.glb b/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/Unused_in_level_test.glb deleted file mode 100644 index b5937bb..0000000 Binary files a/examples/bevy_gltf_blueprints/multiple_levels/assets/models/library/Unused_in_level_test.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/multiple_levels/assets/multiple_levels.blend b/examples/bevy_gltf_blueprints/multiple_levels/assets/multiple_levels.blend deleted file mode 100644 index 7148411..0000000 Binary files a/examples/bevy_gltf_blueprints/multiple_levels/assets/multiple_levels.blend and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/assets/assets_core.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/assets/assets_core.rs deleted file mode 100644 index 29b577a..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/assets/assets_core.rs +++ /dev/null @@ -1,5 +0,0 @@ -use bevy::prelude::*; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct CoreAssets {} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/assets/assets_game.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/assets/assets_game.rs deleted file mode 100644 index c65934f..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/assets/assets_game.rs +++ /dev/null @@ -1,16 +0,0 @@ -use bevy::gltf::Gltf; -use bevy::prelude::*; -use bevy::utils::HashMap; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct GameAssets { - #[asset(key = "world")] - pub world: Handle, - #[asset(key = "level1")] - pub level1: Handle, - #[asset(key = "level2")] - pub level2: Handle, - #[asset(key = "models", collection(typed, mapped))] - pub models: HashMap>, -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/assets/mod.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/assets/mod.rs deleted file mode 100644 index a2c8b22..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/assets/mod.rs +++ /dev/null @@ -1,35 +0,0 @@ -pub mod assets_core; -pub use assets_core::*; - -pub mod assets_game; -pub use assets_game::*; - -use bevy::prelude::*; -use bevy_asset_loader::prelude::*; - -use crate::state::AppState; - -pub struct AssetsPlugin; -impl Plugin for AssetsPlugin { - fn build(&self, app: &mut App) { - 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), - ) - .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); - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/core/camera/camera_replace_proxies.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/core/camera/camera_replace_proxies.rs deleted file mode 100644 index 9055c95..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/core/camera/camera_replace_proxies.rs +++ /dev/null @@ -1,24 +0,0 @@ -use bevy::core_pipeline::bloom::{BloomCompositeMode, BloomSettings}; -use bevy::core_pipeline::tonemapping::{DebandDither, Tonemapping}; -use bevy::prelude::*; - -use super::CameraTrackingOffset; - -pub fn camera_replace_proxies( - mut commands: Commands, - mut added_cameras: Query<(Entity, &mut Camera), (Added, With)>, -) { - for (entity, mut camera) in added_cameras.iter_mut() { - info!("detected added camera, updating proxy"); - camera.hdr = true; - commands - .entity(entity) - .insert(DebandDither::Enabled) - .insert(Tonemapping::BlenderFilmic) - .insert(BloomSettings { - intensity: 0.01, - composite_mode: BloomCompositeMode::Additive, - ..default() - }); - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/core/camera/camera_tracking.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/core/camera/camera_tracking.rs deleted file mode 100644 index 71b0ed7..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/core/camera/camera_tracking.rs +++ /dev/null @@ -1,81 +0,0 @@ -use bevy::prelude::*; - -#[derive(Component, Reflect, Debug)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -/// -pub struct CameraTracking { - pub offset: Vec3, -} -impl Default for CameraTracking { - fn default() -> Self { - CameraTracking { - offset: Vec3::new(0.0, 6.0, 8.0), - } - } -} - -#[derive(Component, Reflect, Debug, Deref, DerefMut)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -pub struct CameraTrackingOffset(Vec3); -impl Default for CameraTrackingOffset { - fn default() -> Self { - CameraTrackingOffset(Vec3::new(0.0, 6.0, 8.0)) - } -} - -impl CameraTrackingOffset { - fn new(input: Vec3) -> Self { - CameraTrackingOffset(input) - } -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Add this component to an entity if you want it to be tracked by a Camera -pub struct CameraTrackable; - -// this system ensures that the camera is at the correct position immediatly after spawning -pub fn init_camera_track( - mut tracking_cameras: Query< - (&mut Transform, &CameraTrackingOffset), - ( - With, - With, - Without, - ), - >, - camera_tracked: Query<&Transform, (With, Added)>, -) { - for (mut camera_transform, tracking_offset) in tracking_cameras.iter_mut() { - for tracked_transform in camera_tracked.iter() { - println!("ADDED tracking camera"); - - let target_position = tracked_transform.translation + tracking_offset.0; - camera_transform.translation = target_position; - *camera_transform = camera_transform.looking_at(tracked_transform.translation, Vec3::Y); - } - } -} - -pub fn camera_track( - mut tracking_cameras: Query< - (&mut Transform, &CameraTrackingOffset), - ( - With, - With, - Without, - ), - >, - camera_tracked: Query<&Transform, With>, -) { - for (mut camera_transform, tracking_offset) in tracking_cameras.iter_mut() { - for tracked_transform in camera_tracked.iter() { - let target_position = tracked_transform.translation + tracking_offset.0; - let eased_position = camera_transform.translation.lerp(target_position, 0.1); - camera_transform.translation = eased_position; // + tracking.offset;// tracked_transform.translation + tracking.offset; - *camera_transform = camera_transform.looking_at(tracked_transform.translation, Vec3::Y); - } - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/core/camera/mod.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/core/camera/mod.rs deleted file mode 100644 index 216183c..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/core/camera/mod.rs +++ /dev/null @@ -1,25 +0,0 @@ -pub mod camera_tracking; -pub use camera_tracking::*; - -pub mod camera_replace_proxies; -pub use camera_replace_proxies::*; - -use bevy::prelude::*; -use bevy_gltf_blueprints::GltfBlueprintsSet; - -pub struct CameraPlugin; -impl Plugin for CameraPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .register_type::() - .register_type::() - .add_systems( - Update, - ( - camera_replace_proxies.after(GltfBlueprintsSet::AfterSpawn), - init_camera_track, - camera_track, - ), - ); - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/core/lighting/lighting_replace_proxies.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/core/lighting/lighting_replace_proxies.rs deleted file mode 100644 index 729ba44..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/core/lighting/lighting_replace_proxies.rs +++ /dev/null @@ -1,31 +0,0 @@ -use bevy::prelude::*; - -use bevy::pbr::{CascadeShadowConfig, CascadeShadowConfigBuilder}; - -pub fn lighting_replace_proxies( - mut added_dirights: Query<(Entity, &mut DirectionalLight), Added>, - mut added_spotlights: Query<&mut SpotLight, Added>, - mut added_pointlights: Query<&mut PointLight, Added>, - - mut commands: Commands, -) { - for (entity, mut light) in added_dirights.iter_mut() { - light.illuminance *= 5.0; - light.shadows_enabled = true; - let shadow_config: CascadeShadowConfig = CascadeShadowConfigBuilder { - first_cascade_far_bound: 15.0, - maximum_distance: 135.0, - ..default() - } - .into(); - commands.entity(entity).insert(shadow_config); - } - for mut light in added_spotlights.iter_mut() { - light.shadows_enabled = true; - } - - for mut light in added_pointlights.iter_mut() { - light.intensity *= 0.001; // arbitrary/ eyeballed to match the levels of Blender - light.shadows_enabled = true; - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/core/lighting/mod.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/core/lighting/mod.rs deleted file mode 100644 index c9688cd..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/core/lighting/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -mod lighting_replace_proxies; -use lighting_replace_proxies::*; - -use bevy::pbr::{DirectionalLightShadowMap, NotShadowCaster}; -use bevy::prelude::*; - -pub struct LightingPlugin; -impl Plugin for LightingPlugin { - fn build(&self, app: &mut App) { - app - .insert_resource(DirectionalLightShadowMap { size: 4096 }) - // FIXME: adding these since they are missing - .register_type::() - - .add_systems(PreUpdate, lighting_replace_proxies) // FIXME: you should actually run this in a specific state most likely - ; - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/core/mod.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/core/mod.rs deleted file mode 100644 index 3271ad4..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/core/mod.rs +++ /dev/null @@ -1,29 +0,0 @@ -pub mod camera; -pub use camera::*; - -pub mod lighting; -pub use lighting::*; - -pub mod relationships; -pub use relationships::*; - -pub mod physics; -pub use physics::*; - -use bevy::prelude::*; -use bevy_gltf_blueprints::*; - -pub struct CorePlugin; -impl Plugin for CorePlugin { - fn build(&self, app: &mut App) { - app.add_plugins(( - LightingPlugin, - CameraPlugin, - PhysicsPlugin, - BlueprintsPlugin { - library_folder: "models/library".into(), - ..Default::default() - }, - )); - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/core/physics/controls.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/core/physics/controls.rs deleted file mode 100644 index 433128e..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/core/physics/controls.rs +++ /dev/null @@ -1,21 +0,0 @@ -use bevy::prelude::{info, Input, KeyCode, Res, ResMut}; -use bevy_rapier3d::{prelude::RapierConfiguration, render::DebugRenderContext}; - -pub fn pause_physics(mut physics_config: ResMut) { - info!("pausing physics"); - physics_config.physics_pipeline_active = false; -} - -pub fn resume_physics(mut physics_config: ResMut) { - info!("unpausing physics"); - physics_config.physics_pipeline_active = true; -} - -pub fn toggle_physics_debug( - mut debug_config: ResMut, - keycode: Res>, -) { - if keycode.just_pressed(KeyCode::D) { - debug_config.enabled = !debug_config.enabled; - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/core/physics/mod.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/core/physics/mod.rs deleted file mode 100644 index c9fa115..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/core/physics/mod.rs +++ /dev/null @@ -1,36 +0,0 @@ -pub mod physics_replace_proxies; -use bevy_rapier3d::{ - prelude::{NoUserData, RapierPhysicsPlugin}, - render::RapierDebugRenderPlugin, -}; -pub use physics_replace_proxies::*; - -pub mod utils; - -pub mod controls; -pub use controls::*; - -use crate::state::GameState; -use bevy::prelude::*; -// use super::blueprints::GltfBlueprintsSet; -use bevy_gltf_blueprints::GltfBlueprintsSet; -// use crate::Collider; -pub struct PhysicsPlugin; -impl Plugin for PhysicsPlugin { - fn build(&self, app: &mut App) { - app.add_plugins(( - RapierPhysicsPlugin::::default(), - RapierDebugRenderPlugin::default(), - )) - .register_type::() - .register_type::() - .add_systems( - Update, - physics_replace_proxies.after(GltfBlueprintsSet::AfterSpawn), - ) - // physics controls - .add_systems(OnEnter(GameState::InGame), resume_physics) - .add_systems(OnExit(GameState::InGame), pause_physics) - .add_systems(Update, toggle_physics_debug); - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/core/physics/physics_replace_proxies.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/core/physics/physics_replace_proxies.rs deleted file mode 100644 index 7e4d5fc..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/core/physics/physics_replace_proxies.rs +++ /dev/null @@ -1,102 +0,0 @@ -use bevy::prelude::*; -// use bevy::render::primitives::Aabb; -use bevy_rapier3d::geometry::Collider as RapierCollider; -use bevy_rapier3d::prelude::{ActiveCollisionTypes, ActiveEvents, ComputedColliderShape}; - -use super::utils::*; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum Collider { - Ball(f32), - Cuboid(Vec3), - Capsule(Vec3, Vec3, f32), - #[default] - Mesh, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum AutoAABBCollider { - #[default] - Cuboid, - Ball, - Capsule, -} - -// replaces all physics stand-ins with the actual rapier types -pub fn physics_replace_proxies( - meshes: Res>, - mesh_handles: Query<&Handle>, - mut proxy_colliders: Query< - (Entity, &Collider, &Name, &mut Visibility), - (Without, Added), - >, - // needed for tri meshes - children: Query<&Children>, - - mut commands: Commands, -) { - for proxy_colider in proxy_colliders.iter_mut() { - let (entity, collider_proxy, name, mut visibility) = proxy_colider; - // we hide the collider meshes: perhaps they should be removed altogether once processed ? - if name.ends_with("_collider") || name.ends_with("_sensor") { - *visibility = Visibility::Hidden; - } - // also entities marked with collider names are actually children colliders - - let mut rapier_collider: RapierCollider; - match collider_proxy { - Collider::Ball(radius) => { - info!("generating collider from proxy: ball"); - rapier_collider = RapierCollider::ball(*radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Cuboid(size) => { - info!("generating collider from proxy: cuboid"); - rapier_collider = RapierCollider::cuboid(size.x, size.y, size.z); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Capsule(a, b, radius) => { - info!("generating collider from proxy: capsule"); - rapier_collider = RapierCollider::capsule(*a, *b, *radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Mesh => { - info!("generating collider from proxy: mesh"); - for (_, collider_mesh) in - Mesh::search_in_children(entity, &children, &meshes, &mesh_handles) - { - rapier_collider = RapierCollider::from_bevy_mesh( - collider_mesh, - &ComputedColliderShape::TriMesh, - ) - .unwrap(); - commands - .entity(entity) - .insert(rapier_collider) - // FIXME: this is just for demo purposes !!! - .insert( - ActiveCollisionTypes::default() - | ActiveCollisionTypes::KINEMATIC_STATIC - | ActiveCollisionTypes::STATIC_STATIC - | ActiveCollisionTypes::DYNAMIC_STATIC, - ) - .insert(ActiveEvents::COLLISION_EVENTS); - // .insert(ActiveEvents::COLLISION_EVENTS) - // break; - // RapierCollider::convex_hull(points) - } - } - } - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/core/physics/utils.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/core/physics/utils.rs deleted file mode 100644 index 7886710..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/core/physics/utils.rs +++ /dev/null @@ -1,175 +0,0 @@ -use bevy::prelude::*; -use bevy::render::mesh::{MeshVertexAttributeId, PrimitiveTopology, VertexAttributeValues}; -// TAKEN VERBATIB FROM https://github.com/janhohenheim/foxtrot/blob/src/util/trait_extension.rs - -pub(crate) trait Vec3Ext: Copy { - fn is_approx_zero(self) -> bool; - fn split(self, up: Vec3) -> SplitVec3; -} -impl Vec3Ext for Vec3 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn split(self, up: Vec3) -> SplitVec3 { - let vertical = up * self.dot(up); - let horizontal = self - vertical; - SplitVec3 { - vertical, - horizontal, - } - } -} - -#[derive(Debug, Clone, Copy, PartialEq)] -pub(crate) struct SplitVec3 { - pub(crate) vertical: Vec3, - pub(crate) horizontal: Vec3, -} - -pub(crate) trait Vec2Ext: Copy { - fn is_approx_zero(self) -> bool; - fn x0y(self) -> Vec3; -} -impl Vec2Ext for Vec2 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn x0y(self) -> Vec3 { - Vec3::new(self.x, 0., self.y) - } -} - -pub(crate) trait MeshExt { - fn transform(&mut self, transform: Transform); - fn transformed(&self, transform: Transform) -> Mesh; - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]>; - fn search_in_children<'a>( - parent: Entity, - children: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)>; -} - -impl MeshExt for Mesh { - fn transform(&mut self, transform: Transform) { - for coords in self.read_coords_mut(Mesh::ATTRIBUTE_POSITION.clone()) { - let vec3 = (*coords).into(); - let transformed = transform.transform_point(vec3); - *coords = transformed.into(); - } - for normal in self.read_coords_mut(Mesh::ATTRIBUTE_NORMAL.clone()) { - let vec3 = (*normal).into(); - let transformed = transform.rotation.mul_vec3(vec3); - *normal = transformed.into(); - } - } - - fn transformed(&self, transform: Transform) -> Mesh { - let mut mesh = self.clone(); - mesh.transform(transform); - mesh - } - - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]> { - // Guaranteed by Bevy for the current usage - match self - .attribute_mut(id) - .expect("Failed to read unknown mesh attribute") - { - VertexAttributeValues::Float32x3(values) => values, - // Guaranteed by Bevy for the current usage - _ => unreachable!(), - } - } - - fn search_in_children<'a>( - parent: Entity, - children_query: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)> { - if let Ok(children) = children_query.get(parent) { - let mut result: Vec<_> = children - .iter() - .filter_map(|entity| mesh_handles.get(*entity).ok().map(|mesh| (*entity, mesh))) - .map(|(entity, mesh_handle)| { - ( - entity, - meshes - .get(mesh_handle) - .expect("Failed to get mesh from handle"), - ) - }) - .map(|(entity, mesh)| { - assert_eq!(mesh.primitive_topology(), PrimitiveTopology::TriangleList); - (entity, mesh) - }) - .collect(); - let mut inner_result = children - .iter() - .flat_map(|entity| { - Self::search_in_children(*entity, children_query, meshes, mesh_handles) - }) - .collect(); - result.append(&mut inner_result); - result - } else { - Vec::new() - } - } -} - -pub(crate) trait F32Ext: Copy { - fn is_approx_zero(self) -> bool; - fn squared(self) -> f32; - fn lerp(self, other: f32, ratio: f32) -> f32; -} - -impl F32Ext for f32 { - #[inline] - fn is_approx_zero(self) -> bool { - self.abs() < 1e-5 - } - - #[inline] - fn squared(self) -> f32 { - self * self - } - - #[inline] - fn lerp(self, other: f32, ratio: f32) -> f32 { - self.mul_add(1. - ratio, other * ratio) - } -} - -pub(crate) trait TransformExt: Copy { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform; - fn lerp(self, other: Transform, ratio: f32) -> Transform; -} - -impl TransformExt for Transform { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform { - let direction = target - self.translation; - let horizontal_direction = direction - up * direction.dot(up); - let look_target = self.translation + horizontal_direction; - self.looking_at(look_target, up) - } - - fn lerp(self, other: Transform, ratio: f32) -> Transform { - let translation = self.translation.lerp(other.translation, ratio); - let rotation = self.rotation.slerp(other.rotation, ratio); - let scale = self.scale.lerp(other.scale, ratio); - Transform { - translation, - rotation, - scale, - } - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/core/relationships/mod.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/core/relationships/mod.rs deleted file mode 100644 index 4128453..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/core/relationships/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub mod relationships_insert_dependant_components; -pub use relationships_insert_dependant_components::*; - -use bevy::prelude::*; - -pub struct EcsRelationshipsPlugin; -impl Plugin for EcsRelationshipsPlugin { - fn build(&self, app: &mut App) { - app; - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/core/relationships/relationships_insert_dependant_components.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/core/relationships/relationships_insert_dependant_components.rs deleted file mode 100644 index 4e9ad17..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/core/relationships/relationships_insert_dependant_components.rs +++ /dev/null @@ -1,15 +0,0 @@ -use bevy::prelude::*; - -pub fn insert_dependant_component< - Dependant: Component, - Dependency: Component + std::default::Default, ->( - mut commands: Commands, - entities_without_depency: Query<(Entity, &Name), (With, Without)>, -) { - for (entity, name) in entities_without_depency.iter() { - let name = name.clone().to_string(); - commands.entity(entity).insert(Dependency::default()); - warn!("found an entity called {} with a {} component but without an {}, please check your assets", name.clone(), std::any::type_name::(), std::any::type_name::()); - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/game/in_game.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/game/in_game.rs deleted file mode 100644 index 4047b83..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/game/in_game.rs +++ /dev/null @@ -1,84 +0,0 @@ -use bevy::prelude::*; - -use crate::{ - assets::GameAssets, - state::{GameState, InAppRunning}, -}; -use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag}; - -use bevy_rapier3d::prelude::Velocity; -use rand::Rng; - -pub fn setup_game( - mut commands: Commands, - game_assets: Res, - models: Res>, - mut next_game_state: ResMut>, -) { - println!("setting up all stuff"); - /*commands.insert_resource(AmbientLight { - color: Color::WHITE, - brightness: 0.2, - });*/ - // here we actually spawn our game world/level - - commands.spawn(( - SceneBundle { - // note: because of this issue https://github.com/bevyengine/bevy/issues/10436, "world" is now a gltf file instead of a scene - scene: models - .get(game_assets.world.id()) - .expect("main level should have been loaded") - .scenes[0] - .clone(), - ..default() - }, - bevy::prelude::Name::from("world"), - GameWorldTag, - InAppRunning, - )); - - next_game_state.set(GameState::InGame) -} - -pub fn spawn_test( - keycode: Res>, - mut commands: Commands, - - mut game_world: Query<(Entity, &Children), With>, -) { - if keycode.just_pressed(KeyCode::T) { - 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), - }, - )) - .id(); - commands.entity(world).add_child(new_entity); - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/game/in_main_menu.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/game/in_main_menu.rs deleted file mode 100644 index cecd13a..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/game/in_main_menu.rs +++ /dev/null @@ -1,113 +0,0 @@ -use bevy::prelude::*; - -use crate::state::{AppState, GameState, InMainMenu}; - -pub fn setup_main_menu(mut commands: Commands) { - commands.spawn((Camera2dBundle::default(), InMainMenu)); - - commands.spawn(( - TextBundle::from_section( - "SOME GAME TITLE !!", - TextStyle { - //font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 18.0, - color: Color::WHITE, - ..Default::default() - }, - ) - .with_style(Style { - position_type: PositionType::Absolute, - top: Val::Px(100.0), - left: Val::Px(200.0), - ..default() - }), - InMainMenu, - )); - - commands.spawn(( - TextBundle::from_section( - "New Game (press Enter to start, press T once the game is started for demo spawning)", - TextStyle { - //font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 18.0, - color: Color::WHITE, - ..Default::default() - }, - ) - .with_style(Style { - position_type: PositionType::Absolute, - top: Val::Px(200.0), - left: Val::Px(200.0), - ..default() - }), - InMainMenu, - )); - - /* - commands.spawn(( - TextBundle::from_section( - "Load Game", - TextStyle { - //font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 18.0, - color: Color::WHITE, - ..Default::default() - }, - ) - .with_style(Style { - position_type: PositionType::Absolute, - top: Val::Px(250.0), - left: Val::Px(200.0), - ..default() - }), - InMainMenu - )); - - commands.spawn(( - TextBundle::from_section( - "Exit Game", - TextStyle { - //font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 18.0, - color: Color::WHITE, - ..Default::default() - }, - ) - .with_style(Style { - position_type: PositionType::Absolute, - top: Val::Px(300.0), - left: Val::Px(200.0), - ..default() - }), - InMainMenu - ));*/ -} - -pub fn teardown_main_menu(bla: Query>, mut commands: Commands) { - for bli in bla.iter() { - commands.entity(bli).despawn_recursive(); - } -} - -pub fn main_menu( - 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) { - 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() }) - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/game/level_transitions.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/game/level_transitions.rs deleted file mode 100644 index ca676f9..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/game/level_transitions.rs +++ /dev/null @@ -1,86 +0,0 @@ -use crate::{assets::GameAssets, state::InAppRunning}; -use bevy::prelude::*; -use bevy_gltf_blueprints::GameWorldTag; -use bevy_rapier3d::prelude::*; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub struct LevelTransition { - pub target: String, -} - -// very barebones example of triggering level transitions -pub fn trigger_level_transition( - mut collision_events: EventReader, - level_transition_triggers: Query<&LevelTransition>, - parents: Query<&Parent>, - - mut commands: Commands, - game_assets: Res, - models: Res>, - - game_world: Query<(Entity, &GameWorldTag)>, -) { - for collision_event in collision_events.read() { - match collision_event { - CollisionEvent::Started(entity1, entity2, _) => { - // we need to accomodate for the fact that the collider may be a child of the level transition (FIXME: is this a missunderstanding on my part about rapier child colliders ?) - let entity1_parent = parents.get(*entity1).unwrap(); - let entity2_parent = parents.get(*entity2).unwrap(); - if level_transition_triggers.get(*entity1).is_ok() - || level_transition_triggers.get(*entity2).is_ok() - || level_transition_triggers.get(entity1_parent.get()).is_ok() - || level_transition_triggers.get(entity2_parent.get()).is_ok() - { - println!("collision started, we can transition to level"); - let transition_trigger; - if level_transition_triggers.get(*entity1).is_ok() { - transition_trigger = level_transition_triggers.get(*entity1).unwrap(); - } else if level_transition_triggers.get(*entity2).is_ok() { - transition_trigger = level_transition_triggers.get(*entity2).unwrap(); - } else if level_transition_triggers.get(entity1_parent.get()).is_ok() { - transition_trigger = - level_transition_triggers.get(entity1_parent.get()).unwrap(); - } else { - transition_trigger = - level_transition_triggers.get(entity2_parent.get()).unwrap(); - } - let current_game_world = game_world.single(); - - // remove current level/world - info!("despawning current level"); - commands.entity(current_game_world.0).despawn_recursive(); - - let target_level = &transition_trigger.target; - let level; - println!("target level {}", target_level); - if target_level == "Level1" { - level = &game_assets.level1; - } else if (target_level == "Level2") { - level = &game_assets.level2; - } else { - level = &game_assets.world; - } - info!("spawning new level"); - commands.spawn(( - SceneBundle { - // note: because of this issue https://github.com/bevyengine/bevy/issues/10436, "world" is now a gltf file instead of a scene - scene: models - .get(level.id()) - .expect("main level should have been loaded") - .scenes[0] - .clone(), - ..default() - }, - bevy::prelude::Name::from("world"), - GameWorldTag, - InAppRunning, - )); - } - } - CollisionEvent::Stopped(_entity1, _entity2, _) => { - // println!("collision ended") - } - } - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/game/mod.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/game/mod.rs deleted file mode 100644 index 80bdcc1..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/game/mod.rs +++ /dev/null @@ -1,121 +0,0 @@ -pub mod in_game; -pub use in_game::*; - -pub mod in_main_menu; -pub use in_main_menu::*; - -pub mod picking; -pub use picking::*; - -pub mod level_transitions; -pub use level_transitions::*; - -use crate::{ - assets::GameAssets, - insert_dependant_component, - state::{AppState, GameState, InAppRunning}, -}; -use bevy::prelude::*; -use bevy_rapier3d::prelude::*; - -// this file is just for demo purposes, contains various types of components, systems etc - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum SoundMaterial { - Metal, - Wood, - Rock, - Cloth, - Squishy, - #[default] - None, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Player; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo component showing auto injection of components -pub struct ShouldBeWithPlayer; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Interactible; - -fn player_move_demo( - keycode: Res>, - mut players: Query<&mut Transform, With>, -) { - let speed = 0.2; - if let Ok(mut player) = players.get_single_mut() { - if keycode.pressed(KeyCode::Left) { - player.translation.x += speed; - } - if keycode.pressed(KeyCode::Right) { - player.translation.x -= speed; - } - - if keycode.pressed(KeyCode::Up) { - player.translation.z += speed; - } - if keycode.pressed(KeyCode::Down) { - player.translation.z -= speed; - } - } -} - -// collision tests/debug -pub fn test_collision_events( - mut collision_events: EventReader, - mut contact_force_events: EventReader, -) { - for collision_event in collision_events.read() { - println!("collision"); - match collision_event { - CollisionEvent::Started(_entity1, _entity2, _) => { - println!("collision started") - } - CollisionEvent::Stopped(_entity1, _entity2, _) => { - println!("collision ended") - } - } - } - - for contact_force_event in contact_force_events.read() { - println!("Received contact force event: {:?}", contact_force_event); - } -} - -pub struct GamePlugin; -impl Plugin for GamePlugin { - fn build(&self, app: &mut App) { - app.add_plugins(PickingPlugin) - .register_type::() - .register_type::() - .register_type::() - .register_type::() - // little helper utility, to automatically inject components that are dependant on an other component - // ie, here an Entity with a Player component should also always have a ShouldBeWithPlayer component - // you get a warning if you use this, as I consider this to be stop-gap solution (usually you should have either a bundle, or directly define all needed components) - .add_systems( - Update, - ( - // insert_dependant_component::, - player_move_demo, //.run_if(in_state(AppState::Running)), - // test_collision_events, - spawn_test, - trigger_level_transition, - ) - .run_if(in_state(GameState::InGame)), - ) - .add_systems(OnEnter(AppState::MenuRunning), setup_main_menu) - .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); - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/game/picking.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/game/picking.rs deleted file mode 100644 index 6731bbb..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/game/picking.rs +++ /dev/null @@ -1,34 +0,0 @@ -use super::Player; -use bevy::prelude::*; -use bevy_gltf_blueprints::GltfBlueprintsSet; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub struct Pickable; - -// very simple, crude picking (as in picking up objects) implementation - -pub fn picking( - players: Query<&GlobalTransform, With>, - pickables: Query<(Entity, &GlobalTransform), With>, - mut commands: Commands, -) { - for player_transforms in players.iter() { - for (pickable, pickable_transforms) in pickables.iter() { - let distance = player_transforms - .translation() - .distance(pickable_transforms.translation()); - if distance < 2.5 { - commands.entity(pickable).despawn_recursive(); - } - } - } -} - -pub struct PickingPlugin; -impl Plugin for PickingPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .add_systems(Update, (picking.after(GltfBlueprintsSet::AfterSpawn),)); - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/main.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/main.rs deleted file mode 100644 index 6edba33..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/main.rs +++ /dev/null @@ -1,33 +0,0 @@ -use bevy::prelude::*; -use bevy_editor_pls::prelude::*; - -mod core; -use crate::core::*; - -pub mod assets; -use assets::*; - -pub mod state; -use state::*; - -mod game; -use game::*; - -mod test_components; -use test_components::*; - -fn main() { - App::new() - .add_plugins(( - DefaultPlugins.set(AssetPlugin::default()), - // editor - EditorPlugin::default(), - // our custom plugins - StatePlugin, - AssetsPlugin, - CorePlugin, // reusable plugins - GamePlugin, // specific to our game - ComponentsTestPlugin, // Showcases different type of components /structs - )) - .run(); -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/state.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/state.rs deleted file mode 100644 index 8e983d9..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/state.rs +++ /dev/null @@ -1,54 +0,0 @@ -use bevy::app::AppExit; -use bevy::prelude::*; - -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, States)] -pub enum AppState { - #[default] - CoreLoading, - MenuRunning, - AppLoading, - AppRunning, - AppEnding, - - // FIXME: not sure - LoadingGame, -} - -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, States)] -pub enum GameState { - #[default] - None, - - InMenu, - InGame, - - InGameOver, - - InSaving, - InLoading, -} - -// tag components for all entities within a certain state (for despawning them if needed) , FIXME: seems kinda hack-ish -#[derive(Component)] -pub struct InCoreLoading; -#[derive(Component, Default)] -pub struct InMenuRunning; -#[derive(Component)] -pub struct InAppLoading; -#[derive(Component)] -pub struct InAppRunning; - -// components for tagging in game vs in game menu stuff -#[derive(Component, Default)] -pub struct InMainMenu; -#[derive(Component, Default)] -pub struct InMenu; -#[derive(Component, Default)] -pub struct InGame; - -pub struct StatePlugin; -impl Plugin for StatePlugin { - fn build(&self, app: &mut App) { - app.add_state::().add_state::(); - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels/src/test_components.rs b/examples/bevy_gltf_blueprints/multiple_levels/src/test_components.rs deleted file mode 100644 index d0e6fbd..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels/src/test_components.rs +++ /dev/null @@ -1,80 +0,0 @@ -use bevy::prelude::*; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct UnitTest; - -#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] -#[reflect(Component)] -struct TuppleTestF32(f32); - -#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] -#[reflect(Component)] -struct TuppleTestU64(u64); - -#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] -#[reflect(Component)] -pub struct TuppleTestStr(String); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleTest2(f32, u64, String); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleTestBool(bool); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleVec2(Vec2); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleVec3(Vec3); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleVec(Vec); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleTestColor(Color); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct BasicTest { - a: f32, - b: u64, - c: String, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum EnumTest { - Metal, - Wood, - Rock, - Cloth, - Squishy, - #[default] - None, -} - -pub struct ComponentsTestPlugin; -impl Plugin for ComponentsTestPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::>(); - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/Cargo.toml b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/Cargo.toml index 4652c4b..563fbe2 100644 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/Cargo.toml +++ b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/Cargo.toml @@ -7,6 +7,8 @@ license = "MIT OR Apache-2.0" [dependencies] bevy="0.12" bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" } +bevy_gltf_worlflow_examples_common = { path = "../../common" } + bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] } bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]} bevy_editor_pls = { version = "0.6" } diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/assets/assets_core.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/assets/assets_core.rs deleted file mode 100644 index 29b577a..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/assets/assets_core.rs +++ /dev/null @@ -1,5 +0,0 @@ -use bevy::prelude::*; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct CoreAssets {} diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/assets/assets_game.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/assets/assets_game.rs deleted file mode 100644 index 731a4a1..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/assets/assets_game.rs +++ /dev/null @@ -1,19 +0,0 @@ -use bevy::gltf::Gltf; -use bevy::prelude::*; -use bevy::utils::HashMap; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct GameAssets { - #[asset(key = "world")] - pub world: Handle, - #[asset(key = "level1")] - pub level1: Handle, - #[asset(key = "level2")] - pub level2: Handle, - #[asset(key = "models", collection(typed, mapped))] - pub models: HashMap>, - - #[asset(key = "materials", collection(typed, mapped))] - pub materials: HashMap>, -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/assets/mod.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/assets/mod.rs deleted file mode 100644 index a2c8b22..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/assets/mod.rs +++ /dev/null @@ -1,35 +0,0 @@ -pub mod assets_core; -pub use assets_core::*; - -pub mod assets_game; -pub use assets_game::*; - -use bevy::prelude::*; -use bevy_asset_loader::prelude::*; - -use crate::state::AppState; - -pub struct AssetsPlugin; -impl Plugin for AssetsPlugin { - fn build(&self, app: &mut App) { - 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), - ) - .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); - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/camera/camera_replace_proxies.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/camera/camera_replace_proxies.rs deleted file mode 100644 index 9055c95..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/camera/camera_replace_proxies.rs +++ /dev/null @@ -1,24 +0,0 @@ -use bevy::core_pipeline::bloom::{BloomCompositeMode, BloomSettings}; -use bevy::core_pipeline::tonemapping::{DebandDither, Tonemapping}; -use bevy::prelude::*; - -use super::CameraTrackingOffset; - -pub fn camera_replace_proxies( - mut commands: Commands, - mut added_cameras: Query<(Entity, &mut Camera), (Added, With)>, -) { - for (entity, mut camera) in added_cameras.iter_mut() { - info!("detected added camera, updating proxy"); - camera.hdr = true; - commands - .entity(entity) - .insert(DebandDither::Enabled) - .insert(Tonemapping::BlenderFilmic) - .insert(BloomSettings { - intensity: 0.01, - composite_mode: BloomCompositeMode::Additive, - ..default() - }); - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/camera/camera_tracking.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/camera/camera_tracking.rs deleted file mode 100644 index 71b0ed7..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/camera/camera_tracking.rs +++ /dev/null @@ -1,81 +0,0 @@ -use bevy::prelude::*; - -#[derive(Component, Reflect, Debug)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -/// -pub struct CameraTracking { - pub offset: Vec3, -} -impl Default for CameraTracking { - fn default() -> Self { - CameraTracking { - offset: Vec3::new(0.0, 6.0, 8.0), - } - } -} - -#[derive(Component, Reflect, Debug, Deref, DerefMut)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -pub struct CameraTrackingOffset(Vec3); -impl Default for CameraTrackingOffset { - fn default() -> Self { - CameraTrackingOffset(Vec3::new(0.0, 6.0, 8.0)) - } -} - -impl CameraTrackingOffset { - fn new(input: Vec3) -> Self { - CameraTrackingOffset(input) - } -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Add this component to an entity if you want it to be tracked by a Camera -pub struct CameraTrackable; - -// this system ensures that the camera is at the correct position immediatly after spawning -pub fn init_camera_track( - mut tracking_cameras: Query< - (&mut Transform, &CameraTrackingOffset), - ( - With, - With, - Without, - ), - >, - camera_tracked: Query<&Transform, (With, Added)>, -) { - for (mut camera_transform, tracking_offset) in tracking_cameras.iter_mut() { - for tracked_transform in camera_tracked.iter() { - println!("ADDED tracking camera"); - - let target_position = tracked_transform.translation + tracking_offset.0; - camera_transform.translation = target_position; - *camera_transform = camera_transform.looking_at(tracked_transform.translation, Vec3::Y); - } - } -} - -pub fn camera_track( - mut tracking_cameras: Query< - (&mut Transform, &CameraTrackingOffset), - ( - With, - With, - Without, - ), - >, - camera_tracked: Query<&Transform, With>, -) { - for (mut camera_transform, tracking_offset) in tracking_cameras.iter_mut() { - for tracked_transform in camera_tracked.iter() { - let target_position = tracked_transform.translation + tracking_offset.0; - let eased_position = camera_transform.translation.lerp(target_position, 0.1); - camera_transform.translation = eased_position; // + tracking.offset;// tracked_transform.translation + tracking.offset; - *camera_transform = camera_transform.looking_at(tracked_transform.translation, Vec3::Y); - } - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/camera/mod.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/camera/mod.rs deleted file mode 100644 index 216183c..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/camera/mod.rs +++ /dev/null @@ -1,25 +0,0 @@ -pub mod camera_tracking; -pub use camera_tracking::*; - -pub mod camera_replace_proxies; -pub use camera_replace_proxies::*; - -use bevy::prelude::*; -use bevy_gltf_blueprints::GltfBlueprintsSet; - -pub struct CameraPlugin; -impl Plugin for CameraPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .register_type::() - .register_type::() - .add_systems( - Update, - ( - camera_replace_proxies.after(GltfBlueprintsSet::AfterSpawn), - init_camera_track, - camera_track, - ), - ); - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/lighting/lighting_replace_proxies.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/lighting/lighting_replace_proxies.rs deleted file mode 100644 index 729ba44..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/lighting/lighting_replace_proxies.rs +++ /dev/null @@ -1,31 +0,0 @@ -use bevy::prelude::*; - -use bevy::pbr::{CascadeShadowConfig, CascadeShadowConfigBuilder}; - -pub fn lighting_replace_proxies( - mut added_dirights: Query<(Entity, &mut DirectionalLight), Added>, - mut added_spotlights: Query<&mut SpotLight, Added>, - mut added_pointlights: Query<&mut PointLight, Added>, - - mut commands: Commands, -) { - for (entity, mut light) in added_dirights.iter_mut() { - light.illuminance *= 5.0; - light.shadows_enabled = true; - let shadow_config: CascadeShadowConfig = CascadeShadowConfigBuilder { - first_cascade_far_bound: 15.0, - maximum_distance: 135.0, - ..default() - } - .into(); - commands.entity(entity).insert(shadow_config); - } - for mut light in added_spotlights.iter_mut() { - light.shadows_enabled = true; - } - - for mut light in added_pointlights.iter_mut() { - light.intensity *= 0.001; // arbitrary/ eyeballed to match the levels of Blender - light.shadows_enabled = true; - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/lighting/mod.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/lighting/mod.rs deleted file mode 100644 index c9688cd..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/lighting/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -mod lighting_replace_proxies; -use lighting_replace_proxies::*; - -use bevy::pbr::{DirectionalLightShadowMap, NotShadowCaster}; -use bevy::prelude::*; - -pub struct LightingPlugin; -impl Plugin for LightingPlugin { - fn build(&self, app: &mut App) { - app - .insert_resource(DirectionalLightShadowMap { size: 4096 }) - // FIXME: adding these since they are missing - .register_type::() - - .add_systems(PreUpdate, lighting_replace_proxies) // FIXME: you should actually run this in a specific state most likely - ; - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/mod.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/mod.rs index 610f205..37d9f8c 100644 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/mod.rs +++ b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/mod.rs @@ -1,30 +1,13 @@ -pub mod camera; -pub use camera::*; - -pub mod lighting; -pub use lighting::*; - -pub mod relationships; -pub use relationships::*; - -pub mod physics; -pub use physics::*; - use bevy::prelude::*; use bevy_gltf_blueprints::*; pub struct CorePlugin; impl Plugin for CorePlugin { fn build(&self, app: &mut App) { - app.add_plugins(( - LightingPlugin, - CameraPlugin, - PhysicsPlugin, - BlueprintsPlugin { - library_folder: "models/library".into(), - material_library: true, - ..Default::default() - }, - )); + app.add_plugins((BlueprintsPlugin { + library_folder: "models/library".into(), + material_library: true, + ..Default::default() + },)); } } diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/physics/controls.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/physics/controls.rs deleted file mode 100644 index 433128e..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/physics/controls.rs +++ /dev/null @@ -1,21 +0,0 @@ -use bevy::prelude::{info, Input, KeyCode, Res, ResMut}; -use bevy_rapier3d::{prelude::RapierConfiguration, render::DebugRenderContext}; - -pub fn pause_physics(mut physics_config: ResMut) { - info!("pausing physics"); - physics_config.physics_pipeline_active = false; -} - -pub fn resume_physics(mut physics_config: ResMut) { - info!("unpausing physics"); - physics_config.physics_pipeline_active = true; -} - -pub fn toggle_physics_debug( - mut debug_config: ResMut, - keycode: Res>, -) { - if keycode.just_pressed(KeyCode::D) { - debug_config.enabled = !debug_config.enabled; - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/physics/mod.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/physics/mod.rs deleted file mode 100644 index c9fa115..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/physics/mod.rs +++ /dev/null @@ -1,36 +0,0 @@ -pub mod physics_replace_proxies; -use bevy_rapier3d::{ - prelude::{NoUserData, RapierPhysicsPlugin}, - render::RapierDebugRenderPlugin, -}; -pub use physics_replace_proxies::*; - -pub mod utils; - -pub mod controls; -pub use controls::*; - -use crate::state::GameState; -use bevy::prelude::*; -// use super::blueprints::GltfBlueprintsSet; -use bevy_gltf_blueprints::GltfBlueprintsSet; -// use crate::Collider; -pub struct PhysicsPlugin; -impl Plugin for PhysicsPlugin { - fn build(&self, app: &mut App) { - app.add_plugins(( - RapierPhysicsPlugin::::default(), - RapierDebugRenderPlugin::default(), - )) - .register_type::() - .register_type::() - .add_systems( - Update, - physics_replace_proxies.after(GltfBlueprintsSet::AfterSpawn), - ) - // physics controls - .add_systems(OnEnter(GameState::InGame), resume_physics) - .add_systems(OnExit(GameState::InGame), pause_physics) - .add_systems(Update, toggle_physics_debug); - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/physics/physics_replace_proxies.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/physics/physics_replace_proxies.rs deleted file mode 100644 index 7e4d5fc..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/physics/physics_replace_proxies.rs +++ /dev/null @@ -1,102 +0,0 @@ -use bevy::prelude::*; -// use bevy::render::primitives::Aabb; -use bevy_rapier3d::geometry::Collider as RapierCollider; -use bevy_rapier3d::prelude::{ActiveCollisionTypes, ActiveEvents, ComputedColliderShape}; - -use super::utils::*; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum Collider { - Ball(f32), - Cuboid(Vec3), - Capsule(Vec3, Vec3, f32), - #[default] - Mesh, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum AutoAABBCollider { - #[default] - Cuboid, - Ball, - Capsule, -} - -// replaces all physics stand-ins with the actual rapier types -pub fn physics_replace_proxies( - meshes: Res>, - mesh_handles: Query<&Handle>, - mut proxy_colliders: Query< - (Entity, &Collider, &Name, &mut Visibility), - (Without, Added), - >, - // needed for tri meshes - children: Query<&Children>, - - mut commands: Commands, -) { - for proxy_colider in proxy_colliders.iter_mut() { - let (entity, collider_proxy, name, mut visibility) = proxy_colider; - // we hide the collider meshes: perhaps they should be removed altogether once processed ? - if name.ends_with("_collider") || name.ends_with("_sensor") { - *visibility = Visibility::Hidden; - } - // also entities marked with collider names are actually children colliders - - let mut rapier_collider: RapierCollider; - match collider_proxy { - Collider::Ball(radius) => { - info!("generating collider from proxy: ball"); - rapier_collider = RapierCollider::ball(*radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Cuboid(size) => { - info!("generating collider from proxy: cuboid"); - rapier_collider = RapierCollider::cuboid(size.x, size.y, size.z); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Capsule(a, b, radius) => { - info!("generating collider from proxy: capsule"); - rapier_collider = RapierCollider::capsule(*a, *b, *radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Mesh => { - info!("generating collider from proxy: mesh"); - for (_, collider_mesh) in - Mesh::search_in_children(entity, &children, &meshes, &mesh_handles) - { - rapier_collider = RapierCollider::from_bevy_mesh( - collider_mesh, - &ComputedColliderShape::TriMesh, - ) - .unwrap(); - commands - .entity(entity) - .insert(rapier_collider) - // FIXME: this is just for demo purposes !!! - .insert( - ActiveCollisionTypes::default() - | ActiveCollisionTypes::KINEMATIC_STATIC - | ActiveCollisionTypes::STATIC_STATIC - | ActiveCollisionTypes::DYNAMIC_STATIC, - ) - .insert(ActiveEvents::COLLISION_EVENTS); - // .insert(ActiveEvents::COLLISION_EVENTS) - // break; - // RapierCollider::convex_hull(points) - } - } - } - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/physics/utils.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/physics/utils.rs deleted file mode 100644 index 7886710..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/physics/utils.rs +++ /dev/null @@ -1,175 +0,0 @@ -use bevy::prelude::*; -use bevy::render::mesh::{MeshVertexAttributeId, PrimitiveTopology, VertexAttributeValues}; -// TAKEN VERBATIB FROM https://github.com/janhohenheim/foxtrot/blob/src/util/trait_extension.rs - -pub(crate) trait Vec3Ext: Copy { - fn is_approx_zero(self) -> bool; - fn split(self, up: Vec3) -> SplitVec3; -} -impl Vec3Ext for Vec3 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn split(self, up: Vec3) -> SplitVec3 { - let vertical = up * self.dot(up); - let horizontal = self - vertical; - SplitVec3 { - vertical, - horizontal, - } - } -} - -#[derive(Debug, Clone, Copy, PartialEq)] -pub(crate) struct SplitVec3 { - pub(crate) vertical: Vec3, - pub(crate) horizontal: Vec3, -} - -pub(crate) trait Vec2Ext: Copy { - fn is_approx_zero(self) -> bool; - fn x0y(self) -> Vec3; -} -impl Vec2Ext for Vec2 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn x0y(self) -> Vec3 { - Vec3::new(self.x, 0., self.y) - } -} - -pub(crate) trait MeshExt { - fn transform(&mut self, transform: Transform); - fn transformed(&self, transform: Transform) -> Mesh; - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]>; - fn search_in_children<'a>( - parent: Entity, - children: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)>; -} - -impl MeshExt for Mesh { - fn transform(&mut self, transform: Transform) { - for coords in self.read_coords_mut(Mesh::ATTRIBUTE_POSITION.clone()) { - let vec3 = (*coords).into(); - let transformed = transform.transform_point(vec3); - *coords = transformed.into(); - } - for normal in self.read_coords_mut(Mesh::ATTRIBUTE_NORMAL.clone()) { - let vec3 = (*normal).into(); - let transformed = transform.rotation.mul_vec3(vec3); - *normal = transformed.into(); - } - } - - fn transformed(&self, transform: Transform) -> Mesh { - let mut mesh = self.clone(); - mesh.transform(transform); - mesh - } - - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]> { - // Guaranteed by Bevy for the current usage - match self - .attribute_mut(id) - .expect("Failed to read unknown mesh attribute") - { - VertexAttributeValues::Float32x3(values) => values, - // Guaranteed by Bevy for the current usage - _ => unreachable!(), - } - } - - fn search_in_children<'a>( - parent: Entity, - children_query: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)> { - if let Ok(children) = children_query.get(parent) { - let mut result: Vec<_> = children - .iter() - .filter_map(|entity| mesh_handles.get(*entity).ok().map(|mesh| (*entity, mesh))) - .map(|(entity, mesh_handle)| { - ( - entity, - meshes - .get(mesh_handle) - .expect("Failed to get mesh from handle"), - ) - }) - .map(|(entity, mesh)| { - assert_eq!(mesh.primitive_topology(), PrimitiveTopology::TriangleList); - (entity, mesh) - }) - .collect(); - let mut inner_result = children - .iter() - .flat_map(|entity| { - Self::search_in_children(*entity, children_query, meshes, mesh_handles) - }) - .collect(); - result.append(&mut inner_result); - result - } else { - Vec::new() - } - } -} - -pub(crate) trait F32Ext: Copy { - fn is_approx_zero(self) -> bool; - fn squared(self) -> f32; - fn lerp(self, other: f32, ratio: f32) -> f32; -} - -impl F32Ext for f32 { - #[inline] - fn is_approx_zero(self) -> bool { - self.abs() < 1e-5 - } - - #[inline] - fn squared(self) -> f32 { - self * self - } - - #[inline] - fn lerp(self, other: f32, ratio: f32) -> f32 { - self.mul_add(1. - ratio, other * ratio) - } -} - -pub(crate) trait TransformExt: Copy { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform; - fn lerp(self, other: Transform, ratio: f32) -> Transform; -} - -impl TransformExt for Transform { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform { - let direction = target - self.translation; - let horizontal_direction = direction - up * direction.dot(up); - let look_target = self.translation + horizontal_direction; - self.looking_at(look_target, up) - } - - fn lerp(self, other: Transform, ratio: f32) -> Transform { - let translation = self.translation.lerp(other.translation, ratio); - let rotation = self.rotation.slerp(other.rotation, ratio); - let scale = self.scale.lerp(other.scale, ratio); - Transform { - translation, - rotation, - scale, - } - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/relationships/mod.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/relationships/mod.rs deleted file mode 100644 index 4128453..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/relationships/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub mod relationships_insert_dependant_components; -pub use relationships_insert_dependant_components::*; - -use bevy::prelude::*; - -pub struct EcsRelationshipsPlugin; -impl Plugin for EcsRelationshipsPlugin { - fn build(&self, app: &mut App) { - app; - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/relationships/relationships_insert_dependant_components.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/relationships/relationships_insert_dependant_components.rs deleted file mode 100644 index 4e9ad17..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/core/relationships/relationships_insert_dependant_components.rs +++ /dev/null @@ -1,15 +0,0 @@ -use bevy::prelude::*; - -pub fn insert_dependant_component< - Dependant: Component, - Dependency: Component + std::default::Default, ->( - mut commands: Commands, - entities_without_depency: Query<(Entity, &Name), (With, Without)>, -) { - for (entity, name) in entities_without_depency.iter() { - let name = name.clone().to_string(); - commands.entity(entity).insert(Dependency::default()); - warn!("found an entity called {} with a {} component but without an {}, please check your assets", name.clone(), std::any::type_name::(), std::any::type_name::()); - } -} 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 4047b83..2338956 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 @@ -1,10 +1,6 @@ use bevy::prelude::*; - -use crate::{ - assets::GameAssets, - state::{GameState, InAppRunning}, -}; use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag}; +use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning}; use bevy_rapier3d::prelude::Velocity; use rand::Rng; @@ -16,10 +12,10 @@ pub fn setup_game( mut next_game_state: ResMut>, ) { println!("setting up all stuff"); - /*commands.insert_resource(AmbientLight { + commands.insert_resource(AmbientLight { color: Color::WHITE, brightness: 0.2, - });*/ + }); // here we actually spawn our game world/level commands.spawn(( @@ -40,6 +36,10 @@ pub fn setup_game( next_game_state.set(GameState::InGame) } +#[derive(Component, Reflect, Default, Debug)] +#[reflect(Component)] +struct UnregisteredComponent; + pub fn spawn_test( keycode: Res>, mut commands: Commands, @@ -82,3 +82,47 @@ 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/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/game/in_main_menu.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/game/in_main_menu.rs index cecd13a..c1a4b8b 100644 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/game/in_main_menu.rs +++ b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/game/in_main_menu.rs @@ -1,6 +1,5 @@ use bevy::prelude::*; - -use crate::state::{AppState, GameState, InMainMenu}; +use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu}; pub fn setup_main_menu(mut commands: Commands) { commands.spawn((Camera2dBundle::default(), InMainMenu)); diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/game/level_transitions.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/game/level_transitions.rs index b59494a..7fa6f1a 100644 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/game/level_transitions.rs +++ b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/game/level_transitions.rs @@ -1,10 +1,8 @@ -use crate::{assets::GameAssets, state::InAppRunning}; -use bevy::prelude::*; +use bevy::{gltf::Gltf, prelude::*}; use bevy_gltf_blueprints::GameWorldTag; +use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning, Player}; use bevy_rapier3d::prelude::*; -use super::Player; - #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] pub struct LevelTransition { @@ -12,6 +10,7 @@ pub struct LevelTransition { } // very barebones example of triggering level transitions +#[allow(clippy::too_many_arguments)] pub fn trigger_level_transition( mut collision_events: EventReader, level_transition_triggers: Query<&LevelTransition>, @@ -68,14 +67,14 @@ pub fn trigger_level_transition( commands.entity(current_game_world.0).despawn_recursive(); let target_level = &transition_trigger.target; - let level; + let level: Handle; println!("target level {}", target_level); if target_level == "Level1" { - level = &game_assets.level1; - } else if (target_level == "Level2") { - level = &game_assets.level2; + level = game_assets.level1.clone().unwrap(); + } else if target_level == "Level2" { + level = game_assets.level2.clone().unwrap(); } else { - level = &game_assets.world; + level = game_assets.world.clone(); } info!("spawning new level"); commands.spawn(( @@ -100,3 +99,13 @@ pub fn trigger_level_transition( } } } + +pub struct LevelsPlugin; +impl Plugin for LevelsPlugin { + fn build(&self, app: &mut App) { + app.register_type::().add_systems( + Update, + (trigger_level_transition,).run_if(in_state(GameState::InGame)), + ); + } +} diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/game/mod.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/game/mod.rs index 80bdcc1..3ecdb4f 100644 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/game/mod.rs +++ b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/game/mod.rs @@ -4,114 +4,19 @@ pub use in_game::*; pub mod in_main_menu; pub use in_main_menu::*; -pub mod picking; -pub use picking::*; - pub mod level_transitions; pub use level_transitions::*; -use crate::{ - assets::GameAssets, - insert_dependant_component, - state::{AppState, GameState, InAppRunning}, -}; use bevy::prelude::*; -use bevy_rapier3d::prelude::*; - -// this file is just for demo purposes, contains various types of components, systems etc - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum SoundMaterial { - Metal, - Wood, - Rock, - Cloth, - Squishy, - #[default] - None, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Player; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo component showing auto injection of components -pub struct ShouldBeWithPlayer; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Interactible; - -fn player_move_demo( - keycode: Res>, - mut players: Query<&mut Transform, With>, -) { - let speed = 0.2; - if let Ok(mut player) = players.get_single_mut() { - if keycode.pressed(KeyCode::Left) { - player.translation.x += speed; - } - if keycode.pressed(KeyCode::Right) { - player.translation.x -= speed; - } - - if keycode.pressed(KeyCode::Up) { - player.translation.z += speed; - } - if keycode.pressed(KeyCode::Down) { - player.translation.z -= speed; - } - } -} - -// collision tests/debug -pub fn test_collision_events( - mut collision_events: EventReader, - mut contact_force_events: EventReader, -) { - for collision_event in collision_events.read() { - println!("collision"); - match collision_event { - CollisionEvent::Started(_entity1, _entity2, _) => { - println!("collision started") - } - CollisionEvent::Stopped(_entity1, _entity2, _) => { - println!("collision ended") - } - } - } - - for contact_force_event in contact_force_events.read() { - println!("Received contact force event: {:?}", contact_force_event); - } -} +use bevy_gltf_worlflow_examples_common::{AppState, GameState}; pub struct GamePlugin; impl Plugin for GamePlugin { fn build(&self, app: &mut App) { - app.add_plugins(PickingPlugin) - .register_type::() - .register_type::() - .register_type::() - .register_type::() - // little helper utility, to automatically inject components that are dependant on an other component - // ie, here an Entity with a Player component should also always have a ShouldBeWithPlayer component - // you get a warning if you use this, as I consider this to be stop-gap solution (usually you should have either a bundle, or directly define all needed components) + app.add_plugins(LevelsPlugin) .add_systems( Update, - ( - // insert_dependant_component::, - player_move_demo, //.run_if(in_state(AppState::Running)), - // test_collision_events, - spawn_test, - trigger_level_transition, - ) - .run_if(in_state(GameState::InGame)), + (spawn_test, spawn_test_unregisted_components).run_if(in_state(GameState::InGame)), ) .add_systems(OnEnter(AppState::MenuRunning), setup_main_menu) .add_systems(OnExit(AppState::MenuRunning), teardown_main_menu) diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/game/picking.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/game/picking.rs deleted file mode 100644 index 6731bbb..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/game/picking.rs +++ /dev/null @@ -1,34 +0,0 @@ -use super::Player; -use bevy::prelude::*; -use bevy_gltf_blueprints::GltfBlueprintsSet; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub struct Pickable; - -// very simple, crude picking (as in picking up objects) implementation - -pub fn picking( - players: Query<&GlobalTransform, With>, - pickables: Query<(Entity, &GlobalTransform), With>, - mut commands: Commands, -) { - for player_transforms in players.iter() { - for (pickable, pickable_transforms) in pickables.iter() { - let distance = player_transforms - .translation() - .distance(pickable_transforms.translation()); - if distance < 2.5 { - commands.entity(pickable).despawn_recursive(); - } - } - } -} - -pub struct PickingPlugin; -impl Plugin for PickingPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .add_systems(Update, (picking.after(GltfBlueprintsSet::AfterSpawn),)); - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/main.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/main.rs index 6edba33..8fca426 100644 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/main.rs +++ b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/main.rs @@ -1,15 +1,10 @@ use bevy::prelude::*; use bevy_editor_pls::prelude::*; +use bevy_gltf_worlflow_examples_common::CommonPlugin; mod core; use crate::core::*; -pub mod assets; -use assets::*; - -pub mod state; -use state::*; - mod game; use game::*; @@ -23,8 +18,7 @@ fn main() { // editor EditorPlugin::default(), // our custom plugins - StatePlugin, - AssetsPlugin, + CommonPlugin, CorePlugin, // reusable plugins GamePlugin, // specific to our game ComponentsTestPlugin, // Showcases different type of components /structs diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/state.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/state.rs deleted file mode 100644 index 8e983d9..0000000 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/state.rs +++ /dev/null @@ -1,54 +0,0 @@ -use bevy::app::AppExit; -use bevy::prelude::*; - -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, States)] -pub enum AppState { - #[default] - CoreLoading, - MenuRunning, - AppLoading, - AppRunning, - AppEnding, - - // FIXME: not sure - LoadingGame, -} - -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, States)] -pub enum GameState { - #[default] - None, - - InMenu, - InGame, - - InGameOver, - - InSaving, - InLoading, -} - -// tag components for all entities within a certain state (for despawning them if needed) , FIXME: seems kinda hack-ish -#[derive(Component)] -pub struct InCoreLoading; -#[derive(Component, Default)] -pub struct InMenuRunning; -#[derive(Component)] -pub struct InAppLoading; -#[derive(Component)] -pub struct InAppRunning; - -// components for tagging in game vs in game menu stuff -#[derive(Component, Default)] -pub struct InMainMenu; -#[derive(Component, Default)] -pub struct InMenu; -#[derive(Component, Default)] -pub struct InGame; - -pub struct StatePlugin; -impl Plugin for StatePlugin { - fn build(&self, app: &mut App) { - app.add_state::().add_state::(); - } -} diff --git a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/test_components.rs b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/test_components.rs index d0e6fbd..b5384e2 100644 --- a/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/test_components.rs +++ b/examples/bevy_gltf_blueprints/multiple_levels_multiple_blendfiles/src/test_components.rs @@ -6,39 +6,39 @@ struct UnitTest; #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -struct TuppleTestF32(f32); +struct TupleTestF32(f32); #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -struct TuppleTestU64(u64); +struct TupleTestU64(u64); #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -pub struct TuppleTestStr(String); +pub struct TupleTestStr(String); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTest2(f32, u64, String); +struct TupleTest2(f32, u64, String); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTestBool(bool); +struct TupleTestBool(bool); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec2(Vec2); +struct TupleVec2(Vec2); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec3(Vec3); +struct TupleVec3(Vec3); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec(Vec); +struct TupleVec(Vec); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTestColor(Color); +struct TupleTestColor(Color); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] @@ -65,16 +65,16 @@ impl Plugin for ComponentsTestPlugin { fn build(&self, app: &mut App) { app.register_type::() .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() .register_type::() - .register_type::() - .register_type::() + .register_type::() + .register_type::() .register_type::>(); } } diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/Cargo.toml b/examples/bevy_gltf_blueprints/nested_blueprints/Cargo.toml deleted file mode 100644 index 1d6d485..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/Cargo.toml +++ /dev/null @@ -1,13 +0,0 @@ -[package] -name = "bevy_gltf_blueprints_nested_blueprints_example" -version = "0.3.0" -edition = "2021" -license = "MIT OR Apache-2.0" - -[dependencies] -bevy="0.12" -bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" } -bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] } -bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]} -bevy_editor_pls = { version = "0.6" } -rand = "0.8.5" diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/README.md b/examples/bevy_gltf_blueprints/nested_blueprints/README.md deleted file mode 100644 index 48b807a..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/README.md +++ /dev/null @@ -1,14 +0,0 @@ - -# Nested blueprints example/demo - -Example of blueprints (and thus gltf) nested & reuse to avoid redundant data in blueprints gltfs that lead to asset & memory bloat -- ideally, to be used together with ```gltf_auto_export``` version >0.8 with the "export nested blueprints" option for exports, as that will generate whole -gltf blueprints hierarchies, and minimise their size for you -- It shows you how ou can configure```Bevy_gltf_blueprints``` to spawn nested blueprints - - -## Running this example - -``` -cargo run --features bevy/dynamic_linking -``` diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/assets/assets_core.assets.ron b/examples/bevy_gltf_blueprints/nested_blueprints/assets/assets_core.assets.ron deleted file mode 100644 index 8d0a099..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/assets/assets_core.assets.ron +++ /dev/null @@ -1 +0,0 @@ -({}) \ No newline at end of file diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/assets/assets_game.assets.ron b/examples/bevy_gltf_blueprints/nested_blueprints/assets/assets_game.assets.ron deleted file mode 100644 index 5b1e969..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/assets/assets_game.assets.ron +++ /dev/null @@ -1,6 +0,0 @@ -({ - "world":File (path: "models/World.glb"), - "models": Folder ( - path: "models/library", - ), -}) \ No newline at end of file diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/World.glb b/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/World.glb deleted file mode 100644 index be19a70..0000000 Binary files a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/World.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Container.glb b/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Container.glb deleted file mode 100644 index 72ff5ca..0000000 Binary files a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Container.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Health_Pickup.glb b/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Health_Pickup.glb deleted file mode 100644 index 4643320..0000000 Binary files a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Health_Pickup.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/MagicTeapot.glb b/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/MagicTeapot.glb deleted file mode 100644 index 7a7020b..0000000 Binary files a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/MagicTeapot.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Pillar.glb b/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Pillar.glb deleted file mode 100644 index 891122c..0000000 Binary files a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Pillar.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Player 2.glb b/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Player 2.glb deleted file mode 100644 index 6eaccc6..0000000 Binary files a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Player 2.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Unused_in_level_test.glb b/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Unused_in_level_test.glb deleted file mode 100644 index b5937bb..0000000 Binary files a/examples/bevy_gltf_blueprints/nested_blueprints/assets/models/library/Unused_in_level_test.glb and /dev/null differ diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/assets/assets_core.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/assets/assets_core.rs deleted file mode 100644 index 29b577a..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/assets/assets_core.rs +++ /dev/null @@ -1,5 +0,0 @@ -use bevy::prelude::*; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct CoreAssets {} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/assets/assets_game.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/assets/assets_game.rs deleted file mode 100644 index b8e0665..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/assets/assets_game.rs +++ /dev/null @@ -1,13 +0,0 @@ -use bevy::gltf::Gltf; -use bevy::prelude::*; -use bevy::utils::HashMap; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct GameAssets { - #[asset(key = "world")] - pub world: Handle, - - #[asset(key = "models", collection(typed, mapped))] - pub models: HashMap>, -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/assets/mod.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/assets/mod.rs deleted file mode 100644 index a2c8b22..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/assets/mod.rs +++ /dev/null @@ -1,35 +0,0 @@ -pub mod assets_core; -pub use assets_core::*; - -pub mod assets_game; -pub use assets_game::*; - -use bevy::prelude::*; -use bevy_asset_loader::prelude::*; - -use crate::state::AppState; - -pub struct AssetsPlugin; -impl Plugin for AssetsPlugin { - fn build(&self, app: &mut App) { - 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), - ) - .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); - } -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/camera/camera_replace_proxies.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/core/camera/camera_replace_proxies.rs deleted file mode 100644 index 9055c95..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/camera/camera_replace_proxies.rs +++ /dev/null @@ -1,24 +0,0 @@ -use bevy::core_pipeline::bloom::{BloomCompositeMode, BloomSettings}; -use bevy::core_pipeline::tonemapping::{DebandDither, Tonemapping}; -use bevy::prelude::*; - -use super::CameraTrackingOffset; - -pub fn camera_replace_proxies( - mut commands: Commands, - mut added_cameras: Query<(Entity, &mut Camera), (Added, With)>, -) { - for (entity, mut camera) in added_cameras.iter_mut() { - info!("detected added camera, updating proxy"); - camera.hdr = true; - commands - .entity(entity) - .insert(DebandDither::Enabled) - .insert(Tonemapping::BlenderFilmic) - .insert(BloomSettings { - intensity: 0.01, - composite_mode: BloomCompositeMode::Additive, - ..default() - }); - } -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/camera/camera_tracking.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/core/camera/camera_tracking.rs deleted file mode 100644 index 62da84d..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/camera/camera_tracking.rs +++ /dev/null @@ -1,58 +0,0 @@ -use bevy::prelude::*; - -#[derive(Component, Reflect, Debug)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -/// -pub struct CameraTracking { - pub offset: Vec3, -} -impl Default for CameraTracking { - fn default() -> Self { - CameraTracking { - offset: Vec3::new(0.0, 6.0, 8.0), - } - } -} - -#[derive(Component, Reflect, Debug, Deref, DerefMut)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -pub struct CameraTrackingOffset(Vec3); -impl Default for CameraTrackingOffset { - fn default() -> Self { - CameraTrackingOffset(Vec3::new(0.0, 6.0, 8.0)) - } -} - -impl CameraTrackingOffset { - fn new(input: Vec3) -> Self { - CameraTrackingOffset(input) - } -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Add this component to an entity if you want it to be tracked by a Camera -pub struct CameraTrackable; - -pub fn camera_track( - mut tracking_cameras: Query< - (&mut Transform, &CameraTrackingOffset), - ( - With, - With, - Without, - ), - >, - camera_tracked: Query<&Transform, With>, -) { - for (mut camera_transform, tracking_offset) in tracking_cameras.iter_mut() { - for tracked_transform in camera_tracked.iter() { - let target_position = tracked_transform.translation + tracking_offset.0; - let eased_position = camera_transform.translation.lerp(target_position, 0.1); - camera_transform.translation = eased_position; // + tracking.offset;// tracked_transform.translation + tracking.offset; - *camera_transform = camera_transform.looking_at(tracked_transform.translation, Vec3::Y); - } - } -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/camera/mod.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/core/camera/mod.rs deleted file mode 100644 index a6bbb65..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/camera/mod.rs +++ /dev/null @@ -1,24 +0,0 @@ -pub mod camera_tracking; -pub use camera_tracking::*; - -pub mod camera_replace_proxies; -pub use camera_replace_proxies::*; - -use bevy::prelude::*; -use bevy_gltf_blueprints::GltfBlueprintsSet; - -pub struct CameraPlugin; -impl Plugin for CameraPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .register_type::() - .register_type::() - .add_systems( - Update, - ( - camera_replace_proxies.after(GltfBlueprintsSet::AfterSpawn), - camera_track, - ), - ); - } -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/lighting/lighting_replace_proxies.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/core/lighting/lighting_replace_proxies.rs deleted file mode 100644 index 48c0908..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/lighting/lighting_replace_proxies.rs +++ /dev/null @@ -1,25 +0,0 @@ -use bevy::prelude::*; - -use bevy::pbr::{CascadeShadowConfig, CascadeShadowConfigBuilder}; - -// fixme might be too specific to might needs, should it be moved out ? also these are all for lights, not models -pub fn lighting_replace_proxies( - mut added_dirights: Query<(Entity, &mut DirectionalLight), Added>, - mut added_spotlights: Query<&mut SpotLight, Added>, - mut commands: Commands, -) { - for (entity, mut light) in added_dirights.iter_mut() { - light.illuminance *= 5.0; - light.shadows_enabled = true; - let shadow_config: CascadeShadowConfig = CascadeShadowConfigBuilder { - first_cascade_far_bound: 15.0, - maximum_distance: 135.0, - ..default() - } - .into(); - commands.entity(entity).insert(shadow_config); - } - for mut light in added_spotlights.iter_mut() { - light.shadows_enabled = true; - } -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/lighting/mod.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/core/lighting/mod.rs deleted file mode 100644 index c9688cd..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/lighting/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -mod lighting_replace_proxies; -use lighting_replace_proxies::*; - -use bevy::pbr::{DirectionalLightShadowMap, NotShadowCaster}; -use bevy::prelude::*; - -pub struct LightingPlugin; -impl Plugin for LightingPlugin { - fn build(&self, app: &mut App) { - app - .insert_resource(DirectionalLightShadowMap { size: 4096 }) - // FIXME: adding these since they are missing - .register_type::() - - .add_systems(PreUpdate, lighting_replace_proxies) // FIXME: you should actually run this in a specific state most likely - ; - } -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/mod.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/core/mod.rs deleted file mode 100644 index 9c38fa7..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/mod.rs +++ /dev/null @@ -1,31 +0,0 @@ -pub mod camera; -pub use camera::*; - -pub mod lighting; -pub use lighting::*; - -pub mod relationships; -pub use relationships::*; - -pub mod physics; -pub use physics::*; - -use bevy::prelude::*; -use bevy_gltf_blueprints::*; - -pub struct CorePlugin; -impl Plugin for CorePlugin { - fn build(&self, app: &mut App) { - app.add_plugins(( - LightingPlugin, - CameraPlugin, - PhysicsPlugin, - BlueprintsPlugin { - library_folder: "models/library".into(), - format: GltfFormat::GLB, - aabbs: true, - ..Default::default() - }, - )); - } -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/physics/controls.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/core/physics/controls.rs deleted file mode 100644 index 9ff42c9..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/physics/controls.rs +++ /dev/null @@ -1,12 +0,0 @@ -use bevy::prelude::{info, ResMut}; -use bevy_rapier3d::prelude::RapierConfiguration; - -pub fn pause_physics(mut physics_config: ResMut) { - info!("pausing physics"); - physics_config.physics_pipeline_active = false; -} - -pub fn resume_physics(mut physics_config: ResMut) { - info!("unpausing physics"); - physics_config.physics_pipeline_active = true; -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/physics/mod.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/core/physics/mod.rs deleted file mode 100644 index cd7d523..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/physics/mod.rs +++ /dev/null @@ -1,37 +0,0 @@ -pub mod physics_replace_proxies; -use bevy_rapier3d::{ - prelude::{NoUserData, RapierPhysicsPlugin}, - render::RapierDebugRenderPlugin, -}; -pub use physics_replace_proxies::*; - -pub mod utils; - -pub mod controls; -pub use controls::*; - -use crate::state::GameState; -use bevy::prelude::*; -// use super::blueprints::GltfBlueprintsSet; -use bevy_gltf_blueprints::GltfBlueprintsSet; -// use crate::Collider; -pub struct PhysicsPlugin; -impl Plugin for PhysicsPlugin { - fn build(&self, app: &mut App) { - app.add_plugins(( - RapierPhysicsPlugin::::default(), - RapierDebugRenderPlugin::default(), - )) - .register_type::() - .register_type::() - // find a way to make serde's stuff serializable - // .register_type::() - //bevy_rapier3d::dynamics::CoefficientCombineRule - .add_systems( - Update, - physics_replace_proxies.after(GltfBlueprintsSet::AfterSpawn), - ) - .add_systems(OnEnter(GameState::InGame), resume_physics) - .add_systems(OnExit(GameState::InGame), pause_physics); - } -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/physics/physics_replace_proxies.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/core/physics/physics_replace_proxies.rs deleted file mode 100644 index b91462c..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/physics/physics_replace_proxies.rs +++ /dev/null @@ -1,101 +0,0 @@ -use bevy::prelude::*; -// use bevy::render::primitives::Aabb; -use bevy_rapier3d::geometry::Collider as RapierCollider; -use bevy_rapier3d::prelude::{ActiveCollisionTypes, ActiveEvents, ComputedColliderShape}; - -use super::utils::*; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum Collider { - Ball(f32), - Cuboid(Vec3), - Capsule(Vec3, Vec3, f32), - #[default] - Mesh, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum AutoAABBCollider { - #[default] - Cuboid, - Ball, - Capsule, -} - -// replaces all physics stand-ins with the actual rapier types -pub fn physics_replace_proxies( - meshes: Res>, - mesh_handles: Query<&Handle>, - mut proxy_colliders: Query< - (Entity, &Collider, &Name, &mut Visibility), - (Without, Added), - >, - // needed for tri meshes - children: Query<&Children>, - - mut commands: Commands, -) { - for proxy_colider in proxy_colliders.iter_mut() { - let (entity, collider_proxy, name, mut visibility) = proxy_colider; - // we hide the collider meshes: perhaps they should be removed altogether once processed ? - if name.ends_with("_collider") || name.ends_with("_sensor") { - *visibility = Visibility::Hidden; - } - - let mut rapier_collider: RapierCollider; - match collider_proxy { - Collider::Ball(radius) => { - info!("generating collider from proxy: ball"); - rapier_collider = RapierCollider::ball(*radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Cuboid(size) => { - info!("generating collider from proxy: cuboid"); - rapier_collider = RapierCollider::cuboid(size.x, size.y, size.z); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Capsule(a, b, radius) => { - info!("generating collider from proxy: capsule"); - rapier_collider = RapierCollider::capsule(*a, *b, *radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Mesh => { - info!("generating collider from proxy: mesh"); - for (_, collider_mesh) in - Mesh::search_in_children(entity, &children, &meshes, &mesh_handles) - { - rapier_collider = RapierCollider::from_bevy_mesh( - collider_mesh, - &ComputedColliderShape::TriMesh, - ) - .unwrap(); - commands - .entity(entity) - .insert(rapier_collider) - // FIXME: this is just for demo purposes !!! - .insert( - ActiveCollisionTypes::default() - | ActiveCollisionTypes::KINEMATIC_STATIC - | ActiveCollisionTypes::STATIC_STATIC - | ActiveCollisionTypes::DYNAMIC_STATIC, - ) - .insert(ActiveEvents::COLLISION_EVENTS); - // .insert(ActiveEvents::COLLISION_EVENTS) - // break; - // RapierCollider::convex_hull(points) - } - } - } - } -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/physics/utils.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/core/physics/utils.rs deleted file mode 100644 index 7886710..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/physics/utils.rs +++ /dev/null @@ -1,175 +0,0 @@ -use bevy::prelude::*; -use bevy::render::mesh::{MeshVertexAttributeId, PrimitiveTopology, VertexAttributeValues}; -// TAKEN VERBATIB FROM https://github.com/janhohenheim/foxtrot/blob/src/util/trait_extension.rs - -pub(crate) trait Vec3Ext: Copy { - fn is_approx_zero(self) -> bool; - fn split(self, up: Vec3) -> SplitVec3; -} -impl Vec3Ext for Vec3 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn split(self, up: Vec3) -> SplitVec3 { - let vertical = up * self.dot(up); - let horizontal = self - vertical; - SplitVec3 { - vertical, - horizontal, - } - } -} - -#[derive(Debug, Clone, Copy, PartialEq)] -pub(crate) struct SplitVec3 { - pub(crate) vertical: Vec3, - pub(crate) horizontal: Vec3, -} - -pub(crate) trait Vec2Ext: Copy { - fn is_approx_zero(self) -> bool; - fn x0y(self) -> Vec3; -} -impl Vec2Ext for Vec2 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn x0y(self) -> Vec3 { - Vec3::new(self.x, 0., self.y) - } -} - -pub(crate) trait MeshExt { - fn transform(&mut self, transform: Transform); - fn transformed(&self, transform: Transform) -> Mesh; - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]>; - fn search_in_children<'a>( - parent: Entity, - children: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)>; -} - -impl MeshExt for Mesh { - fn transform(&mut self, transform: Transform) { - for coords in self.read_coords_mut(Mesh::ATTRIBUTE_POSITION.clone()) { - let vec3 = (*coords).into(); - let transformed = transform.transform_point(vec3); - *coords = transformed.into(); - } - for normal in self.read_coords_mut(Mesh::ATTRIBUTE_NORMAL.clone()) { - let vec3 = (*normal).into(); - let transformed = transform.rotation.mul_vec3(vec3); - *normal = transformed.into(); - } - } - - fn transformed(&self, transform: Transform) -> Mesh { - let mut mesh = self.clone(); - mesh.transform(transform); - mesh - } - - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]> { - // Guaranteed by Bevy for the current usage - match self - .attribute_mut(id) - .expect("Failed to read unknown mesh attribute") - { - VertexAttributeValues::Float32x3(values) => values, - // Guaranteed by Bevy for the current usage - _ => unreachable!(), - } - } - - fn search_in_children<'a>( - parent: Entity, - children_query: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)> { - if let Ok(children) = children_query.get(parent) { - let mut result: Vec<_> = children - .iter() - .filter_map(|entity| mesh_handles.get(*entity).ok().map(|mesh| (*entity, mesh))) - .map(|(entity, mesh_handle)| { - ( - entity, - meshes - .get(mesh_handle) - .expect("Failed to get mesh from handle"), - ) - }) - .map(|(entity, mesh)| { - assert_eq!(mesh.primitive_topology(), PrimitiveTopology::TriangleList); - (entity, mesh) - }) - .collect(); - let mut inner_result = children - .iter() - .flat_map(|entity| { - Self::search_in_children(*entity, children_query, meshes, mesh_handles) - }) - .collect(); - result.append(&mut inner_result); - result - } else { - Vec::new() - } - } -} - -pub(crate) trait F32Ext: Copy { - fn is_approx_zero(self) -> bool; - fn squared(self) -> f32; - fn lerp(self, other: f32, ratio: f32) -> f32; -} - -impl F32Ext for f32 { - #[inline] - fn is_approx_zero(self) -> bool { - self.abs() < 1e-5 - } - - #[inline] - fn squared(self) -> f32 { - self * self - } - - #[inline] - fn lerp(self, other: f32, ratio: f32) -> f32 { - self.mul_add(1. - ratio, other * ratio) - } -} - -pub(crate) trait TransformExt: Copy { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform; - fn lerp(self, other: Transform, ratio: f32) -> Transform; -} - -impl TransformExt for Transform { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform { - let direction = target - self.translation; - let horizontal_direction = direction - up * direction.dot(up); - let look_target = self.translation + horizontal_direction; - self.looking_at(look_target, up) - } - - fn lerp(self, other: Transform, ratio: f32) -> Transform { - let translation = self.translation.lerp(other.translation, ratio); - let rotation = self.rotation.slerp(other.rotation, ratio); - let scale = self.scale.lerp(other.scale, ratio); - Transform { - translation, - rotation, - scale, - } - } -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/physics/utils_old.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/core/physics/utils_old.rs deleted file mode 100644 index c210dd3..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/physics/utils_old.rs +++ /dev/null @@ -1,75 +0,0 @@ -use bevy::prelude::*; -use bevy::render::mesh::{MeshVertexAttributeId, PrimitiveTopology, VertexAttributeValues}; -// TAKEN VERBATIB FROM https://github.com/janhohenheim/foxtrot/blob/6e31fc02652fc9d085a4adde0a73ab007dbbb0dc/src/util/trait_extension.rs - -pub trait Vec3Ext { - #[allow(clippy::wrong_self_convention)] // Because [`Vec3`] is [`Copy`] - fn is_approx_zero(self) -> bool; - fn x0z(self) -> Vec3; -} -impl Vec3Ext for Vec3 { - fn is_approx_zero(self) -> bool { - [self.x, self.y, self.z].iter().all(|&x| x.abs() < 1e-5) - } - fn x0z(self) -> Vec3 { - Vec3::new(self.x, 0., self.z) - } -} - -pub trait MeshExt { - fn transform(&mut self, transform: Transform); - fn transformed(&self, transform: Transform) -> Mesh; - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]>; - fn search_in_children<'a>( - children: &'a Children, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> (Entity, &'a Mesh); -} - -impl MeshExt for Mesh { - fn transform(&mut self, transform: Transform) { - for attribute in [Mesh::ATTRIBUTE_POSITION, Mesh::ATTRIBUTE_NORMAL] { - for coords in self.read_coords_mut(attribute.clone()) { - let vec3 = (*coords).into(); - let transformed = transform.transform_point(vec3); - *coords = transformed.into(); - } - } - } - - fn transformed(&self, transform: Transform) -> Mesh { - let mut mesh = self.clone(); - mesh.transform(transform); - mesh - } - - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]> { - match self.attribute_mut(id).unwrap() { - VertexAttributeValues::Float32x3(values) => values, - // Guaranteed by Bevy - _ => unreachable!(), - } - } - - fn search_in_children<'a>( - children: &'a Children, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> (Entity, &'a Mesh) { - let entity_handles: Vec<_> = children - .iter() - .filter_map(|entity| mesh_handles.get(*entity).ok().map(|mesh| (*entity, mesh))) - .collect(); - assert_eq!( - entity_handles.len(), - 1, - "Collider must contain exactly one mesh, but found {}", - entity_handles.len() - ); - let (entity, mesh_handle) = entity_handles.first().unwrap(); - let mesh = meshes.get(mesh_handle).unwrap(); - assert_eq!(mesh.primitive_topology(), PrimitiveTopology::TriangleList); - (*entity, mesh) - } -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/relationships/mod.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/core/relationships/mod.rs deleted file mode 100644 index 4128453..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/relationships/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub mod relationships_insert_dependant_components; -pub use relationships_insert_dependant_components::*; - -use bevy::prelude::*; - -pub struct EcsRelationshipsPlugin; -impl Plugin for EcsRelationshipsPlugin { - fn build(&self, app: &mut App) { - app; - } -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/relationships/relationships_insert_dependant_components.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/core/relationships/relationships_insert_dependant_components.rs deleted file mode 100644 index 4e9ad17..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/core/relationships/relationships_insert_dependant_components.rs +++ /dev/null @@ -1,15 +0,0 @@ -use bevy::prelude::*; - -pub fn insert_dependant_component< - Dependant: Component, - Dependency: Component + std::default::Default, ->( - mut commands: Commands, - entities_without_depency: Query<(Entity, &Name), (With, Without)>, -) { - for (entity, name) in entities_without_depency.iter() { - let name = name.clone().to_string(); - commands.entity(entity).insert(Dependency::default()); - warn!("found an entity called {} with a {} component but without an {}, please check your assets", name.clone(), std::any::type_name::(), std::any::type_name::()); - } -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/game/in_game.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/game/in_game.rs deleted file mode 100644 index 2047798..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/game/in_game.rs +++ /dev/null @@ -1,84 +0,0 @@ -use bevy::prelude::*; - -use crate::{ - assets::GameAssets, - state::{GameState, InAppRunning}, -}; -use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag}; - -use bevy_rapier3d::prelude::Velocity; -use rand::Rng; - -pub fn setup_game( - mut commands: Commands, - game_assets: Res, - models: Res>, - mut next_game_state: ResMut>, -) { - println!("setting up all stuff"); - commands.insert_resource(AmbientLight { - color: Color::WHITE, - brightness: 0.2, - }); - // here we actually spawn our game world/level - - commands.spawn(( - SceneBundle { - // note: because of this issue https://github.com/bevyengine/bevy/issues/10436, "world" is now a gltf file instead of a scene - scene: models - .get(game_assets.world.id()) - .expect("main level should have been loaded") - .scenes[0] - .clone(), - ..default() - }, - bevy::prelude::Name::from("world"), - GameWorldTag, - InAppRunning, - )); - - next_game_state.set(GameState::InGame) -} - -pub fn spawn_test( - keycode: Res>, - mut commands: Commands, - - mut game_world: Query<(Entity, &Children), With>, -) { - if keycode.just_pressed(KeyCode::T) { - 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), - }, - )) - .id(); - commands.entity(world).add_child(new_entity); - } -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/game/in_main_menu.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/game/in_main_menu.rs deleted file mode 100644 index cecd13a..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/game/in_main_menu.rs +++ /dev/null @@ -1,113 +0,0 @@ -use bevy::prelude::*; - -use crate::state::{AppState, GameState, InMainMenu}; - -pub fn setup_main_menu(mut commands: Commands) { - commands.spawn((Camera2dBundle::default(), InMainMenu)); - - commands.spawn(( - TextBundle::from_section( - "SOME GAME TITLE !!", - TextStyle { - //font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 18.0, - color: Color::WHITE, - ..Default::default() - }, - ) - .with_style(Style { - position_type: PositionType::Absolute, - top: Val::Px(100.0), - left: Val::Px(200.0), - ..default() - }), - InMainMenu, - )); - - commands.spawn(( - TextBundle::from_section( - "New Game (press Enter to start, press T once the game is started for demo spawning)", - TextStyle { - //font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 18.0, - color: Color::WHITE, - ..Default::default() - }, - ) - .with_style(Style { - position_type: PositionType::Absolute, - top: Val::Px(200.0), - left: Val::Px(200.0), - ..default() - }), - InMainMenu, - )); - - /* - commands.spawn(( - TextBundle::from_section( - "Load Game", - TextStyle { - //font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 18.0, - color: Color::WHITE, - ..Default::default() - }, - ) - .with_style(Style { - position_type: PositionType::Absolute, - top: Val::Px(250.0), - left: Val::Px(200.0), - ..default() - }), - InMainMenu - )); - - commands.spawn(( - TextBundle::from_section( - "Exit Game", - TextStyle { - //font: asset_server.load("fonts/FiraMono-Medium.ttf"), - font_size: 18.0, - color: Color::WHITE, - ..Default::default() - }, - ) - .with_style(Style { - position_type: PositionType::Absolute, - top: Val::Px(300.0), - left: Val::Px(200.0), - ..default() - }), - InMainMenu - ));*/ -} - -pub fn teardown_main_menu(bla: Query>, mut commands: Commands) { - for bli in bla.iter() { - commands.entity(bli).despawn_recursive(); - } -} - -pub fn main_menu( - 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) { - 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() }) - } -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/game/mod.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/game/mod.rs deleted file mode 100644 index 3443c45..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/game/mod.rs +++ /dev/null @@ -1,115 +0,0 @@ -pub mod in_game; -pub use in_game::*; - -pub mod in_main_menu; -pub use in_main_menu::*; - -pub mod picking; -pub use picking::*; - -use crate::{ - insert_dependant_component, - state::{AppState, GameState}, -}; -use bevy::prelude::*; -use bevy_rapier3d::prelude::*; - -// this file is just for demo purposes, contains various types of components, systems etc - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum SoundMaterial { - Metal, - Wood, - Rock, - Cloth, - Squishy, - #[default] - None, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Player; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo component showing auto injection of components -pub struct ShouldBeWithPlayer; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Interactible; - -fn player_move_demo( - keycode: Res>, - mut players: Query<&mut Transform, With>, -) { - let speed = 0.2; - if let Ok(mut player) = players.get_single_mut() { - if keycode.pressed(KeyCode::Left) { - player.translation.x += speed; - } - if keycode.pressed(KeyCode::Right) { - player.translation.x -= speed; - } - - if keycode.pressed(KeyCode::Up) { - player.translation.z += speed; - } - if keycode.pressed(KeyCode::Down) { - player.translation.z -= speed; - } - } -} - -// collision tests/debug -pub fn test_collision_events( - mut collision_events: EventReader, - mut contact_force_events: EventReader, -) { - for collision_event in collision_events.read() { - println!("collision"); - match collision_event { - CollisionEvent::Started(_entity1, _entity2, _) => { - println!("collision started") - } - CollisionEvent::Stopped(_entity1, _entity2, _) => { - println!("collision ended") - } - } - } - - for contact_force_event in contact_force_events.read() { - println!("Received contact force event: {:?}", contact_force_event); - } -} - -pub struct GamePlugin; -impl Plugin for GamePlugin { - fn build(&self, app: &mut App) { - app.add_plugins(PickingPlugin) - .register_type::() - .register_type::() - .register_type::() - // little helper utility, to automatically inject components that are dependant on an other component - // ie, here an Entity with a Player component should also always have a ShouldBeWithPlayer component - // you get a warning if you use this, as I consider this to be stop-gap solution (usually you should have either a bundle, or directly define all needed components) - .add_systems( - Update, - ( - // insert_dependant_component::, - player_move_demo, //.run_if(in_state(AppState::Running)), - // test_collision_events - spawn_test, - ) - .run_if(in_state(GameState::InGame)), - ) - .add_systems(OnEnter(AppState::MenuRunning), setup_main_menu) - .add_systems(OnExit(AppState::MenuRunning), teardown_main_menu) - .add_systems(Update, (main_menu)) - .add_systems(OnEnter(AppState::AppRunning), setup_game); - } -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/game/picking.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/game/picking.rs deleted file mode 100644 index 6731bbb..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/game/picking.rs +++ /dev/null @@ -1,34 +0,0 @@ -use super::Player; -use bevy::prelude::*; -use bevy_gltf_blueprints::GltfBlueprintsSet; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub struct Pickable; - -// very simple, crude picking (as in picking up objects) implementation - -pub fn picking( - players: Query<&GlobalTransform, With>, - pickables: Query<(Entity, &GlobalTransform), With>, - mut commands: Commands, -) { - for player_transforms in players.iter() { - for (pickable, pickable_transforms) in pickables.iter() { - let distance = player_transforms - .translation() - .distance(pickable_transforms.translation()); - if distance < 2.5 { - commands.entity(pickable).despawn_recursive(); - } - } - } -} - -pub struct PickingPlugin; -impl Plugin for PickingPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .add_systems(Update, (picking.after(GltfBlueprintsSet::AfterSpawn),)); - } -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/main.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/main.rs deleted file mode 100644 index 6edba33..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/main.rs +++ /dev/null @@ -1,33 +0,0 @@ -use bevy::prelude::*; -use bevy_editor_pls::prelude::*; - -mod core; -use crate::core::*; - -pub mod assets; -use assets::*; - -pub mod state; -use state::*; - -mod game; -use game::*; - -mod test_components; -use test_components::*; - -fn main() { - App::new() - .add_plugins(( - DefaultPlugins.set(AssetPlugin::default()), - // editor - EditorPlugin::default(), - // our custom plugins - StatePlugin, - AssetsPlugin, - CorePlugin, // reusable plugins - GamePlugin, // specific to our game - ComponentsTestPlugin, // Showcases different type of components /structs - )) - .run(); -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/state.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/state.rs deleted file mode 100644 index 8e983d9..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/state.rs +++ /dev/null @@ -1,54 +0,0 @@ -use bevy::app::AppExit; -use bevy::prelude::*; - -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, States)] -pub enum AppState { - #[default] - CoreLoading, - MenuRunning, - AppLoading, - AppRunning, - AppEnding, - - // FIXME: not sure - LoadingGame, -} - -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, States)] -pub enum GameState { - #[default] - None, - - InMenu, - InGame, - - InGameOver, - - InSaving, - InLoading, -} - -// tag components for all entities within a certain state (for despawning them if needed) , FIXME: seems kinda hack-ish -#[derive(Component)] -pub struct InCoreLoading; -#[derive(Component, Default)] -pub struct InMenuRunning; -#[derive(Component)] -pub struct InAppLoading; -#[derive(Component)] -pub struct InAppRunning; - -// components for tagging in game vs in game menu stuff -#[derive(Component, Default)] -pub struct InMainMenu; -#[derive(Component, Default)] -pub struct InMenu; -#[derive(Component, Default)] -pub struct InGame; - -pub struct StatePlugin; -impl Plugin for StatePlugin { - fn build(&self, app: &mut App) { - app.add_state::().add_state::(); - } -} diff --git a/examples/bevy_gltf_blueprints/nested_blueprints/src/test_components.rs b/examples/bevy_gltf_blueprints/nested_blueprints/src/test_components.rs deleted file mode 100644 index 01635e0..0000000 --- a/examples/bevy_gltf_blueprints/nested_blueprints/src/test_components.rs +++ /dev/null @@ -1,90 +0,0 @@ -use bevy::prelude::*; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct Marker; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct Enemy; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct NestingTest; - -#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] -#[reflect(Component)] -struct TuppleTestF32(f32); - -#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] -#[reflect(Component)] -struct TuppleTestU64(u64); - -#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] -#[reflect(Component)] -pub struct TuppleTestStr(String); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleTest2(f32, u64, String); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleTestBool(bool); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleVec2(Vec2); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleVec3(Vec3); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleVec(Vec); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleTestColor(Color); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct BasicTest { - a: f32, - b: u64, - c: String, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum EnumTest { - Metal, - Wood, - Rock, - Cloth, - Squishy, - #[default] - None, -} - -pub struct ComponentsTestPlugin; -impl Plugin for ComponentsTestPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::>(); - } -} diff --git a/examples/bevy_gltf_components/basic/Cargo.toml b/examples/bevy_gltf_components/basic/Cargo.toml index f5132a3..b0ef625 100644 --- a/examples/bevy_gltf_components/basic/Cargo.toml +++ b/examples/bevy_gltf_components/basic/Cargo.toml @@ -7,5 +7,7 @@ license = "MIT OR Apache-2.0" [dependencies] bevy="0.12" bevy_gltf_components = { path = "../../../crates/bevy_gltf_components" } +bevy_gltf_worlflow_examples_common = { path = "../../common" } + bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] } bevy_editor_pls = { version = "0.6" } diff --git a/examples/bevy_gltf_components/basic/README.md b/examples/bevy_gltf_components/basic/README.md index d231926..d12e91e 100644 --- a/examples/bevy_gltf_components/basic/README.md +++ b/examples/bevy_gltf_components/basic/README.md @@ -1,14 +1,44 @@ -# Basic bevy_gltf_components demo +# Basic bevy_gltf_components + wasm demo -## Running this example + +## Running this example (non-wasm) ``` cargo run --features bevy/dynamic_linking ``` +## Wasm -### Additional notes +### Setup + +as per the bevy documentation: + +```shell +rustup target add wasm32-unknown-unknown +cargo install wasm-bindgen-cli +``` + + +### Building this example + +navigate to the current folder , and then + + +```shell +cargo build --release --target wasm32-unknown-unknown --target-dir ./target +wasm-bindgen --out-name wasm_example \ + --out-dir ./target/wasm \ + --target web target/wasm32-unknown-unknown/release/bevy_gltf_components_basic_wasm_example.wasm + +``` + +### Running this example + +run a web server in the current folder, and navigate to the page, you should see the example in your browser + + +## Additional notes * You usually define either the Components directly or use ```Proxy components``` that get replaced in Bevy systems with the actual Components that you want (usually when for some reason, ie external crates with unregistered components etc) you cannot use the components directly. @@ -27,6 +57,7 @@ Feel free to use as you want, rip it appart, use any/all parts that you need ! This tooling and workflow has enabled me to go from a blank Bevy + Blender setup to a working barebones level in very little time (30 minutes or so ?) ! You can then add your own components & systems for your own gameplay very easilly + ## Information - the Bevy/ Rust code is [here](./src/main.rs) - the Blender file is [here](./assets/basic.blend) diff --git a/examples/bevy_gltf_components/basic/assets/basic.blend b/examples/bevy_gltf_components/basic/assets/basic.blend index fcdc6cd..593df09 100644 Binary files a/examples/bevy_gltf_components/basic/assets/basic.blend and b/examples/bevy_gltf_components/basic/assets/basic.blend differ diff --git a/examples/bevy_gltf_components/basic_wasm/index.html b/examples/bevy_gltf_components/basic/index.html similarity index 100% rename from examples/bevy_gltf_components/basic_wasm/index.html rename to examples/bevy_gltf_components/basic/index.html diff --git a/examples/bevy_gltf_components/basic/src/core/camera/camera_replace_proxies.rs b/examples/bevy_gltf_components/basic/src/core/camera/camera_replace_proxies.rs deleted file mode 100644 index 9055c95..0000000 --- a/examples/bevy_gltf_components/basic/src/core/camera/camera_replace_proxies.rs +++ /dev/null @@ -1,24 +0,0 @@ -use bevy::core_pipeline::bloom::{BloomCompositeMode, BloomSettings}; -use bevy::core_pipeline::tonemapping::{DebandDither, Tonemapping}; -use bevy::prelude::*; - -use super::CameraTrackingOffset; - -pub fn camera_replace_proxies( - mut commands: Commands, - mut added_cameras: Query<(Entity, &mut Camera), (Added, With)>, -) { - for (entity, mut camera) in added_cameras.iter_mut() { - info!("detected added camera, updating proxy"); - camera.hdr = true; - commands - .entity(entity) - .insert(DebandDither::Enabled) - .insert(Tonemapping::BlenderFilmic) - .insert(BloomSettings { - intensity: 0.01, - composite_mode: BloomCompositeMode::Additive, - ..default() - }); - } -} diff --git a/examples/bevy_gltf_components/basic/src/core/camera/camera_tracking.rs b/examples/bevy_gltf_components/basic/src/core/camera/camera_tracking.rs deleted file mode 100644 index 62da84d..0000000 --- a/examples/bevy_gltf_components/basic/src/core/camera/camera_tracking.rs +++ /dev/null @@ -1,58 +0,0 @@ -use bevy::prelude::*; - -#[derive(Component, Reflect, Debug)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -/// -pub struct CameraTracking { - pub offset: Vec3, -} -impl Default for CameraTracking { - fn default() -> Self { - CameraTracking { - offset: Vec3::new(0.0, 6.0, 8.0), - } - } -} - -#[derive(Component, Reflect, Debug, Deref, DerefMut)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -pub struct CameraTrackingOffset(Vec3); -impl Default for CameraTrackingOffset { - fn default() -> Self { - CameraTrackingOffset(Vec3::new(0.0, 6.0, 8.0)) - } -} - -impl CameraTrackingOffset { - fn new(input: Vec3) -> Self { - CameraTrackingOffset(input) - } -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Add this component to an entity if you want it to be tracked by a Camera -pub struct CameraTrackable; - -pub fn camera_track( - mut tracking_cameras: Query< - (&mut Transform, &CameraTrackingOffset), - ( - With, - With, - Without, - ), - >, - camera_tracked: Query<&Transform, With>, -) { - for (mut camera_transform, tracking_offset) in tracking_cameras.iter_mut() { - for tracked_transform in camera_tracked.iter() { - let target_position = tracked_transform.translation + tracking_offset.0; - let eased_position = camera_transform.translation.lerp(target_position, 0.1); - camera_transform.translation = eased_position; // + tracking.offset;// tracked_transform.translation + tracking.offset; - *camera_transform = camera_transform.looking_at(tracked_transform.translation, Vec3::Y); - } - } -} diff --git a/examples/bevy_gltf_components/basic/src/core/camera/mod.rs b/examples/bevy_gltf_components/basic/src/core/camera/mod.rs deleted file mode 100644 index 9cc4bf3..0000000 --- a/examples/bevy_gltf_components/basic/src/core/camera/mod.rs +++ /dev/null @@ -1,17 +0,0 @@ -pub mod camera_tracking; -pub use camera_tracking::*; - -pub mod camera_replace_proxies; -pub use camera_replace_proxies::*; - -use bevy::prelude::*; - -pub struct CameraPlugin; -impl Plugin for CameraPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .register_type::() - .register_type::() - .add_systems(Update, (camera_replace_proxies, camera_track)); - } -} diff --git a/examples/bevy_gltf_components/basic/src/core/lighting/lighting_replace_proxies.rs b/examples/bevy_gltf_components/basic/src/core/lighting/lighting_replace_proxies.rs deleted file mode 100644 index 48c0908..0000000 --- a/examples/bevy_gltf_components/basic/src/core/lighting/lighting_replace_proxies.rs +++ /dev/null @@ -1,25 +0,0 @@ -use bevy::prelude::*; - -use bevy::pbr::{CascadeShadowConfig, CascadeShadowConfigBuilder}; - -// fixme might be too specific to might needs, should it be moved out ? also these are all for lights, not models -pub fn lighting_replace_proxies( - mut added_dirights: Query<(Entity, &mut DirectionalLight), Added>, - mut added_spotlights: Query<&mut SpotLight, Added>, - mut commands: Commands, -) { - for (entity, mut light) in added_dirights.iter_mut() { - light.illuminance *= 5.0; - light.shadows_enabled = true; - let shadow_config: CascadeShadowConfig = CascadeShadowConfigBuilder { - first_cascade_far_bound: 15.0, - maximum_distance: 135.0, - ..default() - } - .into(); - commands.entity(entity).insert(shadow_config); - } - for mut light in added_spotlights.iter_mut() { - light.shadows_enabled = true; - } -} diff --git a/examples/bevy_gltf_components/basic/src/core/lighting/mod.rs b/examples/bevy_gltf_components/basic/src/core/lighting/mod.rs deleted file mode 100644 index c9688cd..0000000 --- a/examples/bevy_gltf_components/basic/src/core/lighting/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -mod lighting_replace_proxies; -use lighting_replace_proxies::*; - -use bevy::pbr::{DirectionalLightShadowMap, NotShadowCaster}; -use bevy::prelude::*; - -pub struct LightingPlugin; -impl Plugin for LightingPlugin { - fn build(&self, app: &mut App) { - app - .insert_resource(DirectionalLightShadowMap { size: 4096 }) - // FIXME: adding these since they are missing - .register_type::() - - .add_systems(PreUpdate, lighting_replace_proxies) // FIXME: you should actually run this in a specific state most likely - ; - } -} diff --git a/examples/bevy_gltf_components/basic/src/core/physics/controls.rs b/examples/bevy_gltf_components/basic/src/core/physics/controls.rs deleted file mode 100644 index 8ee2b95..0000000 --- a/examples/bevy_gltf_components/basic/src/core/physics/controls.rs +++ /dev/null @@ -1,10 +0,0 @@ -use bevy::prelude::ResMut; -use bevy_rapier3d::prelude::RapierConfiguration; - -pub fn pause_physics(mut physics_config: ResMut) { - physics_config.physics_pipeline_active = false; -} - -pub fn resume_physics(mut physics_config: ResMut) { - physics_config.physics_pipeline_active = true; -} diff --git a/examples/bevy_gltf_components/basic/src/core/physics/mod.rs b/examples/bevy_gltf_components/basic/src/core/physics/mod.rs deleted file mode 100644 index 4b4b98b..0000000 --- a/examples/bevy_gltf_components/basic/src/core/physics/mod.rs +++ /dev/null @@ -1,27 +0,0 @@ -pub mod physics_replace_proxies; -pub use physics_replace_proxies::*; - -pub mod utils; - -pub mod controls; -pub use controls::*; - -use bevy::prelude::*; -// use crate::Collider; -pub struct PhysicsPlugin; -impl Plugin for PhysicsPlugin { - fn build(&self, app: &mut App) { - app - .register_type::() - .register_type::() - - // find a way to make serde's stuff serializable - // .register_type::() - //bevy_rapier3d::dynamics::CoefficientCombineRule - - .add_systems(Update, physics_replace_proxies) - //.add_system(pause_physics.in_schedule(OnEnter(GameState::InMenu))) - //.add_system(resume_physics.in_schedule(OnEnter(GameState::InGame))) - ; - } -} diff --git a/examples/bevy_gltf_components/basic/src/core/physics/physics_replace_proxies.rs b/examples/bevy_gltf_components/basic/src/core/physics/physics_replace_proxies.rs deleted file mode 100644 index 37edfe5..0000000 --- a/examples/bevy_gltf_components/basic/src/core/physics/physics_replace_proxies.rs +++ /dev/null @@ -1,101 +0,0 @@ -use bevy::prelude::*; -// use bevy::render::primitives::Aabb; -use bevy_rapier3d::geometry::Collider as RapierCollider; -use bevy_rapier3d::prelude::{ActiveCollisionTypes, ActiveEvents, ComputedColliderShape}; - -use super::utils::*; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum Collider { - Ball(f32), - Cuboid(Vec3), - Capsule(Vec3, Vec3, f32), - #[default] - Mesh, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum AutoAABBCollider { - #[default] - Cuboid, - Ball, - Capsule, -} - -// replaces all physics stand-ins with the actual rapier types -pub fn physics_replace_proxies( - meshes: Res>, - mesh_handles: Query<&Handle>, - mut proxy_colliders: Query< - (Entity, &Collider, &Name, &mut Visibility), - (Without, Added), - >, - // needed for tri meshes - children: Query<&Children>, - - mut commands: Commands, -) { - for proxy_colider in proxy_colliders.iter_mut() { - let (entity, collider_proxy, name, mut visibility) = proxy_colider; - // we hide the collider meshes: perhaps they should be removed altogether once processed ? - if name.ends_with("_collider") || name.ends_with("_sensor") { - *visibility = Visibility::Hidden; - } - - let mut rapier_collider: RapierCollider; - match collider_proxy { - Collider::Ball(radius) => { - println!("proxy: ball"); - rapier_collider = RapierCollider::ball(*radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Cuboid(size) => { - println!("proxy: cuboid"); - rapier_collider = RapierCollider::cuboid(size.x, size.y, size.z); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Capsule(a, b, radius) => { - println!("proxy: capsule"); - rapier_collider = RapierCollider::capsule(*a, *b, *radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Mesh => { - println!("proxy: mesh"); - for (_, collider_mesh) in - Mesh::search_in_children(entity, &children, &meshes, &mesh_handles) - { - rapier_collider = RapierCollider::from_bevy_mesh( - collider_mesh, - &ComputedColliderShape::TriMesh, - ) - .unwrap(); - commands - .entity(entity) - .insert(rapier_collider) - // FIXME: this is just for demo purposes !!! - .insert( - ActiveCollisionTypes::default() - | ActiveCollisionTypes::KINEMATIC_STATIC - | ActiveCollisionTypes::STATIC_STATIC - | ActiveCollisionTypes::DYNAMIC_STATIC, - ) - .insert(ActiveEvents::COLLISION_EVENTS); - // .insert(ActiveEvents::COLLISION_EVENTS) - // break; - // RapierCollider::convex_hull(points) - } - } - } - } -} diff --git a/examples/bevy_gltf_components/basic/src/core/physics/utils.rs b/examples/bevy_gltf_components/basic/src/core/physics/utils.rs deleted file mode 100644 index 7886710..0000000 --- a/examples/bevy_gltf_components/basic/src/core/physics/utils.rs +++ /dev/null @@ -1,175 +0,0 @@ -use bevy::prelude::*; -use bevy::render::mesh::{MeshVertexAttributeId, PrimitiveTopology, VertexAttributeValues}; -// TAKEN VERBATIB FROM https://github.com/janhohenheim/foxtrot/blob/src/util/trait_extension.rs - -pub(crate) trait Vec3Ext: Copy { - fn is_approx_zero(self) -> bool; - fn split(self, up: Vec3) -> SplitVec3; -} -impl Vec3Ext for Vec3 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn split(self, up: Vec3) -> SplitVec3 { - let vertical = up * self.dot(up); - let horizontal = self - vertical; - SplitVec3 { - vertical, - horizontal, - } - } -} - -#[derive(Debug, Clone, Copy, PartialEq)] -pub(crate) struct SplitVec3 { - pub(crate) vertical: Vec3, - pub(crate) horizontal: Vec3, -} - -pub(crate) trait Vec2Ext: Copy { - fn is_approx_zero(self) -> bool; - fn x0y(self) -> Vec3; -} -impl Vec2Ext for Vec2 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn x0y(self) -> Vec3 { - Vec3::new(self.x, 0., self.y) - } -} - -pub(crate) trait MeshExt { - fn transform(&mut self, transform: Transform); - fn transformed(&self, transform: Transform) -> Mesh; - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]>; - fn search_in_children<'a>( - parent: Entity, - children: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)>; -} - -impl MeshExt for Mesh { - fn transform(&mut self, transform: Transform) { - for coords in self.read_coords_mut(Mesh::ATTRIBUTE_POSITION.clone()) { - let vec3 = (*coords).into(); - let transformed = transform.transform_point(vec3); - *coords = transformed.into(); - } - for normal in self.read_coords_mut(Mesh::ATTRIBUTE_NORMAL.clone()) { - let vec3 = (*normal).into(); - let transformed = transform.rotation.mul_vec3(vec3); - *normal = transformed.into(); - } - } - - fn transformed(&self, transform: Transform) -> Mesh { - let mut mesh = self.clone(); - mesh.transform(transform); - mesh - } - - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]> { - // Guaranteed by Bevy for the current usage - match self - .attribute_mut(id) - .expect("Failed to read unknown mesh attribute") - { - VertexAttributeValues::Float32x3(values) => values, - // Guaranteed by Bevy for the current usage - _ => unreachable!(), - } - } - - fn search_in_children<'a>( - parent: Entity, - children_query: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)> { - if let Ok(children) = children_query.get(parent) { - let mut result: Vec<_> = children - .iter() - .filter_map(|entity| mesh_handles.get(*entity).ok().map(|mesh| (*entity, mesh))) - .map(|(entity, mesh_handle)| { - ( - entity, - meshes - .get(mesh_handle) - .expect("Failed to get mesh from handle"), - ) - }) - .map(|(entity, mesh)| { - assert_eq!(mesh.primitive_topology(), PrimitiveTopology::TriangleList); - (entity, mesh) - }) - .collect(); - let mut inner_result = children - .iter() - .flat_map(|entity| { - Self::search_in_children(*entity, children_query, meshes, mesh_handles) - }) - .collect(); - result.append(&mut inner_result); - result - } else { - Vec::new() - } - } -} - -pub(crate) trait F32Ext: Copy { - fn is_approx_zero(self) -> bool; - fn squared(self) -> f32; - fn lerp(self, other: f32, ratio: f32) -> f32; -} - -impl F32Ext for f32 { - #[inline] - fn is_approx_zero(self) -> bool { - self.abs() < 1e-5 - } - - #[inline] - fn squared(self) -> f32 { - self * self - } - - #[inline] - fn lerp(self, other: f32, ratio: f32) -> f32 { - self.mul_add(1. - ratio, other * ratio) - } -} - -pub(crate) trait TransformExt: Copy { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform; - fn lerp(self, other: Transform, ratio: f32) -> Transform; -} - -impl TransformExt for Transform { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform { - let direction = target - self.translation; - let horizontal_direction = direction - up * direction.dot(up); - let look_target = self.translation + horizontal_direction; - self.looking_at(look_target, up) - } - - fn lerp(self, other: Transform, ratio: f32) -> Transform { - let translation = self.translation.lerp(other.translation, ratio); - let rotation = self.rotation.slerp(other.rotation, ratio); - let scale = self.scale.lerp(other.scale, ratio); - Transform { - translation, - rotation, - scale, - } - } -} diff --git a/examples/bevy_gltf_components/basic/src/core/physics/utils_old.rs b/examples/bevy_gltf_components/basic/src/core/physics/utils_old.rs deleted file mode 100644 index c210dd3..0000000 --- a/examples/bevy_gltf_components/basic/src/core/physics/utils_old.rs +++ /dev/null @@ -1,75 +0,0 @@ -use bevy::prelude::*; -use bevy::render::mesh::{MeshVertexAttributeId, PrimitiveTopology, VertexAttributeValues}; -// TAKEN VERBATIB FROM https://github.com/janhohenheim/foxtrot/blob/6e31fc02652fc9d085a4adde0a73ab007dbbb0dc/src/util/trait_extension.rs - -pub trait Vec3Ext { - #[allow(clippy::wrong_self_convention)] // Because [`Vec3`] is [`Copy`] - fn is_approx_zero(self) -> bool; - fn x0z(self) -> Vec3; -} -impl Vec3Ext for Vec3 { - fn is_approx_zero(self) -> bool { - [self.x, self.y, self.z].iter().all(|&x| x.abs() < 1e-5) - } - fn x0z(self) -> Vec3 { - Vec3::new(self.x, 0., self.z) - } -} - -pub trait MeshExt { - fn transform(&mut self, transform: Transform); - fn transformed(&self, transform: Transform) -> Mesh; - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]>; - fn search_in_children<'a>( - children: &'a Children, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> (Entity, &'a Mesh); -} - -impl MeshExt for Mesh { - fn transform(&mut self, transform: Transform) { - for attribute in [Mesh::ATTRIBUTE_POSITION, Mesh::ATTRIBUTE_NORMAL] { - for coords in self.read_coords_mut(attribute.clone()) { - let vec3 = (*coords).into(); - let transformed = transform.transform_point(vec3); - *coords = transformed.into(); - } - } - } - - fn transformed(&self, transform: Transform) -> Mesh { - let mut mesh = self.clone(); - mesh.transform(transform); - mesh - } - - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]> { - match self.attribute_mut(id).unwrap() { - VertexAttributeValues::Float32x3(values) => values, - // Guaranteed by Bevy - _ => unreachable!(), - } - } - - fn search_in_children<'a>( - children: &'a Children, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> (Entity, &'a Mesh) { - let entity_handles: Vec<_> = children - .iter() - .filter_map(|entity| mesh_handles.get(*entity).ok().map(|mesh| (*entity, mesh))) - .collect(); - assert_eq!( - entity_handles.len(), - 1, - "Collider must contain exactly one mesh, but found {}", - entity_handles.len() - ); - let (entity, mesh_handle) = entity_handles.first().unwrap(); - let mesh = meshes.get(mesh_handle).unwrap(); - assert_eq!(mesh.primitive_topology(), PrimitiveTopology::TriangleList); - (*entity, mesh) - } -} diff --git a/examples/bevy_gltf_components/basic/src/core/relationships/mod.rs b/examples/bevy_gltf_components/basic/src/core/relationships/mod.rs deleted file mode 100644 index 4128453..0000000 --- a/examples/bevy_gltf_components/basic/src/core/relationships/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub mod relationships_insert_dependant_components; -pub use relationships_insert_dependant_components::*; - -use bevy::prelude::*; - -pub struct EcsRelationshipsPlugin; -impl Plugin for EcsRelationshipsPlugin { - fn build(&self, app: &mut App) { - app; - } -} diff --git a/examples/bevy_gltf_components/basic/src/core/relationships/relationships_insert_dependant_components.rs b/examples/bevy_gltf_components/basic/src/core/relationships/relationships_insert_dependant_components.rs deleted file mode 100644 index 4e9ad17..0000000 --- a/examples/bevy_gltf_components/basic/src/core/relationships/relationships_insert_dependant_components.rs +++ /dev/null @@ -1,15 +0,0 @@ -use bevy::prelude::*; - -pub fn insert_dependant_component< - Dependant: Component, - Dependency: Component + std::default::Default, ->( - mut commands: Commands, - entities_without_depency: Query<(Entity, &Name), (With, Without)>, -) { - for (entity, name) in entities_without_depency.iter() { - let name = name.clone().to_string(); - commands.entity(entity).insert(Dependency::default()); - warn!("found an entity called {} with a {} component but without an {}, please check your assets", name.clone(), std::any::type_name::(), std::any::type_name::()); - } -} diff --git a/examples/bevy_gltf_components/basic/src/game.rs b/examples/bevy_gltf_components/basic/src/game.rs deleted file mode 100644 index e62d5cc..0000000 --- a/examples/bevy_gltf_components/basic/src/game.rs +++ /dev/null @@ -1,102 +0,0 @@ -use crate::insert_dependant_component; -use bevy::prelude::*; -use bevy_rapier3d::prelude::*; - -// this file is just for demo purposes, contains various types of components, systems etc - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum SoundMaterial { - Metal, - Wood, - Rock, - Cloth, - Squishy, - #[default] - None, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Player; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo component showing auto injection of components -pub struct ShouldBeWithPlayer; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Interactible; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Pickable; - -fn player_move_demo( - keycode: Res>, - mut players: Query<&mut Transform, With>, -) { - let speed = 0.2; - if let Ok(mut player) = players.get_single_mut() { - if keycode.pressed(KeyCode::Left) { - player.translation.x += speed; - } - if keycode.pressed(KeyCode::Right) { - player.translation.x -= speed; - } - - if keycode.pressed(KeyCode::Up) { - player.translation.z += speed; - } - if keycode.pressed(KeyCode::Down) { - player.translation.z -= speed; - } - } -} - -// collision tests/debug -pub fn test_collision_events( - mut collision_events: EventReader, - mut contact_force_events: EventReader, -) { - for collision_event in collision_events.read() { - println!("collision"); - match collision_event { - CollisionEvent::Started(_entity1, _entity2, _) => { - println!("collision started") - } - CollisionEvent::Stopped(_entity1, _entity2, _) => { - println!("collision ended") - } - } - } - - for contact_force_event in contact_force_events.read() { - println!("Received contact force event: {:?}", contact_force_event); - } -} - -pub struct DemoPlugin; -impl Plugin for DemoPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .register_type::() - .register_type::() - .register_type::() - // little helper utility, to automatically inject components that are dependant on an other component - // ie, here an Entity with a Player component should also always have a ShouldBeWithPlayer component - // you get a warning if you use this, as I consider this to be stop-gap solution (usually you should have either a bundle, or directly define all needed components) - .add_systems( - Update, - ( - insert_dependant_component::, - player_move_demo, //.run_if(in_state(AppState::Running)), - test_collision_events, - ), - ); - } -} diff --git a/examples/bevy_gltf_components/basic/src/main.rs b/examples/bevy_gltf_components/basic/src/main.rs index 8827730..39035d3 100644 --- a/examples/bevy_gltf_components/basic/src/main.rs +++ b/examples/bevy_gltf_components/basic/src/main.rs @@ -1,13 +1,7 @@ use bevy::{gltf::Gltf, prelude::*}; use bevy_editor_pls::prelude::*; use bevy_gltf_components::ComponentsFromGltfPlugin; -use bevy_rapier3d::prelude::*; - -mod core; -use crate::core::*; - -mod game; -use game::*; +use bevy_gltf_worlflow_examples_common::CorePlugin; mod test_components; use test_components::*; @@ -24,27 +18,6 @@ enum AppState { Running, } -fn main() { - App::new() - .add_plugins(( - DefaultPlugins.set(AssetPlugin::default()), - // editor - EditorPlugin::default(), - // physics - RapierPhysicsPlugin::::default(), - RapierDebugRenderPlugin::default(), - // our custom plugins - ComponentsFromGltfPlugin::default(), - CorePlugin, // reusable plugins - DemoPlugin, // specific to our game - ComponentsTestPlugin, // Showcases different type of components /structs - )) - .add_state::() - .add_systems(Startup, setup) - .add_systems(Update, (spawn_level.run_if(in_state(AppState::Loading)),)) - .run(); -} - #[derive(Resource)] pub struct MyGltf(pub Handle); @@ -64,24 +37,39 @@ fn spawn_level( models: Res>, ) { if let Some(asset_event) = asset_event_reader.read().next() { - match asset_event { - AssetEvent::Added { id } => { - info!("GLTF loaded/ added {:?}", asset_event); - let my_gltf = models.get(*id).unwrap(); - if scene_markers.is_empty() { - info!("spawning scene"); - commands.spawn(( - SceneBundle { - scene: my_gltf.scenes[0].clone(), - ..default() - }, - LoadedMarker, - Name::new("Level1"), - )); - next_state.set(AppState::Running); - } + if let AssetEvent::Added { id } = asset_event { + info!("GLTF loaded/ added {:?}", asset_event); + let my_gltf = models.get(*id).unwrap(); + if scene_markers.is_empty() { + info!("spawning scene"); + commands.spawn(( + SceneBundle { + scene: my_gltf.scenes[0].clone(), + ..default() + }, + LoadedMarker, + Name::new("Level1"), + )); + next_state.set(AppState::Running); } - _ => (), } } } + +fn main() { + App::new() + .add_plugins(( + DefaultPlugins.set(AssetPlugin::default()), + // editor + EditorPlugin::default(), + // physics + // our custom plugins + ComponentsFromGltfPlugin::default(), + CorePlugin, // reusable plugins + ComponentsTestPlugin, // Showcases different type of components /structs + )) + .add_state::() + .add_systems(Startup, setup) + .add_systems(Update, (spawn_level.run_if(in_state(AppState::Loading)),)) + .run(); +} diff --git a/examples/bevy_gltf_components/basic/src/test_components.rs b/examples/bevy_gltf_components/basic/src/test_components.rs index d0e6fbd..b5384e2 100644 --- a/examples/bevy_gltf_components/basic/src/test_components.rs +++ b/examples/bevy_gltf_components/basic/src/test_components.rs @@ -6,39 +6,39 @@ struct UnitTest; #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -struct TuppleTestF32(f32); +struct TupleTestF32(f32); #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -struct TuppleTestU64(u64); +struct TupleTestU64(u64); #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -pub struct TuppleTestStr(String); +pub struct TupleTestStr(String); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTest2(f32, u64, String); +struct TupleTest2(f32, u64, String); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTestBool(bool); +struct TupleTestBool(bool); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec2(Vec2); +struct TupleVec2(Vec2); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec3(Vec3); +struct TupleVec3(Vec3); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec(Vec); +struct TupleVec(Vec); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTestColor(Color); +struct TupleTestColor(Color); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] @@ -65,16 +65,16 @@ impl Plugin for ComponentsTestPlugin { fn build(&self, app: &mut App) { app.register_type::() .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() .register_type::() - .register_type::() - .register_type::() + .register_type::() + .register_type::() .register_type::>(); } } diff --git a/examples/bevy_gltf_components/basic_wasm/.rustc_info.json b/examples/bevy_gltf_components/basic_wasm/.rustc_info.json deleted file mode 100644 index 613ed5e..0000000 --- a/examples/bevy_gltf_components/basic_wasm/.rustc_info.json +++ /dev/null @@ -1 +0,0 @@ -{"rustc_fingerprint":14672523188090023269,"outputs":{"4614504638168534921":{"success":true,"status":"","code":0,"stdout":"rustc 1.70.0 (90c541806 2023-05-31)\nbinary: rustc\ncommit-hash: 90c541806f23a127002de5b4038be731ba1458ca\ncommit-date: 2023-05-31\nhost: x86_64-unknown-linux-gnu\nrelease: 1.70.0\nLLVM version: 16.0.2\n","stderr":""}},"successes":{}} \ No newline at end of file diff --git a/examples/bevy_gltf_components/basic_wasm/Cargo.toml b/examples/bevy_gltf_components/basic_wasm/Cargo.toml deleted file mode 100644 index c3b823f..0000000 --- a/examples/bevy_gltf_components/basic_wasm/Cargo.toml +++ /dev/null @@ -1,27 +0,0 @@ -[package] -name = "bevy_gltf_components_basic_wasm_example" -version = "0.3.0" -edition = "2021" -license = "MIT OR Apache-2.0" - -[dependencies] -bevy="0.12" -bevy_gltf_components = { path = "../../../crates/bevy_gltf_components" } -bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] } -bevy_editor_pls = { version = "0.6" } - -[profile.wasm-release] -# Use release profile as default values -inherits = "release" - -# Optimize with size in mind, also try "s", sometimes it is better. -# This doesn't increase compilation times compared to -O3, great improvements -opt-level = "z" - -# Do a second optimization pass removing duplicate or unused code from dependencies. -# Slows compile times, marginal improvements -lto = "fat" - -# When building crates, optimize larger chunks at a time -# Slows compile times, marginal improvements -codegen-units = 1 \ No newline at end of file diff --git a/examples/bevy_gltf_components/basic_wasm/README.md b/examples/bevy_gltf_components/basic_wasm/README.md deleted file mode 100644 index f370400..0000000 --- a/examples/bevy_gltf_components/basic_wasm/README.md +++ /dev/null @@ -1,37 +0,0 @@ - -# Basic bevy_gltf_components wasm demo - -## Setup - -as per the bevy documentation: - -```shell -rustup target add wasm32-unknown-unknown -cargo install wasm-bindgen-cli -``` - - -## Building this example - -navigate to the current folder , and then - - -```shell -cargo build --release --target wasm32-unknown-unknown --target-dir ./target -wasm-bindgen --out-name wasm_example \ - --out-dir ./target/wasm \ - --target web target/wasm32-unknown-unknown/release/bevy_gltf_components_basic_wasm_example.wasm - -``` - -## Running this example - -run a web server in the current folder, and navigate to the page, you should see the example in your browser - -### Additional notes - - -## Information -- the Bevy/ Rust code is [here](./src/main.rs) -- the Blender file is [here](./assets/basic.blend) -- I added [bevy_editor_pls](https://github.com/jakobhellermann/bevy_editor_pls) as a dependency for convenience so you can inspect your level/components diff --git a/examples/bevy_gltf_components/basic_wasm/assets/basic.blend b/examples/bevy_gltf_components/basic_wasm/assets/basic.blend deleted file mode 100644 index 593df09..0000000 Binary files a/examples/bevy_gltf_components/basic_wasm/assets/basic.blend and /dev/null differ diff --git a/examples/bevy_gltf_components/basic_wasm/assets/models/Level1.glb b/examples/bevy_gltf_components/basic_wasm/assets/models/Level1.glb deleted file mode 100644 index 3779945..0000000 Binary files a/examples/bevy_gltf_components/basic_wasm/assets/models/Level1.glb and /dev/null differ diff --git a/examples/bevy_gltf_components/basic_wasm/src/core/camera/camera_replace_proxies.rs b/examples/bevy_gltf_components/basic_wasm/src/core/camera/camera_replace_proxies.rs deleted file mode 100644 index 9055c95..0000000 --- a/examples/bevy_gltf_components/basic_wasm/src/core/camera/camera_replace_proxies.rs +++ /dev/null @@ -1,24 +0,0 @@ -use bevy::core_pipeline::bloom::{BloomCompositeMode, BloomSettings}; -use bevy::core_pipeline::tonemapping::{DebandDither, Tonemapping}; -use bevy::prelude::*; - -use super::CameraTrackingOffset; - -pub fn camera_replace_proxies( - mut commands: Commands, - mut added_cameras: Query<(Entity, &mut Camera), (Added, With)>, -) { - for (entity, mut camera) in added_cameras.iter_mut() { - info!("detected added camera, updating proxy"); - camera.hdr = true; - commands - .entity(entity) - .insert(DebandDither::Enabled) - .insert(Tonemapping::BlenderFilmic) - .insert(BloomSettings { - intensity: 0.01, - composite_mode: BloomCompositeMode::Additive, - ..default() - }); - } -} diff --git a/examples/bevy_gltf_components/basic_wasm/src/core/camera/camera_tracking.rs b/examples/bevy_gltf_components/basic_wasm/src/core/camera/camera_tracking.rs deleted file mode 100644 index 62da84d..0000000 --- a/examples/bevy_gltf_components/basic_wasm/src/core/camera/camera_tracking.rs +++ /dev/null @@ -1,58 +0,0 @@ -use bevy::prelude::*; - -#[derive(Component, Reflect, Debug)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -/// -pub struct CameraTracking { - pub offset: Vec3, -} -impl Default for CameraTracking { - fn default() -> Self { - CameraTracking { - offset: Vec3::new(0.0, 6.0, 8.0), - } - } -} - -#[derive(Component, Reflect, Debug, Deref, DerefMut)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -pub struct CameraTrackingOffset(Vec3); -impl Default for CameraTrackingOffset { - fn default() -> Self { - CameraTrackingOffset(Vec3::new(0.0, 6.0, 8.0)) - } -} - -impl CameraTrackingOffset { - fn new(input: Vec3) -> Self { - CameraTrackingOffset(input) - } -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Add this component to an entity if you want it to be tracked by a Camera -pub struct CameraTrackable; - -pub fn camera_track( - mut tracking_cameras: Query< - (&mut Transform, &CameraTrackingOffset), - ( - With, - With, - Without, - ), - >, - camera_tracked: Query<&Transform, With>, -) { - for (mut camera_transform, tracking_offset) in tracking_cameras.iter_mut() { - for tracked_transform in camera_tracked.iter() { - let target_position = tracked_transform.translation + tracking_offset.0; - let eased_position = camera_transform.translation.lerp(target_position, 0.1); - camera_transform.translation = eased_position; // + tracking.offset;// tracked_transform.translation + tracking.offset; - *camera_transform = camera_transform.looking_at(tracked_transform.translation, Vec3::Y); - } - } -} diff --git a/examples/bevy_gltf_components/basic_wasm/src/core/camera/mod.rs b/examples/bevy_gltf_components/basic_wasm/src/core/camera/mod.rs deleted file mode 100644 index 9cc4bf3..0000000 --- a/examples/bevy_gltf_components/basic_wasm/src/core/camera/mod.rs +++ /dev/null @@ -1,17 +0,0 @@ -pub mod camera_tracking; -pub use camera_tracking::*; - -pub mod camera_replace_proxies; -pub use camera_replace_proxies::*; - -use bevy::prelude::*; - -pub struct CameraPlugin; -impl Plugin for CameraPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .register_type::() - .register_type::() - .add_systems(Update, (camera_replace_proxies, camera_track)); - } -} diff --git a/examples/bevy_gltf_components/basic_wasm/src/core/lighting/lighting_replace_proxies.rs b/examples/bevy_gltf_components/basic_wasm/src/core/lighting/lighting_replace_proxies.rs deleted file mode 100644 index 48c0908..0000000 --- a/examples/bevy_gltf_components/basic_wasm/src/core/lighting/lighting_replace_proxies.rs +++ /dev/null @@ -1,25 +0,0 @@ -use bevy::prelude::*; - -use bevy::pbr::{CascadeShadowConfig, CascadeShadowConfigBuilder}; - -// fixme might be too specific to might needs, should it be moved out ? also these are all for lights, not models -pub fn lighting_replace_proxies( - mut added_dirights: Query<(Entity, &mut DirectionalLight), Added>, - mut added_spotlights: Query<&mut SpotLight, Added>, - mut commands: Commands, -) { - for (entity, mut light) in added_dirights.iter_mut() { - light.illuminance *= 5.0; - light.shadows_enabled = true; - let shadow_config: CascadeShadowConfig = CascadeShadowConfigBuilder { - first_cascade_far_bound: 15.0, - maximum_distance: 135.0, - ..default() - } - .into(); - commands.entity(entity).insert(shadow_config); - } - for mut light in added_spotlights.iter_mut() { - light.shadows_enabled = true; - } -} diff --git a/examples/bevy_gltf_components/basic_wasm/src/core/lighting/mod.rs b/examples/bevy_gltf_components/basic_wasm/src/core/lighting/mod.rs deleted file mode 100644 index c9688cd..0000000 --- a/examples/bevy_gltf_components/basic_wasm/src/core/lighting/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -mod lighting_replace_proxies; -use lighting_replace_proxies::*; - -use bevy::pbr::{DirectionalLightShadowMap, NotShadowCaster}; -use bevy::prelude::*; - -pub struct LightingPlugin; -impl Plugin for LightingPlugin { - fn build(&self, app: &mut App) { - app - .insert_resource(DirectionalLightShadowMap { size: 4096 }) - // FIXME: adding these since they are missing - .register_type::() - - .add_systems(PreUpdate, lighting_replace_proxies) // FIXME: you should actually run this in a specific state most likely - ; - } -} diff --git a/examples/bevy_gltf_components/basic_wasm/src/core/mod.rs b/examples/bevy_gltf_components/basic_wasm/src/core/mod.rs deleted file mode 100644 index d6d4775..0000000 --- a/examples/bevy_gltf_components/basic_wasm/src/core/mod.rs +++ /dev/null @@ -1,19 +0,0 @@ -pub mod camera; -pub use camera::*; - -pub mod lighting; -pub use lighting::*; - -pub mod relationships; -pub use relationships::*; - -pub mod physics; -pub use physics::*; - -use bevy::prelude::*; -pub struct CorePlugin; -impl Plugin for CorePlugin { - fn build(&self, app: &mut App) { - app.add_plugins((LightingPlugin, CameraPlugin, PhysicsPlugin)); - } -} diff --git a/examples/bevy_gltf_components/basic_wasm/src/core/physics/controls.rs b/examples/bevy_gltf_components/basic_wasm/src/core/physics/controls.rs deleted file mode 100644 index 8ee2b95..0000000 --- a/examples/bevy_gltf_components/basic_wasm/src/core/physics/controls.rs +++ /dev/null @@ -1,10 +0,0 @@ -use bevy::prelude::ResMut; -use bevy_rapier3d::prelude::RapierConfiguration; - -pub fn pause_physics(mut physics_config: ResMut) { - physics_config.physics_pipeline_active = false; -} - -pub fn resume_physics(mut physics_config: ResMut) { - physics_config.physics_pipeline_active = true; -} diff --git a/examples/bevy_gltf_components/basic_wasm/src/core/physics/mod.rs b/examples/bevy_gltf_components/basic_wasm/src/core/physics/mod.rs deleted file mode 100644 index 4b4b98b..0000000 --- a/examples/bevy_gltf_components/basic_wasm/src/core/physics/mod.rs +++ /dev/null @@ -1,27 +0,0 @@ -pub mod physics_replace_proxies; -pub use physics_replace_proxies::*; - -pub mod utils; - -pub mod controls; -pub use controls::*; - -use bevy::prelude::*; -// use crate::Collider; -pub struct PhysicsPlugin; -impl Plugin for PhysicsPlugin { - fn build(&self, app: &mut App) { - app - .register_type::() - .register_type::() - - // find a way to make serde's stuff serializable - // .register_type::() - //bevy_rapier3d::dynamics::CoefficientCombineRule - - .add_systems(Update, physics_replace_proxies) - //.add_system(pause_physics.in_schedule(OnEnter(GameState::InMenu))) - //.add_system(resume_physics.in_schedule(OnEnter(GameState::InGame))) - ; - } -} diff --git a/examples/bevy_gltf_components/basic_wasm/src/core/physics/physics_replace_proxies.rs b/examples/bevy_gltf_components/basic_wasm/src/core/physics/physics_replace_proxies.rs deleted file mode 100644 index 37edfe5..0000000 --- a/examples/bevy_gltf_components/basic_wasm/src/core/physics/physics_replace_proxies.rs +++ /dev/null @@ -1,101 +0,0 @@ -use bevy::prelude::*; -// use bevy::render::primitives::Aabb; -use bevy_rapier3d::geometry::Collider as RapierCollider; -use bevy_rapier3d::prelude::{ActiveCollisionTypes, ActiveEvents, ComputedColliderShape}; - -use super::utils::*; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum Collider { - Ball(f32), - Cuboid(Vec3), - Capsule(Vec3, Vec3, f32), - #[default] - Mesh, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum AutoAABBCollider { - #[default] - Cuboid, - Ball, - Capsule, -} - -// replaces all physics stand-ins with the actual rapier types -pub fn physics_replace_proxies( - meshes: Res>, - mesh_handles: Query<&Handle>, - mut proxy_colliders: Query< - (Entity, &Collider, &Name, &mut Visibility), - (Without, Added), - >, - // needed for tri meshes - children: Query<&Children>, - - mut commands: Commands, -) { - for proxy_colider in proxy_colliders.iter_mut() { - let (entity, collider_proxy, name, mut visibility) = proxy_colider; - // we hide the collider meshes: perhaps they should be removed altogether once processed ? - if name.ends_with("_collider") || name.ends_with("_sensor") { - *visibility = Visibility::Hidden; - } - - let mut rapier_collider: RapierCollider; - match collider_proxy { - Collider::Ball(radius) => { - println!("proxy: ball"); - rapier_collider = RapierCollider::ball(*radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Cuboid(size) => { - println!("proxy: cuboid"); - rapier_collider = RapierCollider::cuboid(size.x, size.y, size.z); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Capsule(a, b, radius) => { - println!("proxy: capsule"); - rapier_collider = RapierCollider::capsule(*a, *b, *radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Mesh => { - println!("proxy: mesh"); - for (_, collider_mesh) in - Mesh::search_in_children(entity, &children, &meshes, &mesh_handles) - { - rapier_collider = RapierCollider::from_bevy_mesh( - collider_mesh, - &ComputedColliderShape::TriMesh, - ) - .unwrap(); - commands - .entity(entity) - .insert(rapier_collider) - // FIXME: this is just for demo purposes !!! - .insert( - ActiveCollisionTypes::default() - | ActiveCollisionTypes::KINEMATIC_STATIC - | ActiveCollisionTypes::STATIC_STATIC - | ActiveCollisionTypes::DYNAMIC_STATIC, - ) - .insert(ActiveEvents::COLLISION_EVENTS); - // .insert(ActiveEvents::COLLISION_EVENTS) - // break; - // RapierCollider::convex_hull(points) - } - } - } - } -} diff --git a/examples/bevy_gltf_components/basic_wasm/src/core/physics/utils.rs b/examples/bevy_gltf_components/basic_wasm/src/core/physics/utils.rs deleted file mode 100644 index 7886710..0000000 --- a/examples/bevy_gltf_components/basic_wasm/src/core/physics/utils.rs +++ /dev/null @@ -1,175 +0,0 @@ -use bevy::prelude::*; -use bevy::render::mesh::{MeshVertexAttributeId, PrimitiveTopology, VertexAttributeValues}; -// TAKEN VERBATIB FROM https://github.com/janhohenheim/foxtrot/blob/src/util/trait_extension.rs - -pub(crate) trait Vec3Ext: Copy { - fn is_approx_zero(self) -> bool; - fn split(self, up: Vec3) -> SplitVec3; -} -impl Vec3Ext for Vec3 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn split(self, up: Vec3) -> SplitVec3 { - let vertical = up * self.dot(up); - let horizontal = self - vertical; - SplitVec3 { - vertical, - horizontal, - } - } -} - -#[derive(Debug, Clone, Copy, PartialEq)] -pub(crate) struct SplitVec3 { - pub(crate) vertical: Vec3, - pub(crate) horizontal: Vec3, -} - -pub(crate) trait Vec2Ext: Copy { - fn is_approx_zero(self) -> bool; - fn x0y(self) -> Vec3; -} -impl Vec2Ext for Vec2 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn x0y(self) -> Vec3 { - Vec3::new(self.x, 0., self.y) - } -} - -pub(crate) trait MeshExt { - fn transform(&mut self, transform: Transform); - fn transformed(&self, transform: Transform) -> Mesh; - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]>; - fn search_in_children<'a>( - parent: Entity, - children: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)>; -} - -impl MeshExt for Mesh { - fn transform(&mut self, transform: Transform) { - for coords in self.read_coords_mut(Mesh::ATTRIBUTE_POSITION.clone()) { - let vec3 = (*coords).into(); - let transformed = transform.transform_point(vec3); - *coords = transformed.into(); - } - for normal in self.read_coords_mut(Mesh::ATTRIBUTE_NORMAL.clone()) { - let vec3 = (*normal).into(); - let transformed = transform.rotation.mul_vec3(vec3); - *normal = transformed.into(); - } - } - - fn transformed(&self, transform: Transform) -> Mesh { - let mut mesh = self.clone(); - mesh.transform(transform); - mesh - } - - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]> { - // Guaranteed by Bevy for the current usage - match self - .attribute_mut(id) - .expect("Failed to read unknown mesh attribute") - { - VertexAttributeValues::Float32x3(values) => values, - // Guaranteed by Bevy for the current usage - _ => unreachable!(), - } - } - - fn search_in_children<'a>( - parent: Entity, - children_query: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)> { - if let Ok(children) = children_query.get(parent) { - let mut result: Vec<_> = children - .iter() - .filter_map(|entity| mesh_handles.get(*entity).ok().map(|mesh| (*entity, mesh))) - .map(|(entity, mesh_handle)| { - ( - entity, - meshes - .get(mesh_handle) - .expect("Failed to get mesh from handle"), - ) - }) - .map(|(entity, mesh)| { - assert_eq!(mesh.primitive_topology(), PrimitiveTopology::TriangleList); - (entity, mesh) - }) - .collect(); - let mut inner_result = children - .iter() - .flat_map(|entity| { - Self::search_in_children(*entity, children_query, meshes, mesh_handles) - }) - .collect(); - result.append(&mut inner_result); - result - } else { - Vec::new() - } - } -} - -pub(crate) trait F32Ext: Copy { - fn is_approx_zero(self) -> bool; - fn squared(self) -> f32; - fn lerp(self, other: f32, ratio: f32) -> f32; -} - -impl F32Ext for f32 { - #[inline] - fn is_approx_zero(self) -> bool { - self.abs() < 1e-5 - } - - #[inline] - fn squared(self) -> f32 { - self * self - } - - #[inline] - fn lerp(self, other: f32, ratio: f32) -> f32 { - self.mul_add(1. - ratio, other * ratio) - } -} - -pub(crate) trait TransformExt: Copy { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform; - fn lerp(self, other: Transform, ratio: f32) -> Transform; -} - -impl TransformExt for Transform { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform { - let direction = target - self.translation; - let horizontal_direction = direction - up * direction.dot(up); - let look_target = self.translation + horizontal_direction; - self.looking_at(look_target, up) - } - - fn lerp(self, other: Transform, ratio: f32) -> Transform { - let translation = self.translation.lerp(other.translation, ratio); - let rotation = self.rotation.slerp(other.rotation, ratio); - let scale = self.scale.lerp(other.scale, ratio); - Transform { - translation, - rotation, - scale, - } - } -} diff --git a/examples/bevy_gltf_components/basic_wasm/src/core/relationships/mod.rs b/examples/bevy_gltf_components/basic_wasm/src/core/relationships/mod.rs deleted file mode 100644 index 4128453..0000000 --- a/examples/bevy_gltf_components/basic_wasm/src/core/relationships/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub mod relationships_insert_dependant_components; -pub use relationships_insert_dependant_components::*; - -use bevy::prelude::*; - -pub struct EcsRelationshipsPlugin; -impl Plugin for EcsRelationshipsPlugin { - fn build(&self, app: &mut App) { - app; - } -} diff --git a/examples/bevy_gltf_components/basic_wasm/src/core/relationships/relationships_insert_dependant_components.rs b/examples/bevy_gltf_components/basic_wasm/src/core/relationships/relationships_insert_dependant_components.rs deleted file mode 100644 index 4e9ad17..0000000 --- a/examples/bevy_gltf_components/basic_wasm/src/core/relationships/relationships_insert_dependant_components.rs +++ /dev/null @@ -1,15 +0,0 @@ -use bevy::prelude::*; - -pub fn insert_dependant_component< - Dependant: Component, - Dependency: Component + std::default::Default, ->( - mut commands: Commands, - entities_without_depency: Query<(Entity, &Name), (With, Without)>, -) { - for (entity, name) in entities_without_depency.iter() { - let name = name.clone().to_string(); - commands.entity(entity).insert(Dependency::default()); - warn!("found an entity called {} with a {} component but without an {}, please check your assets", name.clone(), std::any::type_name::(), std::any::type_name::()); - } -} diff --git a/examples/bevy_gltf_components/basic_wasm/src/game.rs b/examples/bevy_gltf_components/basic_wasm/src/game.rs deleted file mode 100644 index e62d5cc..0000000 --- a/examples/bevy_gltf_components/basic_wasm/src/game.rs +++ /dev/null @@ -1,102 +0,0 @@ -use crate::insert_dependant_component; -use bevy::prelude::*; -use bevy_rapier3d::prelude::*; - -// this file is just for demo purposes, contains various types of components, systems etc - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum SoundMaterial { - Metal, - Wood, - Rock, - Cloth, - Squishy, - #[default] - None, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Player; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo component showing auto injection of components -pub struct ShouldBeWithPlayer; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Interactible; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Pickable; - -fn player_move_demo( - keycode: Res>, - mut players: Query<&mut Transform, With>, -) { - let speed = 0.2; - if let Ok(mut player) = players.get_single_mut() { - if keycode.pressed(KeyCode::Left) { - player.translation.x += speed; - } - if keycode.pressed(KeyCode::Right) { - player.translation.x -= speed; - } - - if keycode.pressed(KeyCode::Up) { - player.translation.z += speed; - } - if keycode.pressed(KeyCode::Down) { - player.translation.z -= speed; - } - } -} - -// collision tests/debug -pub fn test_collision_events( - mut collision_events: EventReader, - mut contact_force_events: EventReader, -) { - for collision_event in collision_events.read() { - println!("collision"); - match collision_event { - CollisionEvent::Started(_entity1, _entity2, _) => { - println!("collision started") - } - CollisionEvent::Stopped(_entity1, _entity2, _) => { - println!("collision ended") - } - } - } - - for contact_force_event in contact_force_events.read() { - println!("Received contact force event: {:?}", contact_force_event); - } -} - -pub struct DemoPlugin; -impl Plugin for DemoPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .register_type::() - .register_type::() - .register_type::() - // little helper utility, to automatically inject components that are dependant on an other component - // ie, here an Entity with a Player component should also always have a ShouldBeWithPlayer component - // you get a warning if you use this, as I consider this to be stop-gap solution (usually you should have either a bundle, or directly define all needed components) - .add_systems( - Update, - ( - insert_dependant_component::, - player_move_demo, //.run_if(in_state(AppState::Running)), - test_collision_events, - ), - ); - } -} diff --git a/examples/bevy_gltf_components/basic_wasm/src/main.rs b/examples/bevy_gltf_components/basic_wasm/src/main.rs deleted file mode 100644 index 8827730..0000000 --- a/examples/bevy_gltf_components/basic_wasm/src/main.rs +++ /dev/null @@ -1,87 +0,0 @@ -use bevy::{gltf::Gltf, prelude::*}; -use bevy_editor_pls::prelude::*; -use bevy_gltf_components::ComponentsFromGltfPlugin; -use bevy_rapier3d::prelude::*; - -mod core; -use crate::core::*; - -mod game; -use game::*; - -mod test_components; -use test_components::*; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// helper marker component -pub struct LoadedMarker; - -#[derive(Debug, Clone, Copy, Default, Eq, PartialEq, Hash, States)] -enum AppState { - #[default] - Loading, - Running, -} - -fn main() { - App::new() - .add_plugins(( - DefaultPlugins.set(AssetPlugin::default()), - // editor - EditorPlugin::default(), - // physics - RapierPhysicsPlugin::::default(), - RapierDebugRenderPlugin::default(), - // our custom plugins - ComponentsFromGltfPlugin::default(), - CorePlugin, // reusable plugins - DemoPlugin, // specific to our game - ComponentsTestPlugin, // Showcases different type of components /structs - )) - .add_state::() - .add_systems(Startup, setup) - .add_systems(Update, (spawn_level.run_if(in_state(AppState::Loading)),)) - .run(); -} - -#[derive(Resource)] -pub struct MyGltf(pub Handle); - -// we preload the data here, but this is for DEMO PURPOSES ONLY !! Please use https://github.com/NiklasEi/bevy_asset_loader or a similar logic to seperate loading / pre processing -// of assets from the spawning -// MyGltf is also just for the same purpose, you do not need it in a real scenario -// the states here are also for demo purposes only, -fn setup(mut commands: Commands, asset_server: Res) { - commands.insert_resource(MyGltf(asset_server.load("models/Level1.glb"))); -} - -fn spawn_level( - mut commands: Commands, - scene_markers: Query<&LoadedMarker>, - mut asset_event_reader: EventReader>, - mut next_state: ResMut>, - models: Res>, -) { - if let Some(asset_event) = asset_event_reader.read().next() { - match asset_event { - AssetEvent::Added { id } => { - info!("GLTF loaded/ added {:?}", asset_event); - let my_gltf = models.get(*id).unwrap(); - if scene_markers.is_empty() { - info!("spawning scene"); - commands.spawn(( - SceneBundle { - scene: my_gltf.scenes[0].clone(), - ..default() - }, - LoadedMarker, - Name::new("Level1"), - )); - next_state.set(AppState::Running); - } - } - _ => (), - } - } -} diff --git a/examples/bevy_gltf_components/basic_wasm/src/test_components.rs b/examples/bevy_gltf_components/basic_wasm/src/test_components.rs deleted file mode 100644 index d0e6fbd..0000000 --- a/examples/bevy_gltf_components/basic_wasm/src/test_components.rs +++ /dev/null @@ -1,80 +0,0 @@ -use bevy::prelude::*; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct UnitTest; - -#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] -#[reflect(Component)] -struct TuppleTestF32(f32); - -#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] -#[reflect(Component)] -struct TuppleTestU64(u64); - -#[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] -#[reflect(Component)] -pub struct TuppleTestStr(String); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleTest2(f32, u64, String); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleTestBool(bool); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleVec2(Vec2); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleVec3(Vec3); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleVec(Vec); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct TuppleTestColor(Color); - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -struct BasicTest { - a: f32, - b: u64, - c: String, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum EnumTest { - Metal, - Wood, - Rock, - Cloth, - Squishy, - #[default] - None, -} - -pub struct ComponentsTestPlugin; -impl Plugin for ComponentsTestPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::>(); - } -} diff --git a/examples/bevy_gltf_save_load/basic/Cargo.toml b/examples/bevy_gltf_save_load/basic/Cargo.toml index 5f8676f..8685e79 100644 --- a/examples/bevy_gltf_save_load/basic/Cargo.toml +++ b/examples/bevy_gltf_save_load/basic/Cargo.toml @@ -8,6 +8,7 @@ license = "MIT OR Apache-2.0" bevy="0.12" bevy_gltf_blueprints = "0.7" bevy_gltf_save_load = { path = "../../../crates/bevy_gltf_save_load" } +bevy_gltf_worlflow_examples_common = { path = "../../common" } bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] } bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]} diff --git a/examples/bevy_gltf_save_load/basic/assets/scenes/save.scn.ron b/examples/bevy_gltf_save_load/basic/assets/scenes/save.scn.ron index c6b2b53..7bfc7c2 100644 --- a/examples/bevy_gltf_save_load/basic/assets/scenes/save.scn.ron +++ b/examples/bevy_gltf_save_load/basic/assets/scenes/save.scn.ron @@ -6,13 +6,13 @@ ), }, entities: { - 4294967309: ( + 4294967366: ( components: { "bevy_transform::components::transform::Transform": ( translation: ( - x: -3.4747214, + x: 3.2857952, y: 2.0, - z: -0.47800493, + z: 2.5374498, ), rotation: ( x: 0.0, @@ -45,18 +45,73 @@ ), ), translation: ( - x: -26.735256, - y: 3.6987834, - z: -24.778835, + x: -7.688917, + y: 5.6987834, + z: -9.425901, ), )), "bevy_core::name::Name": ( - hash: 11525084598183387914, + hash: 8538030051948141679, + name: "SubParentingTest", + ), + "bevy_hierarchy::components::parent::Parent": (12884901959), + "bevy_gltf_save_load::saveable::Dynamic": (true), + "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Sphero"), + "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), + "bevy_render::view::visibility::InheritedVisibility": (true), + }, + ), + 4294967368: ( + components: { + "bevy_transform::components::transform::Transform": ( + translation: ( + x: 5.4583645, + y: 2.0, + z: -1.8563004, + ), + rotation: ( + x: 0.0, + y: 0.0, + z: 0.0, + w: 1.0, + ), + scale: ( + x: 1.0, + y: 1.0, + z: 1.0, + ), + ), + "bevy_transform::components::global_transform::GlobalTransform": (( + matrix3: ( + x_axis: ( + x: 1.0, + y: 0.0, + z: 0.0, + ), + y_axis: ( + x: 0.0, + y: 1.0, + z: 0.0, + ), + z_axis: ( + x: 0.0, + y: 0.0, + z: 1.0, + ), + ), + translation: ( + x: -8.802143, + y: 3.6987834, + z: -16.357101, + ), + )), + "bevy_core::name::Name": ( + hash: 13198606238288724329, name: "ParentingTest", ), - "bevy_hierarchy::components::parent::Parent": (4294967355), + "bevy_hierarchy::components::parent::Parent": (20), "bevy_hierarchy::components::children::Children": ([ - 4294967318, + 17179869259, ]), "bevy_gltf_save_load::saveable::Dynamic": (true), "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Container"), @@ -64,13 +119,13 @@ "bevy_render::view::visibility::InheritedVisibility": (true), }, ), - 4294967313: ( + 12884901959: ( components: { "bevy_transform::components::transform::Transform": ( translation: ( - x: -2.2050228, + x: 3.2857952, y: 2.0, - z: 5.3109236, + z: 2.5374498, ), rotation: ( x: 0.0, @@ -103,128 +158,18 @@ ), ), translation: ( - x: -27.67058, - y: 5.6987834, - z: -13.678983, - ), - )), - "bevy_core::name::Name": ( - hash: 12227652970378347066, - name: "SubParentingTest", - ), - "bevy_hierarchy::components::parent::Parent": (17179869209), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Sphero"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - }, - ), - 4294967314: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -4.2068176, - y: 2.0, - z: 3.3114986, - ), - rotation: ( - x: 0.0, - y: 0.0, - z: 0.0, - w: 1.0, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 1.0, - y: 0.0, - z: 0.0, - ), - y_axis: ( - x: 0.0, - y: 1.0, - z: 0.0, - ), - z_axis: ( - x: 0.0, - y: 0.0, - z: 1.0, - ), - ), - translation: ( - x: -31.67417, - y: 5.6987834, - z: -17.677834, - ), - )), - "bevy_core::name::Name": ( - hash: 12227652970378347066, - name: "SubParentingTest", - ), - "bevy_hierarchy::components::parent::Parent": (4294967329), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Sphero"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - }, - ), - 4294967315: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -1.0132551, - y: 2.0, - z: -2.93677, - ), - rotation: ( - x: 0.0, - y: 0.0, - z: 0.0, - w: 1.0, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 1.0, - y: 0.0, - z: 0.0, - ), - y_axis: ( - x: 0.0, - y: 1.0, - z: 0.0, - ), - z_axis: ( - x: 0.0, - y: 0.0, - z: 1.0, - ), - ), - translation: ( - x: -24.273788, + x: -10.974712, y: 3.6987834, - z: -27.2376, + z: -11.963351, ), )), "bevy_core::name::Name": ( - hash: 11525084598183387914, + hash: 13198606238288724329, name: "ParentingTest", ), - "bevy_hierarchy::components::parent::Parent": (4294967355), + "bevy_hierarchy::components::parent::Parent": (20), "bevy_hierarchy::components::children::Children": ([ - 4294967328, + 4294967366, ]), "bevy_gltf_save_load::saveable::Dynamic": (true), "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Container"), @@ -232,13 +177,13 @@ "bevy_render::view::visibility::InheritedVisibility": (true), }, ), - 4294967316: ( + 17179869259: ( components: { "bevy_transform::components::transform::Transform": ( translation: ( - x: -5.375821, + x: 5.4583645, y: 2.0, - z: -1.2236366, + z: -1.8563004, ), rotation: ( x: 0.0, @@ -271,29 +216,29 @@ ), ), translation: ( - x: -34.012177, + x: -3.3437786, y: 5.6987834, - z: -26.748104, + z: -18.213402, ), )), "bevy_core::name::Name": ( - hash: 12227652970378347066, + hash: 8538030051948141679, name: "SubParentingTest", ), - "bevy_hierarchy::components::parent::Parent": (12884901893), + "bevy_hierarchy::components::parent::Parent": (4294967368), "bevy_gltf_save_load::saveable::Dynamic": (true), "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Sphero"), "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), "bevy_render::view::visibility::InheritedVisibility": (true), }, ), - 4294967318: ( + 17179869267: ( components: { "bevy_transform::components::transform::Transform": ( translation: ( - x: -3.4747214, + x: -3.449185, y: 2.0, - z: -0.47800493, + z: 2.4954972, ), rotation: ( x: 0.0, @@ -326,73 +271,18 @@ ), ), translation: ( - x: -30.209978, - y: 5.6987834, - z: -25.25684, - ), - )), - "bevy_core::name::Name": ( - hash: 12227652970378347066, - name: "SubParentingTest", - ), - "bevy_hierarchy::components::parent::Parent": (4294967309), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Sphero"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - }, - ), - 4294967319: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 1.4628916, - y: 2.0, - z: -5.380514, - ), - rotation: ( - x: 0.0, - y: 0.0, - z: 0.0, - w: 1.0, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 1.0, - y: 0.0, - z: 0.0, - ), - y_axis: ( - x: 0.0, - y: 1.0, - z: 0.0, - ), - z_axis: ( - x: 0.0, - y: 0.0, - z: 1.0, - ), - ), - translation: ( - x: -21.797642, + x: -17.709692, y: 3.6987834, - z: -29.681345, + z: -12.005304, ), )), "bevy_core::name::Name": ( - hash: 11525084598183387914, + hash: 13198606238288724329, name: "ParentingTest", ), - "bevy_hierarchy::components::parent::Parent": (4294967355), + "bevy_hierarchy::components::parent::Parent": (20), "bevy_hierarchy::components::children::Children": ([ - 4294967323, + 17179869270, ]), "bevy_gltf_save_load::saveable::Dynamic": (true), "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Container"), @@ -400,13 +290,13 @@ "bevy_render::view::visibility::InheritedVisibility": (true), }, ), - 4294967322: ( + 17179869270: ( components: { "bevy_transform::components::transform::Transform": ( translation: ( - x: -5.3368125, + x: -3.449185, y: 2.0, - z: -4.6879, + z: 2.4954972, ), rotation: ( x: 0.0, @@ -439,29 +329,29 @@ ), ), translation: ( - x: -33.93416, + x: -21.158876, y: 5.6987834, - z: -33.676632, + z: -9.509808, ), )), "bevy_core::name::Name": ( - hash: 12227652970378347066, + hash: 8538030051948141679, name: "SubParentingTest", ), - "bevy_hierarchy::components::parent::Parent": (17179869213), + "bevy_hierarchy::components::parent::Parent": (17179869267), "bevy_gltf_save_load::saveable::Dynamic": (true), "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Sphero"), "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), "bevy_render::view::visibility::InheritedVisibility": (true), }, ), - 4294967323: ( + 17179869278: ( components: { "bevy_transform::components::transform::Transform": ( translation: ( - x: 1.4628916, + x: 4.9166813, y: 2.0, - z: -5.380514, + z: -4.385274, ), rotation: ( x: 0.0, @@ -494,29 +384,87 @@ ), ), translation: ( - x: -20.334751, - y: 5.6987834, - z: -35.06186, + x: -9.343826, + y: 3.6987834, + z: -18.886074, ), )), "bevy_core::name::Name": ( - hash: 12227652970378347066, + hash: 13198606238288724329, + name: "ParentingTest", + ), + "bevy_hierarchy::components::parent::Parent": (20), + "bevy_hierarchy::components::children::Children": ([ + 17179869281, + ]), + "bevy_gltf_save_load::saveable::Dynamic": (true), + "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Container"), + "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), + "bevy_render::view::visibility::InheritedVisibility": (true), + }, + ), + 17179869281: ( + components: { + "bevy_transform::components::transform::Transform": ( + translation: ( + x: 4.9166813, + y: 2.0, + z: -4.385274, + ), + rotation: ( + x: 0.0, + y: 0.0, + z: 0.0, + w: 1.0, + ), + scale: ( + x: 1.0, + y: 1.0, + z: 1.0, + ), + ), + "bevy_transform::components::global_transform::GlobalTransform": (( + matrix3: ( + x_axis: ( + x: 1.0, + y: 0.0, + z: 0.0, + ), + y_axis: ( + x: 0.0, + y: 1.0, + z: 0.0, + ), + z_axis: ( + x: 0.0, + y: 0.0, + z: 1.0, + ), + ), + translation: ( + x: -4.427145, + y: 5.6987834, + z: -23.271347, + ), + )), + "bevy_core::name::Name": ( + hash: 8538030051948141679, name: "SubParentingTest", ), - "bevy_hierarchy::components::parent::Parent": (4294967319), + "bevy_hierarchy::components::parent::Parent": (17179869278), "bevy_gltf_save_load::saveable::Dynamic": (true), "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Sphero"), "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), "bevy_render::view::visibility::InheritedVisibility": (true), }, ), - 4294967326: ( + 17179869289: ( components: { "bevy_transform::components::transform::Transform": ( translation: ( - x: 5.1854753, + x: -1.0554132, y: 2.0, - z: 0.4241066, + z: -3.632555, ), rotation: ( x: 0.0, @@ -549,18 +497,18 @@ ), ), translation: ( - x: -18.075058, + x: -15.315921, y: 3.6987834, - z: -23.876724, + z: -18.133356, ), )), "bevy_core::name::Name": ( - hash: 11525084598183387914, + hash: 13198606238288724329, name: "ParentingTest", ), - "bevy_hierarchy::components::parent::Parent": (4294967355), + "bevy_hierarchy::components::parent::Parent": (20), "bevy_hierarchy::components::children::Children": ([ - 4294967331, + 17179869292, ]), "bevy_gltf_save_load::saveable::Dynamic": (true), "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Container"), @@ -568,13 +516,13 @@ "bevy_render::view::visibility::InheritedVisibility": (true), }, ), - 4294967327: ( + 17179869292: ( components: { "bevy_transform::components::transform::Transform": ( translation: ( - x: 2.0302448, + x: -1.0554132, y: 2.0, - z: 0.7366843, + z: -3.632555, ), rotation: ( x: 0.0, @@ -607,29 +555,29 @@ ), ), translation: ( - x: -19.200045, + x: -16.371334, y: 5.6987834, - z: -22.827461, + z: -21.765911, ), )), "bevy_core::name::Name": ( - hash: 12227652970378347066, + hash: 8538030051948141679, name: "SubParentingTest", ), - "bevy_hierarchy::components::parent::Parent": (8589934599), + "bevy_hierarchy::components::parent::Parent": (17179869289), "bevy_gltf_save_load::saveable::Dynamic": (true), "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Sphero"), "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), "bevy_render::view::visibility::InheritedVisibility": (true), }, ), - 4294967328: ( + 17179869300: ( components: { "bevy_transform::components::transform::Transform": ( translation: ( - x: -1.0132551, + x: -1.6405792, y: 2.0, - z: -2.93677, + z: -5.160252, ), rotation: ( x: 0.0, @@ -662,803 +610,81 @@ ), ), translation: ( - x: -25.287045, - y: 5.6987834, - z: -30.17437, + x: -15.901087, + y: 3.6987834, + z: -19.661053, ), )), "bevy_core::name::Name": ( - hash: 12227652970378347066, + hash: 13198606238288724329, + name: "ParentingTest", + ), + "bevy_hierarchy::components::parent::Parent": (20), + "bevy_hierarchy::components::children::Children": ([ + 17179869303, + ]), + "bevy_gltf_save_load::saveable::Dynamic": (true), + "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Container"), + "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), + "bevy_render::view::visibility::InheritedVisibility": (true), + }, + ), + 17179869303: ( + components: { + "bevy_transform::components::transform::Transform": ( + translation: ( + x: -1.6405792, + y: 2.0, + z: -5.160252, + ), + rotation: ( + x: 0.0, + y: 0.0, + z: 0.0, + w: 1.0, + ), + scale: ( + x: 1.0, + y: 1.0, + z: 1.0, + ), + ), + "bevy_transform::components::global_transform::GlobalTransform": (( + matrix3: ( + x_axis: ( + x: 1.0, + y: 0.0, + z: 0.0, + ), + y_axis: ( + x: 0.0, + y: 1.0, + z: 0.0, + ), + z_axis: ( + x: 0.0, + y: 0.0, + z: 1.0, + ), + ), + translation: ( + x: -17.541666, + y: 5.6987834, + z: -24.821304, + ), + )), + "bevy_core::name::Name": ( + hash: 8538030051948141679, name: "SubParentingTest", ), - "bevy_hierarchy::components::parent::Parent": (4294967315), + "bevy_hierarchy::components::parent::Parent": (17179869300), "bevy_gltf_save_load::saveable::Dynamic": (true), "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Sphero"), "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), "bevy_render::view::visibility::InheritedVisibility": (true), }, ), - 4294967329: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -4.2068176, - y: 2.0, - z: 3.3114986, - ), - rotation: ( - x: 0.0, - y: 0.0, - z: 0.0, - w: 1.0, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 1.0, - y: 0.0, - z: 0.0, - ), - y_axis: ( - x: 0.0, - y: 1.0, - z: 0.0, - ), - z_axis: ( - x: 0.0, - y: 0.0, - z: 1.0, - ), - ), - translation: ( - x: -27.467352, - y: 3.6987834, - z: -20.989332, - ), - )), - "bevy_core::name::Name": ( - hash: 11525084598183387914, - name: "ParentingTest", - ), - "bevy_hierarchy::components::parent::Parent": (4294967355), - "bevy_hierarchy::components::children::Children": ([ - 4294967314, - ]), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Container"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - }, - ), - 4294967330: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -5.2756443, - y: 2.0, - z: 3.7743902, - ), - rotation: ( - x: 0.0, - y: 0.0, - z: 0.0, - w: 1.0, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 1.0, - y: 0.0, - z: 0.0, - ), - y_axis: ( - x: 0.0, - y: 1.0, - z: 0.0, - ), - z_axis: ( - x: 0.0, - y: 0.0, - z: 1.0, - ), - ), - translation: ( - x: -28.536179, - y: 3.6987834, - z: -20.52644, - ), - )), - "bevy_core::name::Name": ( - hash: 11525084598183387914, - name: "ParentingTest", - ), - "bevy_hierarchy::components::parent::Parent": (4294967355), - "bevy_hierarchy::components::children::Children": ([ - 21474836496, - ]), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Container"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - }, - ), - 4294967331: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 5.1854753, - y: 2.0, - z: 0.4241066, - ), - rotation: ( - x: 0.0, - y: 0.0, - z: 0.0, - w: 1.0, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 1.0, - y: 0.0, - z: 0.0, - ), - y_axis: ( - x: 0.0, - y: 1.0, - z: 0.0, - ), - z_axis: ( - x: 0.0, - y: 0.0, - z: 1.0, - ), - ), - translation: ( - x: -12.889583, - y: 5.6987834, - z: -23.452618, - ), - )), - "bevy_core::name::Name": ( - hash: 12227652970378347066, - name: "SubParentingTest", - ), - "bevy_hierarchy::components::parent::Parent": (4294967326), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Sphero"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - }, - ), - 8589934599: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 2.0302448, - y: 2.0, - z: 0.7366843, - ), - rotation: ( - x: 0.0, - y: 0.0, - z: 0.0, - w: 1.0, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 1.0, - y: 0.0, - z: 0.0, - ), - y_axis: ( - x: 0.0, - y: 1.0, - z: 0.0, - ), - z_axis: ( - x: 0.0, - y: 0.0, - z: 1.0, - ), - ), - translation: ( - x: -21.23029, - y: 3.6987834, - z: -23.564146, - ), - )), - "bevy_core::name::Name": ( - hash: 11525084598183387914, - name: "ParentingTest", - ), - "bevy_hierarchy::components::parent::Parent": (4294967355), - "bevy_hierarchy::components::children::Children": ([ - 4294967327, - ]), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Container"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - }, - ), - 12884901893: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -5.375821, - y: 2.0, - z: -1.2236366, - ), - rotation: ( - x: 0.0, - y: 0.0, - z: 0.0, - w: 1.0, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 1.0, - y: 0.0, - z: 0.0, - ), - y_axis: ( - x: 0.0, - y: 1.0, - z: 0.0, - ), - z_axis: ( - x: 0.0, - y: 0.0, - z: 1.0, - ), - ), - translation: ( - x: -28.636356, - y: 3.6987834, - z: -25.524467, - ), - )), - "bevy_core::name::Name": ( - hash: 11525084598183387914, - name: "ParentingTest", - ), - "bevy_hierarchy::components::parent::Parent": (4294967355), - "bevy_hierarchy::components::children::Children": ([ - 4294967316, - ]), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Container"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - }, - ), - 17179869209: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -2.2050228, - y: 2.0, - z: 5.3109236, - ), - rotation: ( - x: 0.0, - y: 0.0, - z: 0.0, - w: 1.0, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 1.0, - y: 0.0, - z: 0.0, - ), - y_axis: ( - x: 0.0, - y: 1.0, - z: 0.0, - ), - z_axis: ( - x: 0.0, - y: 0.0, - z: 1.0, - ), - ), - translation: ( - x: -25.465557, - y: 3.6987834, - z: -18.989906, - ), - )), - "bevy_core::name::Name": ( - hash: 11525084598183387914, - name: "ParentingTest", - ), - "bevy_hierarchy::components::parent::Parent": (4294967355), - "bevy_hierarchy::components::children::Children": ([ - 4294967313, - ]), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Container"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - }, - ), - 17179869213: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -5.3368125, - y: 2.0, - z: -4.6879, - ), - rotation: ( - x: 0.0, - y: 0.0, - z: 0.0, - w: 1.0, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 1.0, - y: 0.0, - z: 0.0, - ), - y_axis: ( - x: 0.0, - y: 1.0, - z: 0.0, - ), - z_axis: ( - x: 0.0, - y: 0.0, - z: 1.0, - ), - ), - translation: ( - x: -28.597347, - y: 3.6987834, - z: -28.988731, - ), - )), - "bevy_core::name::Name": ( - hash: 11525084598183387914, - name: "ParentingTest", - ), - "bevy_hierarchy::components::parent::Parent": (4294967355), - "bevy_hierarchy::components::children::Children": ([ - 4294967322, - ]), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Container"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - }, - ), - 21474836496: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -5.2756443, - y: 2.0, - z: 3.7743902, - ), - rotation: ( - x: 0.0, - y: 0.0, - z: 0.0, - w: 1.0, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 1.0, - y: 0.0, - z: 0.0, - ), - y_axis: ( - x: 0.0, - y: 1.0, - z: 0.0, - ), - z_axis: ( - x: 0.0, - y: 0.0, - z: 1.0, - ), - ), - translation: ( - x: -33.81182, - y: 5.6987834, - z: -16.752048, - ), - )), - "bevy_core::name::Name": ( - hash: 12227652970378347066, - name: "SubParentingTest", - ), - "bevy_hierarchy::components::parent::Parent": (4294967330), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Sphero"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - }, - ), - 4294967306: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -7.288043, - y: 0.4981097, - z: 2.2298644, - ), - rotation: ( - x: 0.6357745, - y: 0.5369656, - z: 0.30949104, - w: -0.46008036, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 0.23176646, - y: 0.39799657, - z: 0.8876277, - ), - y_axis: ( - x: 0.9675596, - y: 0.000012218952, - z: -0.2526426, - ), - z_axis: ( - x: -0.10056165, - y: 0.9173868, - z: -0.38508248, - ), - ), - translation: ( - x: -7.288043, - y: 0.4981097, - z: 2.2298644, - ), - )), - "bevy_core::name::Name": ( - hash: 8887819794052303637, - name: "test11239097852357851377", - ), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_gltf_save_load_basic_example::game::picking::Pickable": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: 0.0, - y: 0.0, - z: 0.0, - ), - angvel: ( - x: 0.0, - y: 0.0, - z: 0.0, - ), - ), - }, - ), - 4294967307: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -6.933158, - y: 0.49766284, - z: 3.7499082, - ), - rotation: ( - x: -0.4469943, - y: 0.6741115, - z: 0.5477982, - w: 0.21374497, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: -0.5090184, - y: -0.36846972, - z: -0.77790123, - ), - y_axis: ( - x: -0.8368262, - y: 0.00022637844, - z: 0.54746854, - ), - z_axis: ( - x: -0.20154947, - y: 0.9296397, - z: -0.30846035, - ), - ), - translation: ( - x: -6.933158, - y: 0.49766284, - z: 3.7499082, - ), - )), - "bevy_core::name::Name": ( - hash: 12992148551202274181, - name: "test312134675716618292", - ), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_gltf_save_load_basic_example::game::picking::Pickable": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: -0.22741863, - y: -0.005733113, - z: -0.34727955, - ), - angvel: ( - x: -0.6965903, - y: 0.00006836644, - z: 0.455849, - ), - ), - }, - ), - 4294967355: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -23.260534, - y: 1.6987833, - z: -24.30083, - ), - rotation: ( - x: 0.0, - y: 0.0, - z: 0.0, - w: 1.0, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 1.0, - y: 0.0, - z: 0.0, - ), - y_axis: ( - x: 0.0, - y: 1.0, - z: 0.0, - ), - z_axis: ( - x: 0.0, - y: 0.0, - z: 1.0, - ), - ), - translation: ( - x: -23.260534, - y: 1.6987833, - z: -24.30083, - ), - )), - "bevy_core::name::Name": ( - hash: 3742511300108809551, - name: "Player", - ), - "bevy_hierarchy::components::children::Children": ([ - 4294967319, - 8589934599, - 4294967309, - 4294967329, - 12884901893, - 4294967330, - 4294967326, - 17179869209, - 4294967315, - 17179869213, - ]), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Player"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - }, - ), - 4294967356: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -1.3321748, - y: 0.49812344, - z: 5.8811045, - ), - rotation: ( - x: 0.69376576, - y: 0.61800337, - z: -0.13670437, - w: 0.34361714, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 0.19876748, - y: 0.76355124, - z: -0.6143947, - ), - y_axis: ( - x: 0.9514471, - y: 0.0000019669533, - z: 0.3078121, - ), - z_axis: ( - x: 0.23503149, - y: -0.6457471, - z: -0.7264782, - ), - ), - translation: ( - x: -1.3321748, - y: 0.49812344, - z: 5.8811045, - ), - )), - "bevy_core::name::Name": ( - hash: 11771294558428819596, - name: "test18243995066128479105", - ), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_gltf_save_load_basic_example::game::picking::Pickable": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: -0.18925886, - y: -0.00008480358, - z: 0.58490133, - ), - angvel: ( - x: 1.1719902, - y: 0.0000011311529, - z: 0.37922552, - ), - ), - }, - ), - 4294967357: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 6.535548, - y: 0.49754578, - z: 8.382693, - ), - rotation: ( - x: -0.17711681, - y: 0.07649447, - z: -0.68457824, - w: 0.7029444, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 0.051002443, - y: -0.9895378, - z: 0.13495791, - ), - y_axis: ( - x: 0.9353439, - y: -0.00003540516, - z: -0.35373944, - ), - z_axis: ( - x: 0.35004336, - y: 0.14427364, - z: 0.9255565, - ), - ), - translation: ( - x: 6.535548, - y: 0.49754578, - z: 8.382693, - ), - )), - "bevy_core::name::Name": ( - hash: 14649876376422140665, - name: "Health_Pickup", - ), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_gltf_save_load_basic_example::game::picking::Pickable": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - }, - ), - 4294967358: ( + 17: ( components: { "bevy_render::camera::camera::Camera": ( viewport: None, @@ -1478,15 +704,15 @@ "bevy_render::primitives::Frustum": (), "bevy_transform::components::transform::Transform": ( translation: ( - x: 2.7393978, - y: 49.69877, - z: -50.30073, + x: 11.739496, + y: 49.6988, + z: -40.500816, ), rotation: ( - x: -0.16939682, - y: 0.8284353, - z: 0.40895978, - w: 0.34314942, + x: -0.16939642, + y: 0.82843584, + z: 0.40895927, + w: 0.34314921, ), scale: ( x: 1.0, @@ -1497,25 +723,25 @@ "bevy_transform::components::global_transform::GlobalTransform": (( matrix3: ( x_axis: ( - x: -0.70710635, + x: -0.7071073, y: 0.0, - z: -0.7071071, + z: -0.7071067, ), y_axis: ( - x: -0.56133723, - y: 0.6081132, + x: -0.5613362, + y: 0.60811436, z: 0.5613366, ), z_axis: ( - x: 0.4300012, - y: 0.79385024, - z: -0.43000066, + x: 0.43000174, + y: 0.7938495, + z: -0.4300022, ), ), translation: ( - x: 2.7393978, - y: 49.69877, - z: -50.30073, + x: 11.739496, + y: 49.6988, + z: -40.500816, ), )), "bevy_core_pipeline::core_3d::camera_3d::Camera3d": ( @@ -1527,11 +753,11 @@ ), "bevy_core_pipeline::tonemapping::Tonemapping": BlenderFilmic, "bevy_core::name::Name": ( - hash: 15844466280752129540, + hash: 5289746507513922996, name: "Camera", ), "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_save_load_basic_example::core::camera::camera_tracking::CameraTrackingOffset": (( + "bevy_gltf_worlflow_examples_common::core::camera::camera_tracking::CameraTrackingOffset": (( x: 26.0, y: 48.0, z: -26.0, @@ -1539,816 +765,12 @@ "bevy_render::view::visibility::InheritedVisibility": (true), }, ), - 4294967361: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -25.493845, - y: 0.49812365, - z: -12.402787, - ), - rotation: ( - x: 0.36418545, - y: -0.7049958, - z: -0.6061089, - w: -0.05460626, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: -0.7287742, - y: -0.44730374, - z: -0.5184665, - ), - y_axis: ( - x: -0.5796931, - y: 0.0000019073486, - z: 0.8148349, - ), - z_axis: ( - x: -0.36447772, - y: 0.89438206, - z: -0.25930023, - ), - ), - translation: ( - x: -25.493845, - y: 0.49812365, - z: -12.402787, - ), - )), - "bevy_core::name::Name": ( - hash: 5247816456120987171, - name: "test2582167838114257347", - ), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_gltf_save_load_basic_example::game::picking::Pickable": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: -1.751566, - y: -0.00006749275, - z: -1.2461432, - ), - angvel: ( - x: -2.4969466, - y: 0.000004362554, - z: 3.5096824, - ), - ), - }, - ), - 4294967492: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -4.9920077, - y: 0.81558603, - z: 4.474934, - ), - rotation: ( - x: -0.063114665, - y: -0.26704848, - z: 0.59302473, - w: 0.756983, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 0.15401351, - y: 0.9315286, - z: 0.32944518, - ), - y_axis: ( - x: -0.86410993, - y: 0.28867638, - z: -0.41228616, - ), - z_axis: ( - x: -0.4791594, - y: -0.22117925, - z: 0.8494033, - ), - ), - translation: ( - x: -4.9920077, - y: 0.81558603, - z: 4.474934, - ), - )), - "bevy_core::name::Name": ( - hash: 5889033640271354729, - name: "test7607124372052964197", - ), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_gltf_save_load_basic_example::game::picking::Pickable": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: -0.58648634, - y: -0.31429863, - z: 0.66094667, - ), - angvel: ( - x: 1.5286787, - y: -0.62694865, - z: 1.0580964, - ), - ), - }, - ), - 4294967496: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 3.2762408, - y: 0.4981076, - z: 2.1016297, - ), - rotation: ( - x: -0.654017, - y: -0.00000071709474, - z: -0.26901913, - w: 0.70702934, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 0.8552574, - y: -0.3804079, - z: 0.35188717, - ), - y_axis: ( - x: 0.38040975, - y: -0.00021898746, - z: -0.92481804, - ), - z_axis: ( - x: 0.35188514, - y: 0.92481875, - z: 0.14452362, - ), - ), - translation: ( - x: 3.2762408, - y: 0.4981076, - z: 2.1016297, - ), - )), - "bevy_core::name::Name": ( - hash: 15406684986167072, - name: "test5726861144769665045", - ), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_gltf_save_load_basic_example::game::picking::Pickable": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: 0.108614616, - y: 0.0010768953, - z: -0.26639044, - ), - angvel: ( - x: 0.0011672559, - y: -0.0024434621, - z: -0.003079506, - ), - ), - }, - ), - 4294967500: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 1.0343102, - y: 0.55711305, - z: 3.023412, - ), - rotation: ( - x: 0.475089, - y: 0.000006328337, - z: 0.49772972, - w: 0.7256414, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 0.50453025, - y: 0.7223526, - z: 0.47292265, - ), - y_axis: ( - x: -0.7223406, - y: 0.053111076, - z: 0.68949485, - ), - z_axis: ( - x: 0.472941, - y: -0.6894822, - z: 0.5485809, - ), - ), - translation: ( - x: 1.0343102, - y: 0.55711305, - z: 3.023412, - ), - )), - "bevy_core::name::Name": ( - hash: 14907442938390545608, - name: "test15491425733849030141", - ), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_gltf_save_load_basic_example::game::picking::Pickable": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: -1.4335963, - y: -3.1702905, - z: 1.3684047, - ), - angvel: ( - x: 2.0015316, - y: 0.000009884588, - z: 2.096909, - ), - ), - }, - ), - 4294967504: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 6.341096, - y: 0.9969703, - z: 7.157166, - ), - rotation: ( - x: 0.40568426, - y: -0.35131618, - z: -0.32982755, - w: 0.7766666, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 0.53558147, - y: -0.797379, - z: 0.27809942, - ), - y_axis: ( - x: 0.22728518, - y: 0.45326817, - z: 0.86191034, - ), - z_axis: ( - x: -0.8133228, - y: -0.39841533, - z: 0.42399442, - ), - ), - translation: ( - x: 6.341096, - y: 0.9969703, - z: 7.157166, - ), - )), - "bevy_core::name::Name": ( - hash: 5766952398097986970, - name: "test1319791526494826970", - ), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_gltf_save_load_basic_example::game::picking::Pickable": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: 0.23741817, - y: 0.0433962, - z: 0.27994156, - ), - angvel: ( - x: -0.105580404, - y: -0.11032705, - z: -0.22751106, - ), - ), - }, - ), - 4294967508: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 1.7111174, - y: 1.5965495, - z: -0.28478992, - ), - rotation: ( - x: 0.023569103, - y: -0.000000040367013, - z: 0.015840217, - w: 0.9995967, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 0.9994982, - y: 0.031667653, - z: 0.0007467601, - ), - y_axis: ( - x: -0.03166766, - y: 0.99838716, - z: 0.047119197, - ), - z_axis: ( - x: 0.00074659876, - y: -0.047119197, - z: 0.99888897, - ), - ), - translation: ( - x: 1.7111174, - y: 1.5965495, - z: -0.28478992, - ), - )), - "bevy_core::name::Name": ( - hash: 5571590536334849636, - name: "test1674739915643664398", - ), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_gltf_save_load_basic_example::game::picking::Pickable": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: -0.09296543, - y: -0.0063177478, - z: 0.13832632, - ), - angvel: ( - x: 0.08658932, - y: -0.00000014938985, - z: 0.05819437, - ), - ), - }, - ), - 4294967512: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -1.5826693, - y: 1.5393476, - z: -4.3061185, - ), - rotation: ( - x: 0.058324553, - y: 0.00000007249764, - z: -0.15305068, - w: 0.9864957, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 0.953151, - y: -0.30196765, - z: -0.017853368, - ), - y_axis: ( - x: 0.30196765, - y: 0.9463475, - z: 0.115073815, - ), - z_axis: ( - x: -0.017853081, - y: -0.11507386, - z: 0.9931965, - ), - ), - translation: ( - x: -1.5826693, - y: 1.5393476, - z: -4.3061185, - ), - )), - "bevy_core::name::Name": ( - hash: 9232722840751228859, - name: "test16789708871576306607", - ), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_gltf_save_load_basic_example::game::picking::Pickable": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: 0.92234856, - y: -0.22055921, - z: 0.35148948, - ), - angvel: ( - x: 0.2276644, - y: 0.0000009784032, - z: -0.5974168, - ), - ), - }, - ), - 4294967516: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -4.525213, - y: 0.7750231, - z: -0.17502502, - ), - rotation: ( - x: 0.4466202, - y: 0.17568037, - z: -0.6523265, - w: 0.58663183, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 0.08721304, - y: -0.6084262, - z: -0.7888038, - ), - y_axis: ( - x: 0.9222758, - y: -0.24999905, - z: 0.29480135, - ), - z_axis: ( - x: -0.376565, - y: -0.7532052, - z: 0.5393336, - ), - ), - translation: ( - x: -4.525213, - y: 0.7750231, - z: -0.17502502, - ), - )), - "bevy_core::name::Name": ( - hash: 333871819790518369, - name: "test15444470665606374897", - ), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_gltf_save_load_basic_example::game::picking::Pickable": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: -2.7437484, - y: -3.3437164, - z: -2.3115048, - ), - angvel: ( - x: -3.0006366, - y: 0.9244151, - z: 2.3713787, - ), - ), - }, - ), - 4294967520: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 1.8888425, - y: 1.5689882, - z: -1.5552188, - ), - rotation: ( - x: 0.113464825, - y: -0.00000020895095, - z: 0.021926481, - w: 0.9933, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 0.99903846, - y: 0.0435591, - z: 0.0049761836, - ), - y_axis: ( - x: -0.043559197, - y: 0.9732899, - z: 0.22540921, - ), - z_axis: ( - x: 0.004975354, - y: -0.22540924, - z: 0.97425145, - ), - ), - translation: ( - x: 1.8888425, - y: 1.5689882, - z: -1.5552188, - ), - )), - "bevy_core::name::Name": ( - hash: 3509298148931429876, - name: "test2496051646124357008", - ), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_gltf_save_load_basic_example::game::picking::Pickable": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: -0.16054136, - y: -0.13092233, - z: 0.83077115, - ), - angvel: ( - x: 0.5284708, - y: -0.0000013110855, - z: 0.10212349, - ), - ), - }, - ), - 4294967524: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: -2.1701968, - y: 0.7805994, - z: 3.9727407, - ), - rotation: ( - x: 0.5706888, - y: 0.35842514, - z: -0.2145796, - w: 0.7069662, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 0.65097404, - y: 0.10569736, - z: -0.7517052, - ), - y_axis: ( - x: 0.7124995, - y: 0.25653982, - z: 0.65309393, - ), - z_axis: ( - x: 0.2618726, - y: -0.9607369, - z: 0.091691494, - ), - ), - translation: ( - x: -2.1701968, - y: 0.7805994, - z: 3.9727407, - ), - )), - "bevy_core::name::Name": ( - hash: 14209915335791442119, - name: "test15495879109551239256", - ), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_gltf_save_load_basic_example::game::picking::Pickable": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: 0.82487506, - y: -2.3229113, - z: 1.2957921, - ), - angvel: ( - x: 2.534364, - y: 0.839257, - z: -0.6552327, - ), - ), - }, - ), - 4294967528: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 5.063053, - y: 1.5967827, - z: -0.17321607, - ), - rotation: ( - x: 0.01903159, - y: 0.00000003883906, - z: 0.018831024, - w: 0.9996415, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: 0.99929076, - y: 0.037648544, - z: 0.000716691, - ), - y_axis: ( - x: -0.037648544, - y: 0.9985664, - z: 0.038049534, - ), - z_axis: ( - x: 0.0007168463, - y: -0.038049534, - z: 0.9992756, - ), - ), - translation: ( - x: 5.063053, - y: 1.5967827, - z: -0.17321607, - ), - )), - "bevy_core::name::Name": ( - hash: 16108438029532537403, - name: "test13576182779630349751", - ), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_gltf_save_load_basic_example::game::picking::Pickable": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: -0.45847216, - y: -0.020973437, - z: 0.46335497, - ), - angvel: ( - x: 0.28996477, - y: 0.00000058175317, - z: 0.28690916, - ), - ), - }, - ), - 8589934658: ( - components: { - "bevy_transform::components::transform::Transform": ( - translation: ( - x: 6.1006203, - y: 0.49812356, - z: 3.580489, - ), - rotation: ( - x: 0.0768257, - y: -0.49943498, - z: -0.70292014, - w: 0.50056535, - ), - scale: ( - x: 1.0, - y: 1.0, - z: 1.0, - ), - ), - "bevy_transform::components::global_transform::GlobalTransform": (( - matrix3: ( - x_axis: ( - x: -0.487064, - y: -0.7804538, - z: 0.39199504, - ), - y_axis: ( - x: 0.626976, - y: 0.0000021457672, - z: 0.77903837, - ), - z_axis: ( - x: -0.6080044, - y: 0.6252132, - z: 0.48932505, - ), - ), - translation: ( - x: 6.1006203, - y: 0.49812356, - z: 3.580489, - ), - )), - "bevy_core::name::Name": ( - hash: 5610645830027884689, - name: "test18152638408579826398", - ), - "bevy_gltf_save_load::saveable::Dynamic": (true), - "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), - "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_gltf_save_load_basic_example::game::picking::Pickable": (), - "bevy_render::view::visibility::InheritedVisibility": (true), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: 0.6629742, - y: -0.00007954295, - z: -0.5336061, - ), - angvel: ( - x: -1.0692078, - y: -0.0000014726246, - z: -1.3284277, - ), - ), - }, - ), - 17179869242: ( + 18: ( components: { "bevy_transform::components::transform::Transform": ( translation: ( x: -1.2373765, - y: 1.5983436, + y: 1.5983288, z: -14.737572, ), rotation: ( @@ -2383,34 +805,34 @@ ), translation: ( x: -1.2373765, - y: 1.5983436, + y: 1.5983288, z: -14.737572, ), )), "bevy_core::name::Name": ( - hash: 15782802592076175270, + hash: 18119748942184862963, name: "Health_Pickup.001", ), "bevy_gltf_save_load::saveable::Dynamic": (true), "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), + "bevy_gltf_worlflow_examples_common::game::picking::Pickable": (), "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_gltf_save_load_basic_example::game::picking::Pickable": (), "bevy_render::view::visibility::InheritedVisibility": (true), }, ), - 25769803903: ( + 19: ( components: { "bevy_transform::components::transform::Transform": ( translation: ( - x: -7.389497, - y: 0.49812272, - z: -2.7608006, + x: 4.6975822, + y: 1.5983198, + z: 8.962216, ), rotation: ( - x: -0.061189484, - y: -0.00019909017, - z: 0.7044531, - w: 0.7071079, + x: -0.000019148343, + y: -0.000000000013409105, + z: -0.000020683929, + w: 1.0, ), scale: ( x: 1.0, @@ -2421,63 +843,51 @@ "bevy_transform::components::global_transform::GlobalTransform": (( matrix3: ( x_axis: ( - x: 0.0074915886, - y: 0.9962731, - z: -0.085928686, + x: 1.0, + y: -0.000041367857, + z: 0.00000000081894413, ), y_axis: ( - x: -0.99622434, - y: 0.00000333786, - z: -0.08681563, + x: 0.000041367857, + y: 1.0, + z: -0.000038296686, ), z_axis: ( - x: -0.0864918, - y: 0.086254634, - z: 0.99251163, + x: 0.0000000007653077, + y: 0.000038296686, + z: 1.0, ), ), translation: ( - x: -7.389497, - y: 0.49812272, - z: -2.7608006, + x: 4.6975822, + y: 1.5983198, + z: 8.962216, ), )), "bevy_core::name::Name": ( - hash: 14711562368185091299, - name: "test3121563718590801717", + hash: 9357833520057554797, + name: "Health_Pickup", ), "bevy_gltf_save_load::saveable::Dynamic": (true), "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), + "bevy_gltf_worlflow_examples_common::game::picking::Pickable": (), "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_gltf_save_load_basic_example::game::picking::Pickable": (), "bevy_render::view::visibility::InheritedVisibility": (true), - "bevy_rapier3d::dynamics::rigid_body::Velocity": ( - linvel: ( - x: -0.000011626149, - y: -0.00008378431, - z: 0.00048400648, - ), - angvel: ( - x: 0.00096944225, - y: -0.00000017537552, - z: 0.000023260392, - ), - ), }, ), - 42949673007: ( + 20: ( components: { "bevy_transform::components::transform::Transform": ( translation: ( - x: 1.2928966, - y: 0.49812183, - z: 5.187275, + x: -14.260508, + y: 1.6987833, + z: -14.500801, ), rotation: ( - x: -0.6987065, - y: -0.0073659495, - z: -0.10865899, - w: -0.7070701, + x: 0.0, + y: 0.0, + z: 0.0, + w: 1.0, ), scale: ( x: 1.0, @@ -2488,46 +898,242 @@ "bevy_transform::components::global_transform::GlobalTransform": (( matrix3: ( x_axis: ( - x: 0.97627795, - y: 0.16395232, - z: 0.14142501, + x: 1.0, + y: 0.0, + z: 0.0, ), y_axis: ( - x: -0.14336577, - y: 0.000004887581, - z: 0.98966974, + x: 0.0, + y: 1.0, + z: 0.0, ), z_axis: ( - x: 0.16225797, - y: -0.98646826, - z: 0.02350992, + x: 0.0, + y: 0.0, + z: 1.0, ), ), translation: ( - x: 1.2928966, - y: 0.49812183, - z: 5.187275, + x: -14.260508, + y: 1.6987833, + z: -14.500801, ), )), "bevy_core::name::Name": ( - hash: 5172269147847631123, - name: "test5254630037543835847", + hash: 819952956588726607, + name: "Player", + ), + "bevy_hierarchy::components::children::Children": ([ + 12884901959, + 4294967368, + 17179869267, + 17179869278, + 17179869289, + 17179869300, + ]), + "bevy_gltf_save_load::saveable::Dynamic": (true), + "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Player"), + "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), + "bevy_render::view::visibility::InheritedVisibility": (true), + }, + ), + 8589934616: ( + components: { + "bevy_transform::components::transform::Transform": ( + translation: ( + x: 2.4660995, + y: 0.49849892, + z: -1.3078667, + ), + rotation: ( + x: 0.47177938, + y: -0.0032089436, + z: -0.5268298, + w: 0.70701075, + ), + scale: ( + x: 1.0, + y: 1.0, + z: 1.0, + ), + ), + "bevy_transform::components::global_transform::GlobalTransform": (( + matrix3: ( + x_axis: ( + x: 0.44488013, + y: -0.7479765, + z: -0.49255732, + ), + y_axis: ( + x: 0.74192077, + y: -0.00025081635, + z: 0.6704873, + ), + z_axis: ( + x: -0.50163233, + y: -0.663725, + z: 0.5548278, + ), + ), + translation: ( + x: 2.4660995, + y: 0.49849892, + z: -1.3078667, + ), + )), + "bevy_core::name::Name": ( + hash: 16557391108168334838, + name: "test15357418344681101652", ), "bevy_gltf_save_load::saveable::Dynamic": (true), "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), + "bevy_gltf_worlflow_examples_common::game::picking::Pickable": (), "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), - "bevy_gltf_save_load_basic_example::game::picking::Pickable": (), "bevy_render::view::visibility::InheritedVisibility": (true), "bevy_rapier3d::dynamics::rigid_body::Velocity": ( linvel: ( - x: 2.49349, - y: -0.00012572497, - z: 0.3612286, + x: 0.0, + y: 0.0, + z: 0.0, ), angvel: ( - x: 0.7238101, - y: -0.00003163344, - z: -4.996319, + x: 0.0, + y: 0.0, + z: 0.0, + ), + ), + }, + ), + 8589934640: ( + components: { + "bevy_transform::components::transform::Transform": ( + translation: ( + x: -4.985139, + y: 0.49807918, + z: -3.5349207, + ), + rotation: ( + x: 0.46581778, + y: 0.017575154, + z: 0.53198445, + w: 0.7068928, + ), + scale: ( + x: 1.0, + y: 1.0, + z: 1.0, + ), + ), + "bevy_transform::components::global_transform::GlobalTransform": (( + matrix3: ( + x_axis: ( + x: 0.43336737, + y: 0.76848555, + z: 0.47076812, + ), + y_axis: ( + x: -0.7357383, + y: 0.000012695789, + z: 0.6772659, + ), + z_axis: ( + x: 0.5204631, + y: -0.63986707, + z: 0.5654098, + ), + ), + translation: ( + x: -4.985139, + y: 0.49807918, + z: -3.5349207, + ), + )), + "bevy_core::name::Name": ( + hash: 14523656990709224508, + name: "test12116529013794948401", + ), + "bevy_gltf_save_load::saveable::Dynamic": (true), + "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), + "bevy_gltf_worlflow_examples_common::game::picking::Pickable": (), + "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), + "bevy_render::view::visibility::InheritedVisibility": (true), + "bevy_rapier3d::dynamics::rigid_body::Velocity": ( + linvel: ( + x: 0.0, + y: 0.0, + z: 0.0, + ), + angvel: ( + x: 0.0, + y: 0.0, + z: 0.0, + ), + ), + }, + ), + 17179869248: ( + components: { + "bevy_transform::components::transform::Transform": ( + translation: ( + x: 2.4813743, + y: 0.49810848, + z: 4.07758, + ), + rotation: ( + x: 0.38143897, + y: -0.00907581, + z: 0.595397, + w: 0.7070533, + ), + scale: ( + x: 1.0, + y: 1.0, + z: 1.0, + ), + ), + "bevy_transform::components::global_transform::GlobalTransform": (( + matrix3: ( + x_axis: ( + x: 0.2908401, + y: 0.8350311, + z: 0.4670494, + ), + y_axis: ( + x: -0.84887856, + y: 0.00001347065, + z: 0.528588, + ), + z_axis: ( + x: 0.44138107, + y: -0.5502028, + z: 0.7088439, + ), + ), + translation: ( + x: 2.4813743, + y: 0.49810848, + z: 4.07758, + ), + )), + "bevy_core::name::Name": ( + hash: 17683666560735993383, + name: "test17764315703991047566", + ), + "bevy_gltf_save_load::saveable::Dynamic": (true), + "bevy_gltf_blueprints::spawn_from_blueprints::BlueprintName": ("Health_Pickup"), + "bevy_gltf_worlflow_examples_common::game::picking::Pickable": (), + "bevy_gltf_blueprints::spawn_from_blueprints::SpawnHere": (), + "bevy_render::view::visibility::InheritedVisibility": (true), + "bevy_rapier3d::dynamics::rigid_body::Velocity": ( + linvel: ( + x: 0.0, + y: 0.0, + z: 0.0, + ), + angvel: ( + x: 0.0, + y: 0.0, + z: 0.0, ), ), }, diff --git a/examples/bevy_gltf_save_load/basic/src/assets/assets_core.rs b/examples/bevy_gltf_save_load/basic/src/assets/assets_core.rs deleted file mode 100644 index 29b577a..0000000 --- a/examples/bevy_gltf_save_load/basic/src/assets/assets_core.rs +++ /dev/null @@ -1,5 +0,0 @@ -use bevy::prelude::*; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct CoreAssets {} diff --git a/examples/bevy_gltf_save_load/basic/src/assets/assets_game.rs b/examples/bevy_gltf_save_load/basic/src/assets/assets_game.rs deleted file mode 100644 index 05f2af6..0000000 --- a/examples/bevy_gltf_save_load/basic/src/assets/assets_game.rs +++ /dev/null @@ -1,16 +0,0 @@ -use bevy::gltf::Gltf; -use bevy::prelude::*; -use bevy::utils::HashMap; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct GameAssets { - #[asset(key = "world")] - pub world: Handle, - - #[asset(key = "world_dynamic")] - pub world_dynamic: Handle, - - #[asset(key = "models", collection(typed, mapped))] - pub models: HashMap>, -} diff --git a/examples/bevy_gltf_save_load/basic/src/assets/mod.rs b/examples/bevy_gltf_save_load/basic/src/assets/mod.rs deleted file mode 100644 index a2c8b22..0000000 --- a/examples/bevy_gltf_save_load/basic/src/assets/mod.rs +++ /dev/null @@ -1,35 +0,0 @@ -pub mod assets_core; -pub use assets_core::*; - -pub mod assets_game; -pub use assets_game::*; - -use bevy::prelude::*; -use bevy_asset_loader::prelude::*; - -use crate::state::AppState; - -pub struct AssetsPlugin; -impl Plugin for AssetsPlugin { - fn build(&self, app: &mut App) { - 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), - ) - .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); - } -} diff --git a/examples/bevy_gltf_save_load/basic/src/core/camera/camera_replace_proxies.rs b/examples/bevy_gltf_save_load/basic/src/core/camera/camera_replace_proxies.rs deleted file mode 100644 index 9055c95..0000000 --- a/examples/bevy_gltf_save_load/basic/src/core/camera/camera_replace_proxies.rs +++ /dev/null @@ -1,24 +0,0 @@ -use bevy::core_pipeline::bloom::{BloomCompositeMode, BloomSettings}; -use bevy::core_pipeline::tonemapping::{DebandDither, Tonemapping}; -use bevy::prelude::*; - -use super::CameraTrackingOffset; - -pub fn camera_replace_proxies( - mut commands: Commands, - mut added_cameras: Query<(Entity, &mut Camera), (Added, With)>, -) { - for (entity, mut camera) in added_cameras.iter_mut() { - info!("detected added camera, updating proxy"); - camera.hdr = true; - commands - .entity(entity) - .insert(DebandDither::Enabled) - .insert(Tonemapping::BlenderFilmic) - .insert(BloomSettings { - intensity: 0.01, - composite_mode: BloomCompositeMode::Additive, - ..default() - }); - } -} diff --git a/examples/bevy_gltf_save_load/basic/src/core/camera/camera_tracking.rs b/examples/bevy_gltf_save_load/basic/src/core/camera/camera_tracking.rs deleted file mode 100644 index 62da84d..0000000 --- a/examples/bevy_gltf_save_load/basic/src/core/camera/camera_tracking.rs +++ /dev/null @@ -1,58 +0,0 @@ -use bevy::prelude::*; - -#[derive(Component, Reflect, Debug)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -/// -pub struct CameraTracking { - pub offset: Vec3, -} -impl Default for CameraTracking { - fn default() -> Self { - CameraTracking { - offset: Vec3::new(0.0, 6.0, 8.0), - } - } -} - -#[derive(Component, Reflect, Debug, Deref, DerefMut)] -#[reflect(Component)] -/// Component for cameras, with an offset from the Trackable target -pub struct CameraTrackingOffset(Vec3); -impl Default for CameraTrackingOffset { - fn default() -> Self { - CameraTrackingOffset(Vec3::new(0.0, 6.0, 8.0)) - } -} - -impl CameraTrackingOffset { - fn new(input: Vec3) -> Self { - CameraTrackingOffset(input) - } -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Add this component to an entity if you want it to be tracked by a Camera -pub struct CameraTrackable; - -pub fn camera_track( - mut tracking_cameras: Query< - (&mut Transform, &CameraTrackingOffset), - ( - With, - With, - Without, - ), - >, - camera_tracked: Query<&Transform, With>, -) { - for (mut camera_transform, tracking_offset) in tracking_cameras.iter_mut() { - for tracked_transform in camera_tracked.iter() { - let target_position = tracked_transform.translation + tracking_offset.0; - let eased_position = camera_transform.translation.lerp(target_position, 0.1); - camera_transform.translation = eased_position; // + tracking.offset;// tracked_transform.translation + tracking.offset; - *camera_transform = camera_transform.looking_at(tracked_transform.translation, Vec3::Y); - } - } -} diff --git a/examples/bevy_gltf_save_load/basic/src/core/camera/mod.rs b/examples/bevy_gltf_save_load/basic/src/core/camera/mod.rs deleted file mode 100644 index a6bbb65..0000000 --- a/examples/bevy_gltf_save_load/basic/src/core/camera/mod.rs +++ /dev/null @@ -1,24 +0,0 @@ -pub mod camera_tracking; -pub use camera_tracking::*; - -pub mod camera_replace_proxies; -pub use camera_replace_proxies::*; - -use bevy::prelude::*; -use bevy_gltf_blueprints::GltfBlueprintsSet; - -pub struct CameraPlugin; -impl Plugin for CameraPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .register_type::() - .register_type::() - .add_systems( - Update, - ( - camera_replace_proxies.after(GltfBlueprintsSet::AfterSpawn), - camera_track, - ), - ); - } -} diff --git a/examples/bevy_gltf_save_load/basic/src/core/lighting/lighting_replace_proxies.rs b/examples/bevy_gltf_save_load/basic/src/core/lighting/lighting_replace_proxies.rs deleted file mode 100644 index 48c0908..0000000 --- a/examples/bevy_gltf_save_load/basic/src/core/lighting/lighting_replace_proxies.rs +++ /dev/null @@ -1,25 +0,0 @@ -use bevy::prelude::*; - -use bevy::pbr::{CascadeShadowConfig, CascadeShadowConfigBuilder}; - -// fixme might be too specific to might needs, should it be moved out ? also these are all for lights, not models -pub fn lighting_replace_proxies( - mut added_dirights: Query<(Entity, &mut DirectionalLight), Added>, - mut added_spotlights: Query<&mut SpotLight, Added>, - mut commands: Commands, -) { - for (entity, mut light) in added_dirights.iter_mut() { - light.illuminance *= 5.0; - light.shadows_enabled = true; - let shadow_config: CascadeShadowConfig = CascadeShadowConfigBuilder { - first_cascade_far_bound: 15.0, - maximum_distance: 135.0, - ..default() - } - .into(); - commands.entity(entity).insert(shadow_config); - } - for mut light in added_spotlights.iter_mut() { - light.shadows_enabled = true; - } -} diff --git a/examples/bevy_gltf_save_load/basic/src/core/lighting/mod.rs b/examples/bevy_gltf_save_load/basic/src/core/lighting/mod.rs deleted file mode 100644 index c9688cd..0000000 --- a/examples/bevy_gltf_save_load/basic/src/core/lighting/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -mod lighting_replace_proxies; -use lighting_replace_proxies::*; - -use bevy::pbr::{DirectionalLightShadowMap, NotShadowCaster}; -use bevy::prelude::*; - -pub struct LightingPlugin; -impl Plugin for LightingPlugin { - fn build(&self, app: &mut App) { - app - .insert_resource(DirectionalLightShadowMap { size: 4096 }) - // FIXME: adding these since they are missing - .register_type::() - - .add_systems(PreUpdate, lighting_replace_proxies) // FIXME: you should actually run this in a specific state most likely - ; - } -} diff --git a/examples/bevy_gltf_save_load/basic/src/core/mod.rs b/examples/bevy_gltf_save_load/basic/src/core/mod.rs index 2a42178..6d856d8 100644 --- a/examples/bevy_gltf_save_load/basic/src/core/mod.rs +++ b/examples/bevy_gltf_save_load/basic/src/core/mod.rs @@ -1,36 +1,19 @@ -pub mod camera; -pub use camera::*; - -pub mod lighting; -pub use lighting::*; - -pub mod relationships; -pub use relationships::*; - -pub mod physics; -pub use physics::*; - use bevy::{ core_pipeline::tonemapping::Tonemapping, prelude::*, render::{camera::CameraRenderGraph, primitives::Frustum, view::VisibleEntities}, utils::HashSet, }; -use bevy_rapier3d::dynamics::Velocity; -use std::any::TypeId; - use bevy_gltf_blueprints::*; use bevy_gltf_save_load::*; - -use crate::game::Pickable; +use bevy_gltf_worlflow_examples_common::{CameraTrackingOffset, Pickable}; +use bevy_rapier3d::dynamics::Velocity; +use std::any::TypeId; pub struct CorePlugin; impl Plugin for CorePlugin { fn build(&self, app: &mut App) { app.add_plugins(( - LightingPlugin, - CameraPlugin, - PhysicsPlugin, SaveLoadPlugin { save_path: "scenes".into(), component_filter: SceneFilter::Allowlist(HashSet::from([ diff --git a/examples/bevy_gltf_save_load/basic/src/core/physics/mod.rs b/examples/bevy_gltf_save_load/basic/src/core/physics/mod.rs deleted file mode 100644 index ac1b001..0000000 --- a/examples/bevy_gltf_save_load/basic/src/core/physics/mod.rs +++ /dev/null @@ -1,38 +0,0 @@ -pub mod physics_replace_proxies; -use bevy_rapier3d::{ - prelude::{NoUserData, RapierPhysicsPlugin}, - render::RapierDebugRenderPlugin, -}; -pub use physics_replace_proxies::*; - -pub mod utils; - -pub mod controls; -pub use controls::*; - -use crate::state::GameState; -use bevy::prelude::*; -// use super::blueprints::GltfBlueprintsSet; -use bevy_gltf_blueprints::GltfBlueprintsSet; -// use crate::Collider; -pub struct PhysicsPlugin; -impl Plugin for PhysicsPlugin { - fn build(&self, app: &mut App) { - app.add_plugins(( - RapierPhysicsPlugin::::default(), - RapierDebugRenderPlugin::default(), - )) - .register_type::() - .register_type::() - // find a way to make serde's stuff serializable - // .register_type::() - //bevy_rapier3d::dynamics::CoefficientCombineRule - .add_systems( - Update, - physics_replace_proxies.after(GltfBlueprintsSet::AfterSpawn), - ) - .add_systems(OnEnter(GameState::InGame), resume_physics) - .add_systems(OnExit(GameState::InGame), pause_physics) - .add_systems(Update, toggle_physics_debug); - } -} diff --git a/examples/bevy_gltf_save_load/basic/src/core/physics/physics_replace_proxies.rs b/examples/bevy_gltf_save_load/basic/src/core/physics/physics_replace_proxies.rs deleted file mode 100644 index b91462c..0000000 --- a/examples/bevy_gltf_save_load/basic/src/core/physics/physics_replace_proxies.rs +++ /dev/null @@ -1,101 +0,0 @@ -use bevy::prelude::*; -// use bevy::render::primitives::Aabb; -use bevy_rapier3d::geometry::Collider as RapierCollider; -use bevy_rapier3d::prelude::{ActiveCollisionTypes, ActiveEvents, ComputedColliderShape}; - -use super::utils::*; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum Collider { - Ball(f32), - Cuboid(Vec3), - Capsule(Vec3, Vec3, f32), - #[default] - Mesh, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum AutoAABBCollider { - #[default] - Cuboid, - Ball, - Capsule, -} - -// replaces all physics stand-ins with the actual rapier types -pub fn physics_replace_proxies( - meshes: Res>, - mesh_handles: Query<&Handle>, - mut proxy_colliders: Query< - (Entity, &Collider, &Name, &mut Visibility), - (Without, Added), - >, - // needed for tri meshes - children: Query<&Children>, - - mut commands: Commands, -) { - for proxy_colider in proxy_colliders.iter_mut() { - let (entity, collider_proxy, name, mut visibility) = proxy_colider; - // we hide the collider meshes: perhaps they should be removed altogether once processed ? - if name.ends_with("_collider") || name.ends_with("_sensor") { - *visibility = Visibility::Hidden; - } - - let mut rapier_collider: RapierCollider; - match collider_proxy { - Collider::Ball(radius) => { - info!("generating collider from proxy: ball"); - rapier_collider = RapierCollider::ball(*radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Cuboid(size) => { - info!("generating collider from proxy: cuboid"); - rapier_collider = RapierCollider::cuboid(size.x, size.y, size.z); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Capsule(a, b, radius) => { - info!("generating collider from proxy: capsule"); - rapier_collider = RapierCollider::capsule(*a, *b, *radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Mesh => { - info!("generating collider from proxy: mesh"); - for (_, collider_mesh) in - Mesh::search_in_children(entity, &children, &meshes, &mesh_handles) - { - rapier_collider = RapierCollider::from_bevy_mesh( - collider_mesh, - &ComputedColliderShape::TriMesh, - ) - .unwrap(); - commands - .entity(entity) - .insert(rapier_collider) - // FIXME: this is just for demo purposes !!! - .insert( - ActiveCollisionTypes::default() - | ActiveCollisionTypes::KINEMATIC_STATIC - | ActiveCollisionTypes::STATIC_STATIC - | ActiveCollisionTypes::DYNAMIC_STATIC, - ) - .insert(ActiveEvents::COLLISION_EVENTS); - // .insert(ActiveEvents::COLLISION_EVENTS) - // break; - // RapierCollider::convex_hull(points) - } - } - } - } -} diff --git a/examples/bevy_gltf_save_load/basic/src/core/physics/utils.rs b/examples/bevy_gltf_save_load/basic/src/core/physics/utils.rs deleted file mode 100644 index 7886710..0000000 --- a/examples/bevy_gltf_save_load/basic/src/core/physics/utils.rs +++ /dev/null @@ -1,175 +0,0 @@ -use bevy::prelude::*; -use bevy::render::mesh::{MeshVertexAttributeId, PrimitiveTopology, VertexAttributeValues}; -// TAKEN VERBATIB FROM https://github.com/janhohenheim/foxtrot/blob/src/util/trait_extension.rs - -pub(crate) trait Vec3Ext: Copy { - fn is_approx_zero(self) -> bool; - fn split(self, up: Vec3) -> SplitVec3; -} -impl Vec3Ext for Vec3 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn split(self, up: Vec3) -> SplitVec3 { - let vertical = up * self.dot(up); - let horizontal = self - vertical; - SplitVec3 { - vertical, - horizontal, - } - } -} - -#[derive(Debug, Clone, Copy, PartialEq)] -pub(crate) struct SplitVec3 { - pub(crate) vertical: Vec3, - pub(crate) horizontal: Vec3, -} - -pub(crate) trait Vec2Ext: Copy { - fn is_approx_zero(self) -> bool; - fn x0y(self) -> Vec3; -} -impl Vec2Ext for Vec2 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn x0y(self) -> Vec3 { - Vec3::new(self.x, 0., self.y) - } -} - -pub(crate) trait MeshExt { - fn transform(&mut self, transform: Transform); - fn transformed(&self, transform: Transform) -> Mesh; - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]>; - fn search_in_children<'a>( - parent: Entity, - children: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)>; -} - -impl MeshExt for Mesh { - fn transform(&mut self, transform: Transform) { - for coords in self.read_coords_mut(Mesh::ATTRIBUTE_POSITION.clone()) { - let vec3 = (*coords).into(); - let transformed = transform.transform_point(vec3); - *coords = transformed.into(); - } - for normal in self.read_coords_mut(Mesh::ATTRIBUTE_NORMAL.clone()) { - let vec3 = (*normal).into(); - let transformed = transform.rotation.mul_vec3(vec3); - *normal = transformed.into(); - } - } - - fn transformed(&self, transform: Transform) -> Mesh { - let mut mesh = self.clone(); - mesh.transform(transform); - mesh - } - - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]> { - // Guaranteed by Bevy for the current usage - match self - .attribute_mut(id) - .expect("Failed to read unknown mesh attribute") - { - VertexAttributeValues::Float32x3(values) => values, - // Guaranteed by Bevy for the current usage - _ => unreachable!(), - } - } - - fn search_in_children<'a>( - parent: Entity, - children_query: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)> { - if let Ok(children) = children_query.get(parent) { - let mut result: Vec<_> = children - .iter() - .filter_map(|entity| mesh_handles.get(*entity).ok().map(|mesh| (*entity, mesh))) - .map(|(entity, mesh_handle)| { - ( - entity, - meshes - .get(mesh_handle) - .expect("Failed to get mesh from handle"), - ) - }) - .map(|(entity, mesh)| { - assert_eq!(mesh.primitive_topology(), PrimitiveTopology::TriangleList); - (entity, mesh) - }) - .collect(); - let mut inner_result = children - .iter() - .flat_map(|entity| { - Self::search_in_children(*entity, children_query, meshes, mesh_handles) - }) - .collect(); - result.append(&mut inner_result); - result - } else { - Vec::new() - } - } -} - -pub(crate) trait F32Ext: Copy { - fn is_approx_zero(self) -> bool; - fn squared(self) -> f32; - fn lerp(self, other: f32, ratio: f32) -> f32; -} - -impl F32Ext for f32 { - #[inline] - fn is_approx_zero(self) -> bool { - self.abs() < 1e-5 - } - - #[inline] - fn squared(self) -> f32 { - self * self - } - - #[inline] - fn lerp(self, other: f32, ratio: f32) -> f32 { - self.mul_add(1. - ratio, other * ratio) - } -} - -pub(crate) trait TransformExt: Copy { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform; - fn lerp(self, other: Transform, ratio: f32) -> Transform; -} - -impl TransformExt for Transform { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform { - let direction = target - self.translation; - let horizontal_direction = direction - up * direction.dot(up); - let look_target = self.translation + horizontal_direction; - self.looking_at(look_target, up) - } - - fn lerp(self, other: Transform, ratio: f32) -> Transform { - let translation = self.translation.lerp(other.translation, ratio); - let rotation = self.rotation.slerp(other.rotation, ratio); - let scale = self.scale.lerp(other.scale, ratio); - Transform { - translation, - rotation, - scale, - } - } -} diff --git a/examples/bevy_gltf_save_load/basic/src/core/physics/utils_old.rs b/examples/bevy_gltf_save_load/basic/src/core/physics/utils_old.rs deleted file mode 100644 index c210dd3..0000000 --- a/examples/bevy_gltf_save_load/basic/src/core/physics/utils_old.rs +++ /dev/null @@ -1,75 +0,0 @@ -use bevy::prelude::*; -use bevy::render::mesh::{MeshVertexAttributeId, PrimitiveTopology, VertexAttributeValues}; -// TAKEN VERBATIB FROM https://github.com/janhohenheim/foxtrot/blob/6e31fc02652fc9d085a4adde0a73ab007dbbb0dc/src/util/trait_extension.rs - -pub trait Vec3Ext { - #[allow(clippy::wrong_self_convention)] // Because [`Vec3`] is [`Copy`] - fn is_approx_zero(self) -> bool; - fn x0z(self) -> Vec3; -} -impl Vec3Ext for Vec3 { - fn is_approx_zero(self) -> bool { - [self.x, self.y, self.z].iter().all(|&x| x.abs() < 1e-5) - } - fn x0z(self) -> Vec3 { - Vec3::new(self.x, 0., self.z) - } -} - -pub trait MeshExt { - fn transform(&mut self, transform: Transform); - fn transformed(&self, transform: Transform) -> Mesh; - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]>; - fn search_in_children<'a>( - children: &'a Children, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> (Entity, &'a Mesh); -} - -impl MeshExt for Mesh { - fn transform(&mut self, transform: Transform) { - for attribute in [Mesh::ATTRIBUTE_POSITION, Mesh::ATTRIBUTE_NORMAL] { - for coords in self.read_coords_mut(attribute.clone()) { - let vec3 = (*coords).into(); - let transformed = transform.transform_point(vec3); - *coords = transformed.into(); - } - } - } - - fn transformed(&self, transform: Transform) -> Mesh { - let mut mesh = self.clone(); - mesh.transform(transform); - mesh - } - - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]> { - match self.attribute_mut(id).unwrap() { - VertexAttributeValues::Float32x3(values) => values, - // Guaranteed by Bevy - _ => unreachable!(), - } - } - - fn search_in_children<'a>( - children: &'a Children, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> (Entity, &'a Mesh) { - let entity_handles: Vec<_> = children - .iter() - .filter_map(|entity| mesh_handles.get(*entity).ok().map(|mesh| (*entity, mesh))) - .collect(); - assert_eq!( - entity_handles.len(), - 1, - "Collider must contain exactly one mesh, but found {}", - entity_handles.len() - ); - let (entity, mesh_handle) = entity_handles.first().unwrap(); - let mesh = meshes.get(mesh_handle).unwrap(); - assert_eq!(mesh.primitive_topology(), PrimitiveTopology::TriangleList); - (*entity, mesh) - } -} diff --git a/examples/bevy_gltf_save_load/basic/src/core/relationships/mod.rs b/examples/bevy_gltf_save_load/basic/src/core/relationships/mod.rs deleted file mode 100644 index 4128453..0000000 --- a/examples/bevy_gltf_save_load/basic/src/core/relationships/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub mod relationships_insert_dependant_components; -pub use relationships_insert_dependant_components::*; - -use bevy::prelude::*; - -pub struct EcsRelationshipsPlugin; -impl Plugin for EcsRelationshipsPlugin { - fn build(&self, app: &mut App) { - app; - } -} diff --git a/examples/bevy_gltf_save_load/basic/src/core/relationships/relationships_insert_dependant_components.rs b/examples/bevy_gltf_save_load/basic/src/core/relationships/relationships_insert_dependant_components.rs deleted file mode 100644 index 4e9ad17..0000000 --- a/examples/bevy_gltf_save_load/basic/src/core/relationships/relationships_insert_dependant_components.rs +++ /dev/null @@ -1,15 +0,0 @@ -use bevy::prelude::*; - -pub fn insert_dependant_component< - Dependant: Component, - Dependency: Component + std::default::Default, ->( - mut commands: Commands, - entities_without_depency: Query<(Entity, &Name), (With, Without)>, -) { - for (entity, name) in entities_without_depency.iter() { - let name = name.clone().to_string(); - commands.entity(entity).insert(Dependency::default()); - warn!("found an entity called {} with a {} component but without an {}, please check your assets", name.clone(), std::any::type_name::(), std::any::type_name::()); - } -} diff --git a/examples/bevy_gltf_save_load/basic/src/game/in_game.rs b/examples/bevy_gltf_save_load/basic/src/game/in_game.rs index d31b1a8..6bcedba 100644 --- a/examples/bevy_gltf_save_load/basic/src/game/in_game.rs +++ b/examples/bevy_gltf_save_load/basic/src/game/in_game.rs @@ -1,8 +1,7 @@ -use super::Player; -use crate::state::{GameState, InAppRunning}; use bevy::prelude::*; use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag, Library, NoInBlueprint}; use bevy_gltf_save_load::{Dynamic, DynamicEntitiesRoot, StaticEntitiesRoot}; +use bevy_gltf_worlflow_examples_common::{GameState, InAppRunning, Player}; use bevy_rapier3d::prelude::Velocity; use rand::Rng; @@ -62,7 +61,7 @@ pub fn unload_world(mut commands: Commands, gameworlds: Query>) -> bool { - return keycode.just_pressed(KeyCode::N); + keycode.just_pressed(KeyCode::N) } pub fn spawn_test( @@ -171,7 +170,7 @@ pub fn spawn_test_parenting( blueprint: BlueprintName("Sphero".to_string()), ..Default::default() }, - bevy::prelude::Name::from(format!("SubParentingTest")), + bevy::prelude::Name::from("SubParentingTest".to_string()), TransformBundle::from_transform(Transform::from_xyz(x, 2.0, y)), Dynamic(true), )) @@ -183,7 +182,7 @@ pub fn spawn_test_parenting( blueprint: BlueprintName("Container".into()), ..Default::default() }, - bevy::prelude::Name::from(format!("ParentingTest")), + bevy::prelude::Name::from("ParentingTest".to_string()), Dynamic(true), TransformBundle::from_transform(Transform::from_xyz(x, 2.0, y)), )) diff --git a/examples/bevy_gltf_save_load/basic/src/game/in_game_loading.rs b/examples/bevy_gltf_save_load/basic/src/game/in_game_loading.rs index e0d3770..7f938c0 100644 --- a/examples/bevy_gltf_save_load/basic/src/game/in_game_loading.rs +++ b/examples/bevy_gltf_save_load/basic/src/game/in_game_loading.rs @@ -1,6 +1,5 @@ use bevy::{core_pipeline::clear_color::ClearColorConfig, prelude::*}; - -use crate::state::InGameLoading; +use bevy_gltf_worlflow_examples_common::InGameLoading; pub fn setup_loading_screen(mut commands: Commands) { commands.spawn(( diff --git a/examples/bevy_gltf_save_load/basic/src/game/in_game_saving.rs b/examples/bevy_gltf_save_load/basic/src/game/in_game_saving.rs index 1605ad0..8a48a9a 100644 --- a/examples/bevy_gltf_save_load/basic/src/game/in_game_saving.rs +++ b/examples/bevy_gltf_save_load/basic/src/game/in_game_saving.rs @@ -1,6 +1,5 @@ use bevy::prelude::*; - -use crate::state::InGameSaving; +use bevy_gltf_worlflow_examples_common::InGameSaving; pub fn setup_saving_screen(mut commands: Commands) { commands.spawn(( diff --git a/examples/bevy_gltf_save_load/basic/src/game/in_main_menu.rs b/examples/bevy_gltf_save_load/basic/src/game/in_main_menu.rs index c8fc24a..f449eec 100644 --- a/examples/bevy_gltf_save_load/basic/src/game/in_main_menu.rs +++ b/examples/bevy_gltf_save_load/basic/src/game/in_main_menu.rs @@ -1,6 +1,5 @@ use bevy::prelude::*; - -use crate::state::{AppState, InMainMenu}; +use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu}; pub fn setup_main_menu(mut commands: Commands) { commands.spawn((Camera2dBundle::default(), InMainMenu)); diff --git a/examples/bevy_gltf_save_load/basic/src/game/mod.rs b/examples/bevy_gltf_save_load/basic/src/game/mod.rs index 8e44a20..f30e6fe 100644 --- a/examples/bevy_gltf_save_load/basic/src/game/mod.rs +++ b/examples/bevy_gltf_save_load/basic/src/game/mod.rs @@ -1,4 +1,5 @@ pub mod in_game; +use bevy_gltf_worlflow_examples_common::{AppState, GameState}; pub use in_game::*; pub mod in_main_menu; @@ -10,64 +11,9 @@ pub use in_game_loading::*; pub mod in_game_saving; pub use in_game_saving::*; -pub mod picking; -pub use picking::*; - -use crate::state::{AppState, GameState}; use bevy::prelude::*; use bevy_gltf_save_load::{LoadRequest, LoadingFinished, SaveRequest, SavingFinished}; -// this file is just for demo purposes, contains various types of components, systems etc - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum SoundMaterial { - Metal, - Wood, - Rock, - Cloth, - Squishy, - #[default] - None, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Player; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo component showing auto injection of components -pub struct ShouldBeWithPlayer; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Interactible; - -fn player_move_demo( - keycode: Res>, - mut players: Query<&mut Transform, With>, -) { - let speed = 0.2; - if let Ok(mut player) = players.get_single_mut() { - if keycode.pressed(KeyCode::Left) { - player.translation.x += speed; - } - if keycode.pressed(KeyCode::Right) { - player.translation.x -= speed; - } - - if keycode.pressed(KeyCode::Up) { - player.translation.z += speed; - } - if keycode.pressed(KeyCode::Down) { - player.translation.z -= speed; - } - } -} - pub fn request_save( mut save_requests: EventWriter, keycode: Res>, @@ -124,48 +70,38 @@ pub fn on_loading_finished( pub struct GamePlugin; impl Plugin for GamePlugin { fn build(&self, app: &mut App) { - app.add_plugins(PickingPlugin) - .register_type::() - .register_type::() - .register_type::() - .add_systems( - Update, - ( - // little helper utility, to automatically inject components that are dependant on an other component - // ie, here an Entity with a Player component should also always have a ShouldBeWithPlayer component - // you get a warning if you use this, as I consider this to be stop-gap solution (usually you should have either a bundle, or directly define all needed components) - - // insert_dependant_component::, - player_move_demo, //.run_if(in_state(AppState::Running)), - spawn_test, - spawn_test_unregisted_components, - spawn_test_parenting, - ) - .run_if(in_state(GameState::InGame)), + app.add_systems( + Update, + ( + spawn_test, + spawn_test_unregisted_components, + spawn_test_parenting, ) - .add_systems( - Update, - (unload_world, apply_deferred, setup_game) - .chain() - .run_if(should_reset) - .run_if(in_state(AppState::AppRunning)), - ) - .add_systems( - Update, - ( - request_save, - request_load, - on_saving_finished, - on_loading_finished, - ), - ) - .add_systems(OnEnter(AppState::MenuRunning), setup_main_menu) - .add_systems(OnExit(AppState::MenuRunning), teardown_main_menu) - .add_systems(Update, main_menu.run_if(in_state(AppState::MenuRunning))) - .add_systems(OnEnter(GameState::InLoading), setup_loading_screen) - .add_systems(OnExit(GameState::InLoading), teardown_loading_screen) - .add_systems(OnEnter(GameState::InSaving), setup_saving_screen) - .add_systems(OnExit(GameState::InSaving), teardown_saving_screen) - .add_systems(OnEnter(AppState::AppRunning), setup_game); + .run_if(in_state(GameState::InGame)), + ) + .add_systems( + Update, + (unload_world, apply_deferred, setup_game) + .chain() + .run_if(should_reset) + .run_if(in_state(AppState::AppRunning)), + ) + .add_systems( + Update, + ( + request_save, + request_load, + on_saving_finished, + on_loading_finished, + ), + ) + .add_systems(OnEnter(AppState::MenuRunning), setup_main_menu) + .add_systems(OnExit(AppState::MenuRunning), teardown_main_menu) + .add_systems(Update, main_menu.run_if(in_state(AppState::MenuRunning))) + .add_systems(OnEnter(GameState::InLoading), setup_loading_screen) + .add_systems(OnExit(GameState::InLoading), teardown_loading_screen) + .add_systems(OnEnter(GameState::InSaving), setup_saving_screen) + .add_systems(OnExit(GameState::InSaving), teardown_saving_screen) + .add_systems(OnEnter(AppState::AppRunning), setup_game); } } diff --git a/examples/bevy_gltf_save_load/basic/src/game/picking.rs b/examples/bevy_gltf_save_load/basic/src/game/picking.rs deleted file mode 100644 index 6731bbb..0000000 --- a/examples/bevy_gltf_save_load/basic/src/game/picking.rs +++ /dev/null @@ -1,34 +0,0 @@ -use super::Player; -use bevy::prelude::*; -use bevy_gltf_blueprints::GltfBlueprintsSet; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub struct Pickable; - -// very simple, crude picking (as in picking up objects) implementation - -pub fn picking( - players: Query<&GlobalTransform, With>, - pickables: Query<(Entity, &GlobalTransform), With>, - mut commands: Commands, -) { - for player_transforms in players.iter() { - for (pickable, pickable_transforms) in pickables.iter() { - let distance = player_transforms - .translation() - .distance(pickable_transforms.translation()); - if distance < 2.5 { - commands.entity(pickable).despawn_recursive(); - } - } - } -} - -pub struct PickingPlugin; -impl Plugin for PickingPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .add_systems(Update, (picking.after(GltfBlueprintsSet::AfterSpawn),)); - } -} diff --git a/examples/bevy_gltf_save_load/basic/src/main.rs b/examples/bevy_gltf_save_load/basic/src/main.rs index 6edba33..8fca426 100644 --- a/examples/bevy_gltf_save_load/basic/src/main.rs +++ b/examples/bevy_gltf_save_load/basic/src/main.rs @@ -1,15 +1,10 @@ use bevy::prelude::*; use bevy_editor_pls::prelude::*; +use bevy_gltf_worlflow_examples_common::CommonPlugin; mod core; use crate::core::*; -pub mod assets; -use assets::*; - -pub mod state; -use state::*; - mod game; use game::*; @@ -23,8 +18,7 @@ fn main() { // editor EditorPlugin::default(), // our custom plugins - StatePlugin, - AssetsPlugin, + CommonPlugin, CorePlugin, // reusable plugins GamePlugin, // specific to our game ComponentsTestPlugin, // Showcases different type of components /structs diff --git a/examples/bevy_gltf_save_load/basic/src/test_components.rs b/examples/bevy_gltf_save_load/basic/src/test_components.rs index d0e6fbd..b5384e2 100644 --- a/examples/bevy_gltf_save_load/basic/src/test_components.rs +++ b/examples/bevy_gltf_save_load/basic/src/test_components.rs @@ -6,39 +6,39 @@ struct UnitTest; #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -struct TuppleTestF32(f32); +struct TupleTestF32(f32); #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -struct TuppleTestU64(u64); +struct TupleTestU64(u64); #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -pub struct TuppleTestStr(String); +pub struct TupleTestStr(String); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTest2(f32, u64, String); +struct TupleTest2(f32, u64, String); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTestBool(bool); +struct TupleTestBool(bool); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec2(Vec2); +struct TupleVec2(Vec2); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec3(Vec3); +struct TupleVec3(Vec3); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec(Vec); +struct TupleVec(Vec); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTestColor(Color); +struct TupleTestColor(Color); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] @@ -65,16 +65,16 @@ impl Plugin for ComponentsTestPlugin { fn build(&self, app: &mut App) { app.register_type::() .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() .register_type::() - .register_type::() - .register_type::() + .register_type::() + .register_type::() .register_type::>(); } } diff --git a/examples/bevy_registry_export/basic/Cargo.lock b/examples/bevy_registry_export/basic/Cargo.lock deleted file mode 100644 index 5063b29..0000000 --- a/examples/bevy_registry_export/basic/Cargo.lock +++ /dev/null @@ -1,4629 +0,0 @@ -# This file is automatically @generated by Cargo. -# It is not intended for manual editing. -version = 3 - -[[package]] -name = "ab_glyph" -version = "0.2.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "80179d7dd5d7e8c285d67c4a1e652972a92de7475beddfb92028c76463b13225" -dependencies = [ - "ab_glyph_rasterizer", - "owned_ttf_parser", -] - -[[package]] -name = "ab_glyph_rasterizer" -version = "0.1.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c71b1793ee61086797f5c80b6efa2b8ffa6d5dd703f118545808a7f2e27f7046" - -[[package]] -name = "accesskit" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca8410747ed85a17c4a1e9ed3f5a74d3e7bdcc876cf9a18ff40ae21d645997b2" - -[[package]] -name = "accesskit_consumer" -version = "0.16.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c17cca53c09fbd7288667b22a201274b9becaa27f0b91bf52a526db95de45e6" -dependencies = [ - "accesskit", -] - -[[package]] -name = "accesskit_macos" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd3b6ae1eabbfbced10e840fd3fce8a93ae84f174b3e4ba892ab7bcb42e477a7" -dependencies = [ - "accesskit", - "accesskit_consumer", - "objc2", - "once_cell", -] - -[[package]] -name = "accesskit_windows" -version = "0.15.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afcae27ec0974fc7c3b0b318783be89fd1b2e66dd702179fe600166a38ff4a0b" -dependencies = [ - "accesskit", - "accesskit_consumer", - "once_cell", - "paste", - "static_assertions", - "windows 0.48.0", -] - -[[package]] -name = "accesskit_winit" -version = "0.15.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88e39fcec2e10971e188730b7a76bab60647dacc973d4591855ebebcadfaa738" -dependencies = [ - "accesskit", - "accesskit_macos", - "accesskit_windows", - "winit", -] - -[[package]] -name = "addr2line" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" -dependencies = [ - "gimli", -] - -[[package]] -name = "adler" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" - -[[package]] -name = "ahash" -version = "0.8.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91429305e9f0a25f6205c5b8e0d2db09e0708a7a6df0f42212bb56c32c8ac97a" -dependencies = [ - "cfg-if", - "getrandom", - "once_cell", - "version_check", - "zerocopy", -] - -[[package]] -name = "aho-corasick" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b2969dcb958b36655471fc61f7e416fa76033bdd4bfed0678d8fee1e2d07a1f0" -dependencies = [ - "memchr", -] - -[[package]] -name = "allocator-api2" -version = "0.2.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0942ffc6dcaadf03badf6e6a2d0228460359d5e34b57ccdc720b7382dfbd5ec5" - -[[package]] -name = "alsa" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2562ad8dcf0f789f65c6fdaad8a8a9708ed6b488e649da28c01656ad66b8b47" -dependencies = [ - "alsa-sys", - "bitflags 1.3.2", - "libc", - "nix 0.24.3", -] - -[[package]] -name = "alsa-sys" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db8fee663d06c4e303404ef5f40488a53e062f89ba8bfed81f42325aafad1527" -dependencies = [ - "libc", - "pkg-config", -] - -[[package]] -name = "android-activity" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64529721f27c2314ced0890ce45e469574a73e5e6fdd6e9da1860eb29285f5e0" -dependencies = [ - "android-properties", - "bitflags 1.3.2", - "cc", - "jni-sys", - "libc", - "log", - "ndk", - "ndk-context", - "ndk-sys", - "num_enum 0.6.1", -] - -[[package]] -name = "android-properties" -version = "0.2.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7eb209b1518d6bb87b283c20095f5228ecda460da70b44f0802523dea6da04" - -[[package]] -name = "android_log-sys" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5ecc8056bf6ab9892dcd53216c83d1597487d7dacac16c8df6b877d127df9937" - -[[package]] -name = "android_system_properties" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" -dependencies = [ - "libc", -] - -[[package]] -name = "anyhow" -version = "1.0.75" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4668cab20f66d8d020e1fbc0ebe47217433c1b6c8f2040faf858554e394ace6" - -[[package]] -name = "approx" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cab112f0a86d568ea0e627cc1d6be74a1e9cd55214684db5561995f6dad897c6" -dependencies = [ - "num-traits", -] - -[[package]] -name = "arboard" -version = "3.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac57f2b058a76363e357c056e4f74f1945bf734d37b8b3ef49066c4787dde0fc" -dependencies = [ - "clipboard-win", - "core-graphics", - "image", - "log", - "objc", - "objc-foundation", - "objc_id", - "parking_lot", - "thiserror", - "winapi", - "x11rb", -] - -[[package]] -name = "arrayref" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" - -[[package]] -name = "arrayvec" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" - -[[package]] -name = "ash" -version = "0.37.3+1.3.251" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e9c3835d686b0a6084ab4234fcd1b07dbf6e4767dce60874b12356a25ecd4a" -dependencies = [ - "libloading 0.7.4", -] - -[[package]] -name = "async-broadcast" -version = "0.5.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c48ccdbf6ca6b121e0f586cbc0e73ae440e56c67c30fa0873b4e110d9c26d2b" -dependencies = [ - "event-listener", - "futures-core", -] - -[[package]] -name = "async-channel" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "81953c529336010edd6d8e358f886d9581267795c61b19475b71314bffa46d35" -dependencies = [ - "concurrent-queue", - "event-listener", - "futures-core", -] - -[[package]] -name = "async-executor" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b0c4a4f319e45986f347ee47fef8bf5e81c9abc3f6f58dc2391439f30df65f0" -dependencies = [ - "async-lock", - "async-task", - "concurrent-queue", - "fastrand 2.0.1", - "futures-lite", - "slab", -] - -[[package]] -name = "async-fs" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "279cf904654eeebfa37ac9bb1598880884924aab82e290aa65c9e77a0e142e06" -dependencies = [ - "async-lock", - "autocfg", - "blocking", - "futures-lite", -] - -[[package]] -name = "async-lock" -version = "2.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "287272293e9d8c41773cec55e365490fe034813a2f172f502d6ddcf75b2f582b" -dependencies = [ - "event-listener", -] - -[[package]] -name = "async-task" -version = "4.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4eb2cdb97421e01129ccb49169d8279ed21e829929144f4a22a6e54ac549ca1" - -[[package]] -name = "atomic-waker" -version = "1.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" - -[[package]] -name = "autocfg" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" - -[[package]] -name = "backtrace" -version = "0.3.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2089b7e3f35b9dd2d0ed921ead4f6d318c27680d4a5bd167b3ee120edb105837" -dependencies = [ - "addr2line", - "cc", - "cfg-if", - "libc", - "miniz_oxide", - "object", - "rustc-demangle", -] - -[[package]] -name = "base64" -version = "0.13.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" - -[[package]] -name = "base64" -version = "0.21.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" - -[[package]] -name = "bevy" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "329e344f835f5a9a4c46a6d1d57371f726aa2c482d1bd669b2b9c4eb1ee91fd7" -dependencies = [ - "bevy_internal", -] - -[[package]] -name = "bevy-inspector-egui" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d65b98d6fca1209c36c4d403c377f303aad22d940281fe1a9e431217516f0622" -dependencies = [ - "bevy-inspector-egui-derive", - "bevy_app", - "bevy_asset", - "bevy_core", - "bevy_core_pipeline", - "bevy_ecs", - "bevy_egui", - "bevy_hierarchy", - "bevy_log", - "bevy_math", - "bevy_pbr", - "bevy_reflect", - "bevy_render", - "bevy_utils", - "bevy_window", - "egui", - "image", - "once_cell", - "pretty-type-name", - "smallvec", -] - -[[package]] -name = "bevy-inspector-egui-derive" -version = "0.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec800b7cf98151b5dbff80f0eb6dffcb4bcfceef6e457888b395ead4eb7e75ba" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "bevy_a11y" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "271b812e5734f5056a400f7d64592dd82d6c0e6179389c2f066f433ab8bc7692" -dependencies = [ - "accesskit", - "bevy_app", - "bevy_derive", - "bevy_ecs", -] - -[[package]] -name = "bevy_animation" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab94187a1253433e14f175293d8a86ec1c2822fda2a17807908f11ec21f45f00" -dependencies = [ - "bevy_app", - "bevy_asset", - "bevy_core", - "bevy_ecs", - "bevy_hierarchy", - "bevy_math", - "bevy_reflect", - "bevy_render", - "bevy_time", - "bevy_transform", - "bevy_utils", -] - -[[package]] -name = "bevy_app" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "172d532ea812e5954fa814dae003c207f2a0b20c6e50431787c94a7159677ece" -dependencies = [ - "bevy_derive", - "bevy_ecs", - "bevy_reflect", - "bevy_tasks", - "bevy_utils", - "downcast-rs", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "bevy_asset" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccb2b67984088b23e223cfe9ec1befd89a110665a679acb06839bc4334ed37d6" -dependencies = [ - "async-broadcast", - "async-fs", - "async-lock", - "bevy_app", - "bevy_asset_macros", - "bevy_ecs", - "bevy_log", - "bevy_reflect", - "bevy_tasks", - "bevy_utils", - "bevy_winit", - "blake3", - "crossbeam-channel", - "downcast-rs", - "futures-io", - "futures-lite", - "js-sys", - "parking_lot", - "ron", - "serde", - "thiserror", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", -] - -[[package]] -name = "bevy_asset_loader" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d797cc907daa293a2776fea1517ed79f9e54d9901dfd35410743cbe536d4c2b" -dependencies = [ - "anyhow", - "bevy", - "bevy_asset_loader_derive", - "bevy_common_assets", - "path-slash", - "serde", -] - -[[package]] -name = "bevy_asset_loader_derive" -version = "0.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d43820afc6e2a7a9e09adb5f13a760bd9a973f391c106411f0bf229d9958c61d" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "bevy_asset_macros" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b3245193e90fc8abcf1059a467cb224501dcda083d114c67c10ac66b7171e3a" -dependencies = [ - "bevy_macro_utils", - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "bevy_audio" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478de80ff25cb7decbcb22797774d1597e8c32914e81431c67d64faadc08f84a" -dependencies = [ - "bevy_app", - "bevy_asset", - "bevy_derive", - "bevy_ecs", - "bevy_math", - "bevy_reflect", - "bevy_transform", - "bevy_utils", - "oboe", - "rodio", -] - -[[package]] -name = "bevy_common_assets" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9397adf1558aa3f08e20aa567538a7238b451362fc8c6b678d409c040c221799" -dependencies = [ - "anyhow", - "bevy", - "ron", - "serde", - "thiserror", -] - -[[package]] -name = "bevy_core" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "025e6800b73048092a55c3611e9327ad4c4c17b60517ec1c0086bb40b4b19ea8" -dependencies = [ - "bevy_app", - "bevy_ecs", - "bevy_math", - "bevy_reflect", - "bevy_tasks", - "bevy_utils", - "bytemuck", - "serde", -] - -[[package]] -name = "bevy_core_pipeline" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e4b08a2d53ba62d9ec1fca3f7f4e0f556e9f59e1c8e63a4b7c2a18c0701152c" -dependencies = [ - "bevy_app", - "bevy_asset", - "bevy_core", - "bevy_derive", - "bevy_ecs", - "bevy_log", - "bevy_math", - "bevy_reflect", - "bevy_render", - "bevy_transform", - "bevy_utils", - "bitflags 2.4.1", - "radsort", - "serde", -] - -[[package]] -name = "bevy_derive" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24bf40259be12a1a24d9fd536f5ff18d31eeb5665b77e2732899783be6edc5d6" -dependencies = [ - "bevy_macro_utils", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "bevy_diagnostic" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "41b5a99a9fb6cd7d1eb1714fad193944a0317f0887a15cccb8309c8d37951132" -dependencies = [ - "bevy_app", - "bevy_core", - "bevy_ecs", - "bevy_log", - "bevy_time", - "bevy_utils", - "sysinfo", -] - -[[package]] -name = "bevy_ecs" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae11a1f467c372b50e9d4b55e78370f5420c9db7416200cc441cc84f08174dd3" -dependencies = [ - "async-channel", - "bevy_ecs_macros", - "bevy_ptr", - "bevy_reflect", - "bevy_tasks", - "bevy_utils", - "downcast-rs", - "event-listener", - "fixedbitset", - "rustc-hash", - "serde", - "thiserror", - "thread_local", -] - -[[package]] -name = "bevy_ecs_macros" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f642c2b67c4d0daf8edf15074f6351457eb487a34b3de1290c760d8f3ac9ec16" -dependencies = [ - "bevy_macro_utils", - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "bevy_editor_pls" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "170e3ee3293f70be7fa1b82e8ffe52dcb190c68b2f0ef4847afe65626b417ad7" -dependencies = [ - "bevy", - "bevy_editor_pls_core", - "bevy_editor_pls_default_windows", - "egui", - "egui-gizmo", -] - -[[package]] -name = "bevy_editor_pls_core" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9bab331de653d7d976a1fb0ab3ae8eff1dc821c5991c09bdbe945e70234839c" -dependencies = [ - "bevy", - "bevy-inspector-egui", - "egui_dock", - "indexmap 2.1.0", -] - -[[package]] -name = "bevy_editor_pls_default_windows" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b833e3b3d5c69b92527e766b470b27cb4745406e2087be19be81b595cc48792c" -dependencies = [ - "bevy", - "bevy-inspector-egui", - "bevy_editor_pls_core", - "bevy_mod_debugdump", - "egui-gizmo", - "indexmap 2.1.0", - "opener", - "pretty-type-name", -] - -[[package]] -name = "bevy_egui" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85450af551b7e1cb766f710763b60a12a82ffd6323945a8f776c6334c59ccdc1" -dependencies = [ - "arboard", - "bevy", - "egui", - "thread_local", - "webbrowser", -] - -[[package]] -name = "bevy_encase_derive" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "65b9fb5a62c4e3ab70caaa839470d35fa932001b1b34b08bc7f7f1909bd2b3a7" -dependencies = [ - "bevy_macro_utils", - "encase_derive_impl", -] - -[[package]] -name = "bevy_gilrs" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad31cc2c84315e0759d793d6c5bcb7d8789bbc16359c98d1b766e708c1bbae49" -dependencies = [ - "bevy_app", - "bevy_ecs", - "bevy_input", - "bevy_log", - "bevy_time", - "bevy_utils", - "gilrs", - "thiserror", -] - -[[package]] -name = "bevy_gizmos" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87d1cc978b91f416b23eb16f00e69f95c3a04582021827d8082e92d4725cc510" -dependencies = [ - "bevy_app", - "bevy_asset", - "bevy_core", - "bevy_core_pipeline", - "bevy_ecs", - "bevy_math", - "bevy_pbr", - "bevy_reflect", - "bevy_render", - "bevy_sprite", - "bevy_transform", - "bevy_utils", -] - -[[package]] -name = "bevy_gltf" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f933745c0c86e2c07948def581259b466f99708328657054e956275430ccfd7" -dependencies = [ - "base64 0.13.1", - "bevy_animation", - "bevy_app", - "bevy_asset", - "bevy_core", - "bevy_core_pipeline", - "bevy_ecs", - "bevy_hierarchy", - "bevy_log", - "bevy_math", - "bevy_pbr", - "bevy_reflect", - "bevy_render", - "bevy_scene", - "bevy_tasks", - "bevy_transform", - "bevy_utils", - "gltf", - "percent-encoding", - "serde", - "serde_json", - "thiserror", -] - -[[package]] -name = "bevy_gltf_blueprints" -version = "0.3.0" -dependencies = [ - "bevy", - "bevy_gltf_components", -] - -[[package]] -name = "bevy_gltf_blueprints_basic_example" -version = "0.3.0" -dependencies = [ - "bevy", - "bevy_asset_loader", - "bevy_editor_pls", - "bevy_gltf_blueprints", - "bevy_rapier3d", - "rand", -] - -[[package]] -name = "bevy_gltf_components" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd745a2988c631286404e12d184d4a30a634fbbba1deceaaa1ca7fcbc607cc7a" -dependencies = [ - "bevy", - "ron", - "serde", -] - -[[package]] -name = "bevy_hierarchy" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64fa240011fce8ee23f9b46e5a26a628a31d7860d6d2e4e0e361bb3ea6d5a703" -dependencies = [ - "bevy_app", - "bevy_core", - "bevy_ecs", - "bevy_log", - "bevy_reflect", - "bevy_utils", - "smallvec", -] - -[[package]] -name = "bevy_input" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e86e241b3a10b79f65a69205552546723b855d3d4c1bd8261637c076144d32f" -dependencies = [ - "bevy_app", - "bevy_ecs", - "bevy_math", - "bevy_reflect", - "bevy_utils", - "serde", - "thiserror", -] - -[[package]] -name = "bevy_internal" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55124e486814c4d3632d5cfad9c4f4e46d052c028593ec46fef5bfbfb0f840b1" -dependencies = [ - "bevy_a11y", - "bevy_animation", - "bevy_app", - "bevy_asset", - "bevy_audio", - "bevy_core", - "bevy_core_pipeline", - "bevy_derive", - "bevy_diagnostic", - "bevy_ecs", - "bevy_gilrs", - "bevy_gizmos", - "bevy_gltf", - "bevy_hierarchy", - "bevy_input", - "bevy_log", - "bevy_math", - "bevy_pbr", - "bevy_ptr", - "bevy_reflect", - "bevy_render", - "bevy_scene", - "bevy_sprite", - "bevy_tasks", - "bevy_text", - "bevy_time", - "bevy_transform", - "bevy_ui", - "bevy_utils", - "bevy_window", - "bevy_winit", -] - -[[package]] -name = "bevy_log" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "011417debf7868b45932bb97fc0d5bfdeaf9304e324aa94840e2f1e6deeed69d" -dependencies = [ - "android_log-sys", - "bevy_app", - "bevy_ecs", - "bevy_utils", - "console_error_panic_hook", - "tracing-log", - "tracing-subscriber", - "tracing-wasm", -] - -[[package]] -name = "bevy_macro_utils" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf6fba87c6d069fcbcd8a48625ca8ab4392ad40d2b260863ce7d641a0f42986d" -dependencies = [ - "proc-macro2", - "quote", - "rustc-hash", - "syn 2.0.39", - "toml_edit 0.20.7", -] - -[[package]] -name = "bevy_math" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "752764558a1f429c20704c3b836a019fa308961c43fdfef4f08e339d456c96be" -dependencies = [ - "glam", - "serde", -] - -[[package]] -name = "bevy_mikktspace" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b596c41a56f2268ec7cde560edc588bc7b5886e4b49c8b27c4dcc9f7c743424c" -dependencies = [ - "glam", -] - -[[package]] -name = "bevy_mod_debugdump" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4db8601f41ea570b7d32f3177292a608196c59bdf3298001a9e202d5e7439438" -dependencies = [ - "bevy_app", - "bevy_ecs", - "bevy_render", - "bevy_utils", - "once_cell", - "petgraph", - "pretty-type-name", -] - -[[package]] -name = "bevy_pbr" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eeb6a35a78d355cc21c10f277dcd171eca65e30a90e76eb89f4dacf606621fe1" -dependencies = [ - "bevy_app", - "bevy_asset", - "bevy_core_pipeline", - "bevy_derive", - "bevy_ecs", - "bevy_math", - "bevy_reflect", - "bevy_render", - "bevy_transform", - "bevy_utils", - "bevy_window", - "bitflags 2.4.1", - "bytemuck", - "fixedbitset", - "naga_oil", - "radsort", - "smallvec", - "thread_local", -] - -[[package]] -name = "bevy_ptr" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "308a02679f6ce21ef71de20fae6d6a2016c07baa21d8e8d0558e6b7851e8adf2" - -[[package]] -name = "bevy_rapier3d" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3f0a2641af76c9eb17da0dcb0fb20cd9d615b93b67be0b85f1867487e956b5a" -dependencies = [ - "bevy", - "bitflags 2.4.1", - "log", - "nalgebra", - "rapier3d", - "serde", -] - -[[package]] -name = "bevy_reflect" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdd56914a8ad57621d7a1a099f7e6b1f7482c9c76cedc9c3d4c175a203939c5d" -dependencies = [ - "bevy_math", - "bevy_ptr", - "bevy_reflect_derive", - "bevy_utils", - "downcast-rs", - "erased-serde", - "glam", - "serde", - "smallvec", - "smol_str", - "thiserror", -] - -[[package]] -name = "bevy_reflect_derive" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25f627907c40ac552f798423447fc331fc1ddacd94c5f7a2a70942eb06bc8447" -dependencies = [ - "bevy_macro_utils", - "proc-macro2", - "quote", - "syn 2.0.39", - "uuid", -] - -[[package]] -name = "bevy_render" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90d777f4c51bd58e9e40777c6cb8dde0778df7e2c5298b3f9e3455bd12a9856c" -dependencies = [ - "async-channel", - "bevy_app", - "bevy_asset", - "bevy_core", - "bevy_derive", - "bevy_ecs", - "bevy_encase_derive", - "bevy_hierarchy", - "bevy_log", - "bevy_math", - "bevy_mikktspace", - "bevy_reflect", - "bevy_render_macros", - "bevy_tasks", - "bevy_time", - "bevy_transform", - "bevy_utils", - "bevy_window", - "bitflags 2.4.1", - "bytemuck", - "codespan-reporting", - "downcast-rs", - "encase", - "futures-lite", - "hexasphere", - "image", - "js-sys", - "ktx2", - "naga", - "naga_oil", - "ruzstd", - "serde", - "smallvec", - "thiserror", - "thread_local", - "wasm-bindgen", - "web-sys", - "wgpu", -] - -[[package]] -name = "bevy_render_macros" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35b00c3d0abff94a729460fc9aa95c2ceac71b49b3041166bb5ba3098e9657e7" -dependencies = [ - "bevy_macro_utils", - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "bevy_scene" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba6294396a6375f0b14341d8003408c10aa040e3f833ac8bd49677170ec55d73" -dependencies = [ - "bevy_app", - "bevy_asset", - "bevy_derive", - "bevy_ecs", - "bevy_hierarchy", - "bevy_reflect", - "bevy_render", - "bevy_transform", - "bevy_utils", - "ron", - "serde", - "thiserror", - "uuid", -] - -[[package]] -name = "bevy_sprite" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4f7d1f88a6e5497fdafd95c20984a1d1b5517bc39d51600b4988cd60c51837a" -dependencies = [ - "bevy_app", - "bevy_asset", - "bevy_core_pipeline", - "bevy_derive", - "bevy_ecs", - "bevy_log", - "bevy_math", - "bevy_reflect", - "bevy_render", - "bevy_transform", - "bevy_utils", - "bitflags 2.4.1", - "bytemuck", - "fixedbitset", - "guillotiere", - "radsort", - "rectangle-pack", - "thiserror", -] - -[[package]] -name = "bevy_tasks" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a45be906618192515bc613e46546150089adbb4a82178dc462045acd1e89e92" -dependencies = [ - "async-channel", - "async-executor", - "async-task", - "concurrent-queue", - "futures-lite", - "wasm-bindgen-futures", -] - -[[package]] -name = "bevy_text" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c136af700af4f87c94f68d6e019528c371bf09ebf4a8ff7468bb3c73806b34f5" -dependencies = [ - "ab_glyph", - "bevy_app", - "bevy_asset", - "bevy_ecs", - "bevy_math", - "bevy_reflect", - "bevy_render", - "bevy_sprite", - "bevy_transform", - "bevy_utils", - "bevy_window", - "glyph_brush_layout", - "serde", - "thiserror", -] - -[[package]] -name = "bevy_time" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b29709cadf22d318a0b7c79f763e9c5ac414292bd0e850066fa935959021b276" -dependencies = [ - "bevy_app", - "bevy_ecs", - "bevy_reflect", - "bevy_utils", - "crossbeam-channel", - "serde", - "thiserror", -] - -[[package]] -name = "bevy_transform" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70262c51e915b6224129206d23823364e650cf5eb5f4b6ce3ee379f608c180d2" -dependencies = [ - "bevy_app", - "bevy_ecs", - "bevy_hierarchy", - "bevy_math", - "bevy_reflect", - "serde", - "thiserror", -] - -[[package]] -name = "bevy_ui" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cd5ecbf2dceaab118769dd870e34d780bfde556af561fd10d8d613b0f237297e" -dependencies = [ - "bevy_a11y", - "bevy_app", - "bevy_asset", - "bevy_core_pipeline", - "bevy_derive", - "bevy_ecs", - "bevy_hierarchy", - "bevy_input", - "bevy_log", - "bevy_math", - "bevy_reflect", - "bevy_render", - "bevy_sprite", - "bevy_text", - "bevy_transform", - "bevy_utils", - "bevy_window", - "bytemuck", - "serde", - "smallvec", - "taffy", - "thiserror", -] - -[[package]] -name = "bevy_utils" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c8e75d4a34ef0b15dffd1ee9079ef1f0f5139527e192b9d5708b3e158777c753" -dependencies = [ - "ahash", - "bevy_utils_proc_macros", - "getrandom", - "hashbrown 0.14.2", - "instant", - "nonmax", - "petgraph", - "thiserror", - "tracing", - "uuid", -] - -[[package]] -name = "bevy_utils_proc_macros" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7dfd3735a61a1b681ed1e176afe4eae731bbb03e51ad871e9eb39e76a2d170e" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "bevy_window" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e60d1830b3fbd7db5bfea7ac9fcd0f5e1d1af88c91ab469e697ab176d8b3140b" -dependencies = [ - "bevy_a11y", - "bevy_app", - "bevy_ecs", - "bevy_input", - "bevy_math", - "bevy_reflect", - "bevy_utils", - "raw-window-handle", - "serde", -] - -[[package]] -name = "bevy_winit" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f8294e78c6a1f9c34d36501a377c5d20bf0fa23a0958187bb270187741448ba" -dependencies = [ - "accesskit_winit", - "approx", - "bevy_a11y", - "bevy_app", - "bevy_derive", - "bevy_ecs", - "bevy_hierarchy", - "bevy_input", - "bevy_math", - "bevy_tasks", - "bevy_utils", - "bevy_window", - "crossbeam-channel", - "raw-window-handle", - "wasm-bindgen", - "web-sys", - "winit", -] - -[[package]] -name = "bindgen" -version = "0.68.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "726e4313eb6ec35d2730258ad4e15b547ee75d6afaa1361a922e78e59b7d8078" -dependencies = [ - "bitflags 2.4.1", - "cexpr", - "clang-sys", - "lazy_static", - "lazycell", - "peeking_take_while", - "proc-macro2", - "quote", - "regex", - "rustc-hash", - "shlex", - "syn 2.0.39", -] - -[[package]] -name = "bit-set" -version = "0.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" -dependencies = [ - "bit-vec", -] - -[[package]] -name = "bit-vec" -version = "0.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" -dependencies = [ - "serde", -] - -[[package]] -name = "bitflags" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" - -[[package]] -name = "bitflags" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "327762f6e5a765692301e5bb513e0d9fef63be86bbc14528052b1cd3e6f03e07" -dependencies = [ - "serde", -] - -[[package]] -name = "blake3" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0231f06152bf547e9c2b5194f247cd97aacf6dcd8b15d8e5ec0663f64580da87" -dependencies = [ - "arrayref", - "arrayvec", - "cc", - "cfg-if", - "constant_time_eq", -] - -[[package]] -name = "block" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" - -[[package]] -name = "block-sys" -version = "0.1.0-beta.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa55741ee90902547802152aaf3f8e5248aab7e21468089560d4c8840561146" -dependencies = [ - "objc-sys", -] - -[[package]] -name = "block2" -version = "0.2.0-alpha.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8dd9e63c1744f755c2f60332b88de39d341e5e86239014ad839bd71c106dec42" -dependencies = [ - "block-sys", - "objc2-encode", -] - -[[package]] -name = "blocking" -version = "1.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c36a4d0d48574b3dd360b4b7d95cc651d2b6557b6402848a27d4b228a473e2a" -dependencies = [ - "async-channel", - "async-lock", - "async-task", - "fastrand 2.0.1", - "futures-io", - "futures-lite", - "piper", - "tracing", -] - -[[package]] -name = "bstr" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c" -dependencies = [ - "memchr", - "regex-automata 0.4.3", - "serde", -] - -[[package]] -name = "bumpalo" -version = "3.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f30e7476521f6f8af1a1c4c0b8cc94f0bee37d91763d0ca2665f299b6cd8aec" - -[[package]] -name = "bytemuck" -version = "1.14.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "374d28ec25809ee0e23827c2ab573d729e293f281dfe393500e7ad618baa61c6" -dependencies = [ - "bytemuck_derive", -] - -[[package]] -name = "bytemuck_derive" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "965ab7eb5f8f97d2a083c799f3a1b994fc397b2fe2da5d1da1626ce15a39f2b1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "byteorder" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" - -[[package]] -name = "bytes" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2bd12c1caf447e69cd4528f47f94d203fd2582878ecb9e9465484c4148a8223" - -[[package]] -name = "cc" -version = "1.0.83" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1174fb0b6ec23863f8b971027804a42614e347eafb0a95bf0b12cdae21fc4d0" -dependencies = [ - "jobserver", - "libc", -] - -[[package]] -name = "cesu8" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d43a04d8753f35258c91f8ec639f792891f748a1edbd759cf1dcea3382ad83c" - -[[package]] -name = "cexpr" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" -dependencies = [ - "nom", -] - -[[package]] -name = "cfg-if" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" - -[[package]] -name = "cfg_aliases" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" - -[[package]] -name = "clang-sys" -version = "1.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c688fc74432808e3eb684cae8830a86be1d66a2bd58e1f248ed0960a590baf6f" -dependencies = [ - "glob", - "libc", - "libloading 0.7.4", -] - -[[package]] -name = "clipboard-win" -version = "4.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7191c27c2357d9b7ef96baac1773290d4ca63b24205b82a3fd8a0637afcf0362" -dependencies = [ - "error-code", - "str-buf", - "winapi", -] - -[[package]] -name = "codespan-reporting" -version = "0.11.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" -dependencies = [ - "termcolor", - "unicode-width", -] - -[[package]] -name = "color_quant" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" - -[[package]] -name = "com-rs" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf43edc576402991846b093a7ca18a3477e0ef9c588cde84964b5d3e43016642" - -[[package]] -name = "combine" -version = "4.6.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35ed6e9d84f0b51a7f52daf1c7d71dd136fd7a3f41a8462b8cdb8c78d920fad4" -dependencies = [ - "bytes", - "memchr", -] - -[[package]] -name = "concurrent-queue" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f057a694a54f12365049b0958a1685bb52d567f5593b355fbf685838e873d400" -dependencies = [ - "crossbeam-utils", -] - -[[package]] -name = "console_error_panic_hook" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a06aeb73f470f66dcdbf7223caeebb85984942f22f1adb2a088cf9668146bbbc" -dependencies = [ - "cfg-if", - "wasm-bindgen", -] - -[[package]] -name = "const_panic" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6051f239ecec86fde3410901ab7860d458d160371533842974fc61f96d15879b" - -[[package]] -name = "const_soft_float" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ca1caa64ef4ed453e68bb3db612e51cf1b2f5b871337f0fcab1c8f87cc3dff" - -[[package]] -name = "constant_time_eq" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f7144d30dcf0fafbce74250a3963025d8d52177934239851c917d29f1df280c2" - -[[package]] -name = "constgebra" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "edd23e864550e6dafc1e41ac78ce4f1ccddc8672b40c403524a04ff3f0518420" -dependencies = [ - "const_soft_float", -] - -[[package]] -name = "core-foundation" -version = "0.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "194a7a9e6de53fa55116934067c844d9d749312f75c6f6d0980e8c252f8c2146" -dependencies = [ - "core-foundation-sys", - "libc", -] - -[[package]] -name = "core-foundation-sys" -version = "0.8.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e496a50fda8aacccc86d7529e2c1e0892dbd0f898a6b5645b5561b89c3210efa" - -[[package]] -name = "core-graphics" -version = "0.22.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2581bbab3b8ffc6fcbd550bf46c355135d16e9ff2a6ea032ad6b9bf1d7efe4fb" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "core-graphics-types", - "foreign-types 0.3.2", - "libc", -] - -[[package]] -name = "core-graphics-types" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bb142d41022986c1d8ff29103a1411c8a3dfad3552f87a4f8dc50d61d4f4e33" -dependencies = [ - "bitflags 1.3.2", - "core-foundation", - "libc", -] - -[[package]] -name = "coreaudio-rs" -version = "0.11.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "321077172d79c662f64f5071a03120748d5bb652f5231570141be24cfcd2bace" -dependencies = [ - "bitflags 1.3.2", - "core-foundation-sys", - "coreaudio-sys", -] - -[[package]] -name = "coreaudio-sys" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8478e5bdad14dce236b9898ea002eabfa87cbe14f0aa538dbe3b6a4bec4332d" -dependencies = [ - "bindgen", -] - -[[package]] -name = "cpal" -version = "0.15.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d959d90e938c5493000514b446987c07aed46c668faaa7d34d6c7a67b1a578c" -dependencies = [ - "alsa", - "core-foundation-sys", - "coreaudio-rs", - "dasp_sample", - "jni 0.19.0", - "js-sys", - "libc", - "mach2", - "ndk", - "ndk-context", - "oboe", - "once_cell", - "parking_lot", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "windows 0.46.0", -] - -[[package]] -name = "crc32fast" -version = "1.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "crossbeam" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2801af0d36612ae591caa9568261fddce32ce6e08a7275ea334a06a4ad021a2c" -dependencies = [ - "cfg-if", - "crossbeam-channel", - "crossbeam-deque", - "crossbeam-epoch", - "crossbeam-queue", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-channel" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a33c2bf77f2df06183c3aa30d1e96c0695a313d4f9c453cc3762a6db39f99200" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-deque" -version = "0.8.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" -dependencies = [ - "cfg-if", - "crossbeam-epoch", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-epoch" -version = "0.9.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" -dependencies = [ - "autocfg", - "cfg-if", - "crossbeam-utils", - "memoffset 0.9.0", - "scopeguard", -] - -[[package]] -name = "crossbeam-queue" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" -dependencies = [ - "cfg-if", - "crossbeam-utils", -] - -[[package]] -name = "crossbeam-utils" -version = "0.8.16" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a22b2d63d4d1dc0b7f1b6b2747dd0088008a9be28b6ddf0b1e7d335e3037294" -dependencies = [ - "cfg-if", -] - -[[package]] -name = "d3d12" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e16e44ab292b1dddfdaf7be62cfd8877df52f2f3fde5858d95bab606be259f20" -dependencies = [ - "bitflags 2.4.1", - "libloading 0.8.1", - "winapi", -] - -[[package]] -name = "dasp_sample" -version = "0.11.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c87e182de0887fd5361989c677c4e8f5000cd9491d6d563161a8f3a5519fc7f" - -[[package]] -name = "data-encoding" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" - -[[package]] -name = "dispatch" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd0c93bb4b0c6d9b77f4435b0ae98c24d17f1c45b2ff844c6151a07256ca923b" - -[[package]] -name = "downcast-rs" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9ea835d29036a4087793836fa931b08837ad5e957da9e23886b29586fb9b6650" - -[[package]] -name = "duplicate" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de78e66ac9061e030587b2a2e75cc88f22304913c907b11307bca737141230cb" -dependencies = [ - "heck", - "proc-macro-error", -] - -[[package]] -name = "ecolor" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cfdf4e52dbbb615cfd30cf5a5265335c217b5fd8d669593cea74a517d9c605af" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "egui" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bd69fed5fcf4fbb8225b24e80ea6193b61e17a625db105ef0c4d71dde6eb8b7" -dependencies = [ - "ahash", - "epaint", - "nohash-hasher", -] - -[[package]] -name = "egui-gizmo" -version = "0.12.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f732ad247afe275d6cf901e0f134025ad735007c8f4d82e667a6871f1b4a5441" -dependencies = [ - "egui", - "glam", -] - -[[package]] -name = "egui_dock" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a52f67bcab0eb6050cf8051c614966c1c57129fab23dbeae9c157214779053c7" -dependencies = [ - "duplicate", - "egui", - "paste", -] - -[[package]] -name = "either" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a26ae43d7bcc3b814de94796a5e736d4029efb0ee900c12e2d54c993ad1a1e07" - -[[package]] -name = "emath" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ef2b29de53074e575c18b694167ccbe6e5191f7b25fe65175a0d905a32eeec0" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "encase" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fce2eeef77fd4a293a54b62aa00ac9daebfbcda4bf8998c5a815635b004aa1c" -dependencies = [ - "const_panic", - "encase_derive", - "glam", - "thiserror", -] - -[[package]] -name = "encase_derive" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e520cde08cbf4f7cc097f61573ec06ce467019803de8ae82fb2823fa1554a0e" -dependencies = [ - "encase_derive_impl", -] - -[[package]] -name = "encase_derive_impl" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fe2568f851fd6144a45fa91cfed8fe5ca8fc0b56ba6797bfc1ed2771b90e37c" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "epaint" -version = "0.23.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "58067b840d009143934d91d8dcb8ded054d8301d7c11a517ace0a99bb1e1595e" -dependencies = [ - "ab_glyph", - "ahash", - "bytemuck", - "ecolor", - "emath", - "nohash-hasher", - "parking_lot", -] - -[[package]] -name = "equivalent" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" - -[[package]] -name = "erased-serde" -version = "0.3.31" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c138974f9d5e7fe373eb04df7cae98833802ae4b11c24ac7039a21d5af4b26c" -dependencies = [ - "serde", -] - -[[package]] -name = "error-code" -version = "2.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64f18991e7bf11e7ffee451b5318b5c1a73c52d0d0ada6e5a3017c8c1ced6a21" -dependencies = [ - "libc", - "str-buf", -] - -[[package]] -name = "euclid" -version = "0.22.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f253bc5c813ca05792837a0ff4b3a580336b224512d48f7eda1d7dd9210787" -dependencies = [ - "num-traits", -] - -[[package]] -name = "event-listener" -version = "2.5.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0206175f82b8d6bf6652ff7d71a1e27fd2e4efde587fd368662814d6ec1d9ce0" - -[[package]] -name = "fastrand" -version = "1.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51093e27b0797c359783294ca4f0a911c270184cb10f85783b118614a1501be" -dependencies = [ - "instant", -] - -[[package]] -name = "fastrand" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25cbce373ec4653f1a01a31e8a5e5ec0c622dc27ff9c4e6606eefef5cbbed4a5" - -[[package]] -name = "fdeflate" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "64d6dafc854908ff5da46ff3f8f473c6984119a2876a383a860246dd7841a868" -dependencies = [ - "simd-adler32", -] - -[[package]] -name = "fixedbitset" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce7134b9999ecaf8bcd65542e436736ef32ddca1b3e06094cb6ec5755203b80" - -[[package]] -name = "flate2" -version = "1.0.28" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" -dependencies = [ - "crc32fast", - "miniz_oxide", -] - -[[package]] -name = "fnv" -version = "1.0.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" - -[[package]] -name = "foreign-types" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" -dependencies = [ - "foreign-types-shared 0.1.1", -] - -[[package]] -name = "foreign-types" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" -dependencies = [ - "foreign-types-macros", - "foreign-types-shared 0.3.1", -] - -[[package]] -name = "foreign-types-macros" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "foreign-types-shared" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" - -[[package]] -name = "foreign-types-shared" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" - -[[package]] -name = "form_urlencoded" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" -dependencies = [ - "percent-encoding", -] - -[[package]] -name = "futures-core" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" - -[[package]] -name = "futures-io" -version = "0.3.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" - -[[package]] -name = "futures-lite" -version = "1.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49a9d51ce47660b1e808d3c990b4709f2f415d928835a17dfd16991515c46bce" -dependencies = [ - "fastrand 1.9.0", - "futures-core", - "futures-io", - "memchr", - "parking", - "pin-project-lite", - "waker-fn", -] - -[[package]] -name = "gethostname" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ebd34e35c46e00bb73e81363248d627782724609fe1b6396f553f68fe3862e" -dependencies = [ - "libc", - "winapi", -] - -[[package]] -name = "getrandom" -version = "0.2.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" -dependencies = [ - "cfg-if", - "js-sys", - "libc", - "wasi", - "wasm-bindgen", -] - -[[package]] -name = "gilrs" -version = "0.10.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e9eec02069fcbd7abe00a28adf216547774889129a777cb5e53fdfb75d59f09" -dependencies = [ - "fnv", - "gilrs-core", - "log", - "uuid", - "vec_map", -] - -[[package]] -name = "gilrs-core" -version = "0.5.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e11f4e03be4f1beda399e4791c11d33102fa48f368e864259e4e810d3a3d2ff5" -dependencies = [ - "core-foundation", - "inotify", - "io-kit-sys", - "js-sys", - "libc", - "libudev-sys", - "log", - "nix 0.27.1", - "uuid", - "vec_map", - "wasm-bindgen", - "web-sys", - "windows 0.51.1", -] - -[[package]] -name = "gimli" -version = "0.28.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6fb8d784f27acf97159b40fc4db5ecd8aa23b9ad5ef69cdd136d3bc80665f0c0" - -[[package]] -name = "glam" -version = "0.24.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5418c17512bdf42730f9032c74e1ae39afc408745ebb2acf72fbc4691c17945" -dependencies = [ - "bytemuck", - "serde", -] - -[[package]] -name = "glob" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" - -[[package]] -name = "glow" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca0fe580e4b60a8ab24a868bc08e2f03cbcb20d3d676601fa909386713333728" -dependencies = [ - "js-sys", - "slotmap", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "gltf" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad2dcfb6dd7a66f9eb3d181a29dcfb22d146b0bcdc2e1ed1713cbf03939a88ea" -dependencies = [ - "byteorder", - "gltf-json", - "lazy_static", -] - -[[package]] -name = "gltf-derive" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2cbcea5dd47e7ad4e9ee6f040384fcd7204bbf671aa4f9e7ca7dfc9bfa1de20" -dependencies = [ - "inflections", - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "gltf-json" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5b810806b78dde4b71a95cc0e6fdcab34c4c617da3574df166f9987be97d03" -dependencies = [ - "gltf-derive", - "serde", - "serde_derive", - "serde_json", -] - -[[package]] -name = "glyph_brush_layout" -version = "0.2.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc32c2334f00ca5ac3695c5009ae35da21da8c62d255b5b96d56e2597a637a38" -dependencies = [ - "ab_glyph", - "approx", - "xi-unicode", -] - -[[package]] -name = "gpu-alloc" -version = "0.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbcd2dba93594b227a1f57ee09b8b9da8892c34d55aa332e034a228d0fe6a171" -dependencies = [ - "bitflags 2.4.1", - "gpu-alloc-types", -] - -[[package]] -name = "gpu-alloc-types" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98ff03b468aa837d70984d55f5d3f846f6ec31fe34bbb97c4f85219caeee1ca4" -dependencies = [ - "bitflags 2.4.1", -] - -[[package]] -name = "gpu-allocator" -version = "0.22.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce95f9e2e11c2c6fadfce42b5af60005db06576f231f5c92550fdded43c423e8" -dependencies = [ - "backtrace", - "log", - "thiserror", - "winapi", - "windows 0.44.0", -] - -[[package]] -name = "gpu-descriptor" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc11df1ace8e7e564511f53af41f3e42ddc95b56fd07b3f4445d2a6048bc682c" -dependencies = [ - "bitflags 2.4.1", - "gpu-descriptor-types", - "hashbrown 0.14.2", -] - -[[package]] -name = "gpu-descriptor-types" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bf0b36e6f090b7e1d8a4b49c0cb81c1f8376f72198c65dd3ad9ff3556b8b78c" -dependencies = [ - "bitflags 2.4.1", -] - -[[package]] -name = "grid" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eec1c01eb1de97451ee0d60de7d81cf1e72aabefb021616027f3d1c3ec1c723c" - -[[package]] -name = "guillotiere" -version = "0.6.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b62d5865c036cb1393e23c50693df631d3f5d7bcca4c04fe4cc0fd592e74a782" -dependencies = [ - "euclid", - "svg_fmt", -] - -[[package]] -name = "hashbrown" -version = "0.12.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a9ee70c43aaf417c914396645a0fa852624801b24ebb7ae78fe8272889ac888" - -[[package]] -name = "hashbrown" -version = "0.14.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f93e7192158dbcda357bdec5fb5788eebf8bbac027f3f33e719d29135ae84156" -dependencies = [ - "ahash", - "allocator-api2", - "serde", -] - -[[package]] -name = "hassle-rs" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1397650ee315e8891a0df210707f0fc61771b0cc518c3023896064c5407cb3b0" -dependencies = [ - "bitflags 1.3.2", - "com-rs", - "libc", - "libloading 0.7.4", - "thiserror", - "widestring", - "winapi", -] - -[[package]] -name = "heck" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" - -[[package]] -name = "hexasphere" -version = "9.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cb3df16a7bcb1b5bc092abd55e14f77ca70aea14445026e264586fc62889a10" -dependencies = [ - "constgebra", - "glam", -] - -[[package]] -name = "hexf-parse" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfa686283ad6dd069f105e5ab091b04c62850d3e4cf5d67debad1933f55023df" - -[[package]] -name = "home" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" -dependencies = [ - "windows-sys 0.48.0", -] - -[[package]] -name = "idna" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" -dependencies = [ - "unicode-bidi", - "unicode-normalization", -] - -[[package]] -name = "image" -version = "0.24.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f3dfdbdd72063086ff443e297b61695500514b1e41095b6fb9a5ab48a70a711" -dependencies = [ - "bytemuck", - "byteorder", - "color_quant", - "num-rational", - "num-traits", - "png", - "tiff", -] - -[[package]] -name = "indexmap" -version = "1.9.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd070e393353796e801d209ad339e89596eb4c8d430d18ede6a1cced8fafbd99" -dependencies = [ - "autocfg", - "hashbrown 0.12.3", - "serde", -] - -[[package]] -name = "indexmap" -version = "2.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d530e1a18b1cb4c484e6e34556a0d948706958449fca0cab753d649f2bce3d1f" -dependencies = [ - "equivalent", - "hashbrown 0.14.2", -] - -[[package]] -name = "inflections" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a257582fdcde896fd96463bf2d40eefea0580021c0712a0e2b028b60b47a837a" - -[[package]] -name = "inotify" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdd168d97690d0b8c412d6b6c10360277f4d7ee495c5d0d5d5fe0854923255cc" -dependencies = [ - "bitflags 1.3.2", - "futures-core", - "inotify-sys", - "libc", - "tokio", -] - -[[package]] -name = "inotify-sys" -version = "0.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e05c02b5e89bff3b946cedeca278abc628fe811e604f027c45a8aa3cf793d0eb" -dependencies = [ - "libc", -] - -[[package]] -name = "instant" -version = "0.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "io-kit-sys" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4769cb30e5dcf1710fc6730d3e94f78c47723a014a567de385e113c737394640" -dependencies = [ - "core-foundation-sys", - "mach2", -] - -[[package]] -name = "itoa" -version = "1.0.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af150ab688ff2122fcef229be89cb50dd66af9e01a4ff320cc137eecc9bacc38" - -[[package]] -name = "jni" -version = "0.19.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6df18c2e3db7e453d3c6ac5b3e9d5182664d28788126d39b91f2d1e22b017ec" -dependencies = [ - "cesu8", - "combine", - "jni-sys", - "log", - "thiserror", - "walkdir", -] - -[[package]] -name = "jni" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "039022cdf4d7b1cf548d31f60ae783138e5fd42013f6271049d7df7afadef96c" -dependencies = [ - "cesu8", - "combine", - "jni-sys", - "log", - "thiserror", - "walkdir", -] - -[[package]] -name = "jni" -version = "0.21.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a87aa2bb7d2af34197c04845522473242e1aa17c12f4935d5856491a7fb8c97" -dependencies = [ - "cesu8", - "cfg-if", - "combine", - "jni-sys", - "log", - "thiserror", - "walkdir", - "windows-sys 0.45.0", -] - -[[package]] -name = "jni-sys" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" - -[[package]] -name = "jobserver" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c37f63953c4c63420ed5fd3d6d398c719489b9f872b9fa683262f8edd363c7d" -dependencies = [ - "libc", -] - -[[package]] -name = "jpeg-decoder" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc0000e42512c92e31c2252315bda326620a4e034105e900c98ec492fa077b3e" - -[[package]] -name = "js-sys" -version = "0.3.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" -dependencies = [ - "wasm-bindgen", -] - -[[package]] -name = "khronos-egl" -version = "4.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c2352bd1d0bceb871cb9d40f24360c8133c11d7486b68b5381c1dd1a32015e3" -dependencies = [ - "libc", - "libloading 0.7.4", - "pkg-config", -] - -[[package]] -name = "ktx2" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87d65e08a9ec02e409d27a0139eaa6b9756b4d81fe7cde71f6941a83730ce838" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "lazy_static" -version = "1.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" - -[[package]] -name = "lewton" -version = "0.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "777b48df9aaab155475a83a7df3070395ea1ac6902f5cd062b8f2b028075c030" -dependencies = [ - "byteorder", - "ogg", - "tinyvec", -] - -[[package]] -name = "libc" -version = "0.2.150" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89d92a4743f9a61002fae18374ed11e7973f530cb3a3255fb354818118b2203c" - -[[package]] -name = "libloading" -version = "0.7.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67380fd3b2fbe7527a606e18729d21c6f3951633d0500574c4dc22d2d638b9f" -dependencies = [ - "cfg-if", - "winapi", -] - -[[package]] -name = "libloading" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c571b676ddfc9a8c12f1f3d3085a7b163966a8fd8098a90640953ce5f6170161" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - -[[package]] -name = "libm" -version = "0.2.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" - -[[package]] -name = "libredox" -version = "0.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3af92c55d7d839293953fcd0fda5ecfe93297cfde6ffbdec13b41d99c0ba6607" -dependencies = [ - "bitflags 2.4.1", - "libc", - "redox_syscall 0.4.1", -] - -[[package]] -name = "libudev-sys" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c8469b4a23b962c1396b9b451dda50ef5b283e8dd309d69033475fa9b334324" -dependencies = [ - "libc", - "pkg-config", -] - -[[package]] -name = "lock_api" -version = "0.4.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c168f8615b12bc01f9c17e2eb0cc07dcae1940121185446edc3744920e8ef45" -dependencies = [ - "autocfg", - "scopeguard", -] - -[[package]] -name = "log" -version = "0.4.20" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" - -[[package]] -name = "mach2" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d0d1830bcd151a6fc4aea1369af235b36c1528fe976b8ff678683c9995eade8" -dependencies = [ - "libc", -] - -[[package]] -name = "malloc_buf" -version = "0.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" -dependencies = [ - "libc", -] - -[[package]] -name = "matchers" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8263075bb86c5a1b1427b5ae862e8889656f126e9f77c484496e8b47cf5c5558" -dependencies = [ - "regex-automata 0.1.10", -] - -[[package]] -name = "matrixmultiply" -version = "0.3.8" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7574c1cf36da4798ab73da5b215bbf444f50718207754cb522201d78d1cd0ff2" -dependencies = [ - "autocfg", - "rawpointer", -] - -[[package]] -name = "memchr" -version = "2.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" - -[[package]] -name = "memoffset" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5aa361d4faea93603064a027415f07bd8e1d5c88c9fbf68bf56a285428fd79ce" -dependencies = [ - "autocfg", -] - -[[package]] -name = "memoffset" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" -dependencies = [ - "autocfg", -] - -[[package]] -name = "metal" -version = "0.26.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "623b5e6cefd76e58f774bd3cc0c6f5c7615c58c03a97815245a25c3c9bdee318" -dependencies = [ - "bitflags 2.4.1", - "block", - "core-graphics-types", - "foreign-types 0.5.0", - "log", - "objc", - "paste", -] - -[[package]] -name = "minimal-lexical" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" - -[[package]] -name = "miniz_oxide" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" -dependencies = [ - "adler", - "simd-adler32", -] - -[[package]] -name = "mio" -version = "0.8.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dce281c5e46beae905d4de1870d8b1509a9142b62eedf18b443b011ca8343d0" -dependencies = [ - "libc", - "log", - "wasi", - "windows-sys 0.48.0", -] - -[[package]] -name = "naga" -version = "0.13.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ceaaa4eedaece7e4ec08c55c640ba03dbb73fb812a6570a59bcf1930d0f70e" -dependencies = [ - "bit-set", - "bitflags 2.4.1", - "codespan-reporting", - "hexf-parse", - "indexmap 1.9.3", - "log", - "num-traits", - "pp-rs", - "rustc-hash", - "spirv", - "termcolor", - "thiserror", - "unicode-xid", -] - -[[package]] -name = "naga_oil" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1fa9518ff79ae8a98c3abe3897d873a85561d1b5642981c2245c1c4b9b2429d" -dependencies = [ - "bit-set", - "codespan-reporting", - "data-encoding", - "indexmap 1.9.3", - "naga", - "once_cell", - "regex", - "regex-syntax 0.7.5", - "rustc-hash", - "thiserror", - "tracing", - "unicode-ident", -] - -[[package]] -name = "nalgebra" -version = "0.32.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "307ed9b18cc2423f29e83f84fd23a8e73628727990181f18641a8b5dc2ab1caa" -dependencies = [ - "approx", - "glam", - "matrixmultiply", - "nalgebra-macros", - "num-complex", - "num-rational", - "num-traits", - "serde", - "simba", - "typenum", -] - -[[package]] -name = "nalgebra-macros" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "91761aed67d03ad966ef783ae962ef9bbaca728d2dd7ceb7939ec110fffad998" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "ndk" -version = "0.7.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "451422b7e4718271c8b5b3aadf5adedba43dc76312454b387e98fae0fc951aa0" -dependencies = [ - "bitflags 1.3.2", - "jni-sys", - "ndk-sys", - "num_enum 0.5.11", - "raw-window-handle", - "thiserror", -] - -[[package]] -name = "ndk-context" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b02d87554356db9e9a873add8782d4ea6e3e58ea071a9adb9a2e8ddb884a8b" - -[[package]] -name = "ndk-sys" -version = "0.4.1+23.1.7779620" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cf2aae958bd232cac5069850591667ad422d263686d75b52a065f9badeee5a3" -dependencies = [ - "jni-sys", -] - -[[package]] -name = "nix" -version = "0.24.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fa52e972a9a719cecb6864fb88568781eb706bac2cd1d4f04a648542dbf78069" -dependencies = [ - "bitflags 1.3.2", - "cfg-if", - "libc", - "memoffset 0.6.5", -] - -[[package]] -name = "nix" -version = "0.27.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2eb04e9c688eff1c89d72b407f168cf79bb9e867a9d3323ed6c01519eb9cc053" -dependencies = [ - "bitflags 2.4.1", - "cfg-if", - "libc", -] - -[[package]] -name = "nohash-hasher" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2bf50223579dc7cdcfb3bfcacf7069ff68243f8c363f62ffa99cf000a6b9c451" - -[[package]] -name = "nom" -version = "7.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" -dependencies = [ - "memchr", - "minimal-lexical", -] - -[[package]] -name = "nonmax" -version = "0.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6e4a593ea4fffed8684ad13d75c82cf0b6dc2b88947e0ed85b9e70f555a7e422" - -[[package]] -name = "normpath" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec60c60a693226186f5d6edf073232bfb6464ed97eb22cf3b01c1e8198fd97f5" -dependencies = [ - "windows-sys 0.48.0", -] - -[[package]] -name = "ntapi" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8a3895c6391c39d7fe7ebc444a87eb2991b2a0bc718fdabd071eec617fc68e4" -dependencies = [ - "winapi", -] - -[[package]] -name = "nu-ansi-term" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" -dependencies = [ - "overload", - "winapi", -] - -[[package]] -name = "num-complex" -version = "0.4.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ba157ca0885411de85d6ca030ba7e2a83a28636056c7c699b07c8b6f7383214" -dependencies = [ - "num-traits", - "serde", -] - -[[package]] -name = "num-derive" -version = "0.3.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "876a53fff98e03a936a674b29568b0e605f06b29372c2489ff4de23f1949743d" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "num-integer" -version = "0.1.45" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "225d3389fb3509a24c93f5c29eb6bde2586b98d9f016636dff58d7c6f7569cd9" -dependencies = [ - "autocfg", - "num-traits", -] - -[[package]] -name = "num-rational" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0638a1c9d0a3c0914158145bc76cff373a75a627e6ecbfb71cbe6f453a5a19b0" -dependencies = [ - "autocfg", - "num-integer", - "num-traits", -] - -[[package]] -name = "num-traits" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "39e3200413f237f41ab11ad6d161bc7239c84dcb631773ccd7de3dfe4b5c267c" -dependencies = [ - "autocfg", - "libm", -] - -[[package]] -name = "num_enum" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f646caf906c20226733ed5b1374287eb97e3c2a5c227ce668c1f2ce20ae57c9" -dependencies = [ - "num_enum_derive 0.5.11", -] - -[[package]] -name = "num_enum" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" -dependencies = [ - "num_enum_derive 0.6.1", -] - -[[package]] -name = "num_enum_derive" -version = "0.5.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcbff9bc912032c62bf65ef1d5aea88983b420f4f839db1e9b0c281a25c9c799" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "num_enum_derive" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" -dependencies = [ - "proc-macro-crate", - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "objc" -version = "0.2.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" -dependencies = [ - "malloc_buf", - "objc_exception", -] - -[[package]] -name = "objc-foundation" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1add1b659e36c9607c7aab864a76c7a4c2760cd0cd2e120f3fb8b952c7e22bf9" -dependencies = [ - "block", - "objc", - "objc_id", -] - -[[package]] -name = "objc-sys" -version = "0.2.0-beta.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3b9834c1e95694a05a828b59f55fa2afec6288359cda67146126b3f90a55d7" - -[[package]] -name = "objc2" -version = "0.3.0-beta.3.patch-leaks.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7e01640f9f2cb1220bbe80325e179e532cb3379ebcd1bf2279d703c19fe3a468" -dependencies = [ - "block2", - "objc-sys", - "objc2-encode", -] - -[[package]] -name = "objc2-encode" -version = "2.0.0-pre.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abfcac41015b00a120608fdaa6938c44cb983fee294351cc4bac7638b4e50512" -dependencies = [ - "objc-sys", -] - -[[package]] -name = "objc_exception" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad970fb455818ad6cba4c122ad012fae53ae8b4795f86378bce65e4f6bab2ca4" -dependencies = [ - "cc", -] - -[[package]] -name = "objc_id" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c92d4ddb4bd7b50d730c215ff871754d0da6b2178849f8a2a2ab69712d0c073b" -dependencies = [ - "objc", -] - -[[package]] -name = "object" -version = "0.32.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" -dependencies = [ - "memchr", -] - -[[package]] -name = "oboe" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8868cc237ee02e2d9618539a23a8d228b9bb3fc2e7a5b11eed3831de77c395d0" -dependencies = [ - "jni 0.20.0", - "ndk", - "ndk-context", - "num-derive", - "num-traits", - "oboe-sys", -] - -[[package]] -name = "oboe-sys" -version = "0.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f44155e7fb718d3cfddcf70690b2b51ac4412f347cd9e4fbe511abe9cd7b5f2" -dependencies = [ - "cc", -] - -[[package]] -name = "ogg" -version = "0.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6951b4e8bf21c8193da321bcce9c9dd2e13c858fe078bf9054a288b419ae5d6e" -dependencies = [ - "byteorder", -] - -[[package]] -name = "once_cell" -version = "1.18.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" - -[[package]] -name = "opener" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c62dcb6174f9cb326eac248f07e955d5d559c272730b6c03e396b443b562788" -dependencies = [ - "bstr", - "normpath", - "winapi", -] - -[[package]] -name = "orbclient" -version = "0.3.47" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52f0d54bde9774d3a51dcf281a5def240c71996bc6ca05d2c847ec8b2b216166" -dependencies = [ - "libredox", -] - -[[package]] -name = "overload" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" - -[[package]] -name = "owned_ttf_parser" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d4586edfe4c648c71797a74c84bacb32b52b212eff5dfe2bb9f2c599844023e7" -dependencies = [ - "ttf-parser", -] - -[[package]] -name = "parking" -version = "2.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb813b8af86854136c6922af0598d719255ecb2179515e6e7730d468f05c9cae" - -[[package]] -name = "parking_lot" -version = "0.12.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3742b2c103b9f06bc9fff0a37ff4912935851bee6d36f3c02bcc755bcfec228f" -dependencies = [ - "lock_api", - "parking_lot_core", -] - -[[package]] -name = "parking_lot_core" -version = "0.9.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c42a9226546d68acdd9c0a280d17ce19bfe27a46bf68784e4066115788d008e" -dependencies = [ - "cfg-if", - "libc", - "redox_syscall 0.4.1", - "smallvec", - "windows-targets 0.48.5", -] - -[[package]] -name = "parry3d" -version = "0.13.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b55dc0e6db79bddbc5fd583569f7356cdcc63e1e9b2b93a9ab70dd8e717160e0" -dependencies = [ - "approx", - "arrayvec", - "bitflags 1.3.2", - "downcast-rs", - "either", - "indexmap 1.9.3", - "nalgebra", - "num-derive", - "num-traits", - "rustc-hash", - "serde", - "simba", - "slab", - "smallvec", - "spade", -] - -[[package]] -name = "paste" -version = "1.0.14" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "de3145af08024dea9fa9914f381a17b8fc6034dfb00f3a84013f7ff43f29ed4c" - -[[package]] -name = "path-slash" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e91099d4268b0e11973f036e885d652fb0b21fedcf69738c627f94db6a44f42" - -[[package]] -name = "peeking_take_while" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "19b17cddbe7ec3f8bc800887bab5e717348c95ea2ca0b1bf0837fb964dc67099" - -[[package]] -name = "percent-encoding" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" - -[[package]] -name = "petgraph" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1d3afd2628e69da2be385eb6f2fd57c8ac7977ceeff6dc166ff1657b0e386a9" -dependencies = [ - "fixedbitset", - "indexmap 2.1.0", -] - -[[package]] -name = "pin-project-lite" -version = "0.2.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8afb450f006bf6385ca15ef45d71d2288452bc3683ce2e2cacc0d18e4be60b58" - -[[package]] -name = "piper" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "668d31b1c4eba19242f2088b2bf3316b82ca31082a8335764db4e083db7485d4" -dependencies = [ - "atomic-waker", - "fastrand 2.0.1", - "futures-io", -] - -[[package]] -name = "pkg-config" -version = "0.3.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" - -[[package]] -name = "png" -version = "0.17.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd75bf2d8dd3702b9707cdbc56a5b9ef42cec752eb8b3bafc01234558442aa64" -dependencies = [ - "bitflags 1.3.2", - "crc32fast", - "fdeflate", - "flate2", - "miniz_oxide", -] - -[[package]] -name = "pp-rs" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb458bb7f6e250e6eb79d5026badc10a3ebb8f9a15d1fff0f13d17c71f4d6dee" -dependencies = [ - "unicode-xid", -] - -[[package]] -name = "ppv-lite86" -version = "0.2.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b40af805b3121feab8a3c29f04d8ad262fa8e0561883e7653e024ae4479e6de" - -[[package]] -name = "pretty-type-name" -version = "1.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f0f73cdaf19b52e6143685c3606206e114a4dfa969d6b14ec3894c88eb38bd4b" - -[[package]] -name = "proc-macro-crate" -version = "1.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f4c021e1093a56626774e81216a4ce732a735e5bad4868a03f3ed65ca0c3919" -dependencies = [ - "once_cell", - "toml_edit 0.19.15", -] - -[[package]] -name = "proc-macro-error" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" -dependencies = [ - "proc-macro-error-attr", - "proc-macro2", - "quote", - "syn 1.0.109", - "version_check", -] - -[[package]] -name = "proc-macro-error-attr" -version = "1.0.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" -dependencies = [ - "proc-macro2", - "quote", - "version_check", -] - -[[package]] -name = "proc-macro2" -version = "1.0.69" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" -dependencies = [ - "unicode-ident", -] - -[[package]] -name = "profiling" -version = "1.0.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f89dff0959d98c9758c88826cc002e2c3d0b9dfac4139711d1f30de442f1139b" - -[[package]] -name = "quote" -version = "1.0.33" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" -dependencies = [ - "proc-macro2", -] - -[[package]] -name = "radsort" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17fd96390ed3feda12e1dfe2645ed587e0bea749e319333f104a33ff62f77a0b" - -[[package]] -name = "rand" -version = "0.8.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" -dependencies = [ - "libc", - "rand_chacha", - "rand_core", -] - -[[package]] -name = "rand_chacha" -version = "0.3.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" -dependencies = [ - "ppv-lite86", - "rand_core", -] - -[[package]] -name = "rand_core" -version = "0.6.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" -dependencies = [ - "getrandom", -] - -[[package]] -name = "range-alloc" -version = "0.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8a99fddc9f0ba0a85884b8d14e3592853e787d581ca1816c91349b10e4eeab" - -[[package]] -name = "rapier3d" -version = "0.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "62a8a0bd9d3135f7b4eb45d0796540e7bab47b6b7c974f90567ccc5a0454f42b" -dependencies = [ - "approx", - "arrayvec", - "bit-vec", - "bitflags 1.3.2", - "crossbeam", - "downcast-rs", - "nalgebra", - "num-derive", - "num-traits", - "parry3d", - "rustc-hash", - "serde", - "simba", -] - -[[package]] -name = "raw-window-handle" -version = "0.5.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f2ff9a1f06a88b01621b7ae906ef0211290d1c8a168a15542486a8f61c0833b9" - -[[package]] -name = "rawpointer" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "60a357793950651c4ed0f3f52338f53b2f809f32d83a07f72909fa13e4c6c1e3" - -[[package]] -name = "rectangle-pack" -version = "0.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0d463f2884048e7153449a55166f91028d5b0ea53c79377099ce4e8cf0cf9bb" - -[[package]] -name = "redox_syscall" -version = "0.3.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "567664f262709473930a4bf9e51bf2ebf3348f2e748ccc50dea20646858f8f29" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "redox_syscall" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" -dependencies = [ - "bitflags 1.3.2", -] - -[[package]] -name = "regex" -version = "1.10.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "380b951a9c5e80ddfd6136919eef32310721aa4aacd4889a8d39124b026ab343" -dependencies = [ - "aho-corasick", - "memchr", - "regex-automata 0.4.3", - "regex-syntax 0.8.2", -] - -[[package]] -name = "regex-automata" -version = "0.1.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c230d73fb8d8c1b9c0b3135c5142a8acee3a0558fb8db5cf1cb65f8d7862132" -dependencies = [ - "regex-syntax 0.6.29", -] - -[[package]] -name = "regex-automata" -version = "0.4.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f804c7828047e88b2d32e2d7fe5a105da8ee3264f01902f796c8e067dc2483f" -dependencies = [ - "aho-corasick", - "memchr", - "regex-syntax 0.8.2", -] - -[[package]] -name = "regex-syntax" -version = "0.6.29" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" - -[[package]] -name = "regex-syntax" -version = "0.7.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dbb5fb1acd8a1a18b3dd5be62d25485eb770e05afb408a9627d14d451bae12da" - -[[package]] -name = "regex-syntax" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" - -[[package]] -name = "renderdoc-sys" -version = "1.0.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216080ab382b992234dda86873c18d4c48358f5cfcb70fd693d7f6f2131b628b" - -[[package]] -name = "robust" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cbf4a6aa5f6d6888f39e980649f3ad6b666acdce1d78e95b8a2cb076e687ae30" - -[[package]] -name = "rodio" -version = "0.17.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3b1bb7b48ee48471f55da122c0044fcc7600cfcc85db88240b89cb832935e611" -dependencies = [ - "cpal", - "lewton", -] - -[[package]] -name = "ron" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b91f7eff05f748767f183df4320a63d6936e9c6107d97c9e6bdd9784f4289c94" -dependencies = [ - "base64 0.21.5", - "bitflags 2.4.1", - "serde", - "serde_derive", -] - -[[package]] -name = "rustc-demangle" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" - -[[package]] -name = "rustc-hash" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" - -[[package]] -name = "ruzstd" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3ffab8f9715a0d455df4bbb9d21e91135aab3cd3ca187af0cd0c3c3f868fdc" -dependencies = [ - "byteorder", - "thiserror-core", - "twox-hash", -] - -[[package]] -name = "ryu" -version = "1.0.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ad4cc8da4ef723ed60bced201181d83791ad433213d8c24efffda1eec85d741" - -[[package]] -name = "safe_arch" -version = "0.7.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f398075ce1e6a179b46f51bd88d0598b92b00d3551f1a2d4ac49e771b56ac354" -dependencies = [ - "bytemuck", -] - -[[package]] -name = "same-file" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "93fc1dc3aaa9bfed95e02e6eadabb4baf7e3078b0bd1b4d7b6b0b68378900502" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "scopeguard" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" - -[[package]] -name = "serde" -version = "1.0.192" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bca2a08484b285dcb282d0f67b26cadc0df8b19f8c12502c13d966bf9482f001" -dependencies = [ - "serde_derive", -] - -[[package]] -name = "serde_derive" -version = "1.0.192" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6c7207fbec9faa48073f3e3074cbe553af6ea512d7c21ba46e434e70ea9fbc1" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "serde_json" -version = "1.0.108" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" -dependencies = [ - "itoa", - "ryu", - "serde", -] - -[[package]] -name = "sharded-slab" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" -dependencies = [ - "lazy_static", -] - -[[package]] -name = "shlex" -version = "1.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a7cee0529a6d40f580e7a5e6c495c8fbfe21b7b52795ed4bb5e62cdf92bc6380" - -[[package]] -name = "simba" -version = "0.8.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "061507c94fc6ab4ba1c9a0305018408e312e17c041eb63bef8aa726fa33aceae" -dependencies = [ - "approx", - "libm", - "num-complex", - "num-traits", - "paste", - "wide", -] - -[[package]] -name = "simd-adler32" -version = "0.3.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d66dc143e6b11c1eddc06d5c423cfc97062865baf299914ab64caa38182078fe" - -[[package]] -name = "slab" -version = "0.4.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" -dependencies = [ - "autocfg", -] - -[[package]] -name = "slotmap" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1e08e261d0e8f5c43123b7adf3e4ca1690d655377ac93a03b2c9d3e98de1342" -dependencies = [ - "version_check", -] - -[[package]] -name = "smallvec" -version = "1.11.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dccd0940a2dcdf68d092b8cbab7dc0ad8fa938bf95787e1b916b0e3d0e8e970" -dependencies = [ - "serde", -] - -[[package]] -name = "smol_str" -version = "0.2.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "74212e6bbe9a4352329b2f68ba3130c15a3f26fe88ff22dbdc6cdd58fa85e99c" -dependencies = [ - "serde", -] - -[[package]] -name = "socket2" -version = "0.5.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b5fac59a5cb5dd637972e5fca70daf0523c9067fcdc4842f053dae04a18f8e9" -dependencies = [ - "libc", - "windows-sys 0.48.0", -] - -[[package]] -name = "spade" -version = "2.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c39e369d9638e42586b226e67df08a7358d1e02eb80629d596b944b7c16f44f" -dependencies = [ - "hashbrown 0.14.2", - "num-traits", - "robust", - "smallvec", -] - -[[package]] -name = "spirv" -version = "0.2.0+1.5.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "246bfa38fe3db3f1dfc8ca5a2cdeb7348c78be2112740cc0ec8ef18b6d94f830" -dependencies = [ - "bitflags 1.3.2", - "num-traits", -] - -[[package]] -name = "static_assertions" -version = "1.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" - -[[package]] -name = "str-buf" -version = "1.0.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e08d8363704e6c71fc928674353e6b7c23dcea9d82d7012c8faf2a3a025f8d0" - -[[package]] -name = "svg_fmt" -version = "0.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fb1df15f412ee2e9dfc1c504260fa695c1c3f10fe9f4a6ee2d2184d7d6450e2" - -[[package]] -name = "syn" -version = "1.0.109" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "syn" -version = "2.0.39" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23e78b90f2fcf45d3e842032ce32e3f2d1545ba6636271dcbf24fa306d87be7a" -dependencies = [ - "proc-macro2", - "quote", - "unicode-ident", -] - -[[package]] -name = "sysinfo" -version = "0.29.10" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0a18d114d420ada3a891e6bc8e96a2023402203296a47cdd65083377dad18ba5" -dependencies = [ - "cfg-if", - "core-foundation-sys", - "libc", - "ntapi", - "once_cell", - "winapi", -] - -[[package]] -name = "taffy" -version = "0.3.18" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c2287b6d7f721ada4cddf61ade5e760b2c6207df041cac9bfaa192897362fd3" -dependencies = [ - "arrayvec", - "grid", - "num-traits", - "slotmap", -] - -[[package]] -name = "termcolor" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6093bad37da69aab9d123a8091e4be0aa4a03e4d601ec641c327398315f62b64" -dependencies = [ - "winapi-util", -] - -[[package]] -name = "thiserror" -version = "1.0.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" -dependencies = [ - "thiserror-impl", -] - -[[package]] -name = "thiserror-core" -version = "1.0.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d97345f6437bb2004cd58819d8a9ef8e36cdd7661c2abc4bbde0a7c40d9f497" -dependencies = [ - "thiserror-core-impl", -] - -[[package]] -name = "thiserror-core-impl" -version = "1.0.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "10ac1c5050e43014d16b2f94d0d2ce79e65ffdd8b38d8048f9c8f6a8a6da62ac" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "thiserror-impl" -version = "1.0.50" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "thread_local" -version = "1.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3fdd6f064ccff2d6567adcb3873ca630700f00b5ad3f060c25b5dcfd9a4ce152" -dependencies = [ - "cfg-if", - "once_cell", -] - -[[package]] -name = "tiff" -version = "0.9.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d172b0f4d3fba17ba89811858b9d3d97f928aece846475bbda076ca46736211" -dependencies = [ - "flate2", - "jpeg-decoder", - "weezl", -] - -[[package]] -name = "tinyvec" -version = "1.6.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - -[[package]] -name = "tokio" -version = "1.34.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0c014766411e834f7af5b8f4cf46257aab4036ca95e9d2c144a10f59ad6f5b9" -dependencies = [ - "backtrace", - "libc", - "mio", - "pin-project-lite", - "socket2", - "windows-sys 0.48.0", -] - -[[package]] -name = "toml_datetime" -version = "0.6.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" - -[[package]] -name = "toml_edit" -version = "0.19.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1b5bb770da30e5cbfde35a2d7b9b8a2c4b8ef89548a7a6aeab5c9a576e3e7421" -dependencies = [ - "indexmap 2.1.0", - "toml_datetime", - "winnow", -] - -[[package]] -name = "toml_edit" -version = "0.20.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "70f427fce4d84c72b5b732388bf4a9f4531b53f74e2887e3ecb2481f68f66d81" -dependencies = [ - "indexmap 2.1.0", - "toml_datetime", - "winnow", -] - -[[package]] -name = "tracing" -version = "0.1.40" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" -dependencies = [ - "pin-project-lite", - "tracing-attributes", - "tracing-core", -] - -[[package]] -name = "tracing-attributes" -version = "0.1.27" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - -[[package]] -name = "tracing-core" -version = "0.1.32" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" -dependencies = [ - "once_cell", - "valuable", -] - -[[package]] -name = "tracing-log" -version = "0.1.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f751112709b4e791d8ce53e32c4ed2d353565a795ce84da2285393f41557bdf2" -dependencies = [ - "log", - "once_cell", - "tracing-core", -] - -[[package]] -name = "tracing-subscriber" -version = "0.3.17" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30a651bc37f915e81f087d86e62a18eec5f79550c7faff886f7090b4ea757c77" -dependencies = [ - "matchers", - "nu-ansi-term", - "once_cell", - "regex", - "sharded-slab", - "smallvec", - "thread_local", - "tracing", - "tracing-core", - "tracing-log", -] - -[[package]] -name = "tracing-wasm" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4575c663a174420fa2d78f4108ff68f65bf2fbb7dd89f33749b6e826b3626e07" -dependencies = [ - "tracing", - "tracing-subscriber", - "wasm-bindgen", -] - -[[package]] -name = "ttf-parser" -version = "0.20.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17f77d76d837a7830fe1d4f12b7b4ba4192c1888001c7164257e4bc6d21d96b4" - -[[package]] -name = "twox-hash" -version = "1.6.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "97fee6b57c6a41524a810daee9286c02d7752c4253064d0b05472833a438f675" -dependencies = [ - "cfg-if", - "static_assertions", -] - -[[package]] -name = "typenum" -version = "1.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" - -[[package]] -name = "unicode-bidi" -version = "0.3.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" - -[[package]] -name = "unicode-ident" -version = "1.0.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" - -[[package]] -name = "unicode-normalization" -version = "0.1.22" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c5713f0fc4b5db668a2ac63cdb7bb4469d8c9fed047b1d0292cc7b0ce2ba921" -dependencies = [ - "tinyvec", -] - -[[package]] -name = "unicode-width" -version = "0.1.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e51733f11c9c4f72aa0c160008246859e340b00807569a0da0e7a1079b27ba85" - -[[package]] -name = "unicode-xid" -version = "0.2.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" - -[[package]] -name = "url" -version = "2.4.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "143b538f18257fac9cad154828a57c6bf5157e1aa604d4816b5995bf6de87ae5" -dependencies = [ - "form_urlencoded", - "idna", - "percent-encoding", -] - -[[package]] -name = "uuid" -version = "1.5.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ad59a7560b41a70d191093a945f0b87bc1deeda46fb237479708a1d6b6cdfc" -dependencies = [ - "getrandom", - "serde", -] - -[[package]] -name = "valuable" -version = "0.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" - -[[package]] -name = "vec_map" -version = "0.8.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1bddf1187be692e79c5ffeab891132dfb0f236ed36a43c7ed39f1165ee20191" - -[[package]] -name = "version_check" -version = "0.9.4" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" - -[[package]] -name = "waker-fn" -version = "1.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3c4517f54858c779bbcbf228f4fca63d121bf85fbecb2dc578cdf4a39395690" - -[[package]] -name = "walkdir" -version = "2.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d71d857dc86794ca4c280d616f7da00d2dbfd8cd788846559a6813e6aa4b54ee" -dependencies = [ - "same-file", - "winapi-util", -] - -[[package]] -name = "wasi" -version = "0.11.0+wasi-snapshot-preview1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" - -[[package]] -name = "wasm-bindgen" -version = "0.2.88" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" -dependencies = [ - "cfg-if", - "wasm-bindgen-macro", -] - -[[package]] -name = "wasm-bindgen-backend" -version = "0.2.88" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" -dependencies = [ - "bumpalo", - "log", - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.39", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-futures" -version = "0.4.38" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" -dependencies = [ - "cfg-if", - "js-sys", - "wasm-bindgen", - "web-sys", -] - -[[package]] -name = "wasm-bindgen-macro" -version = "0.2.88" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" -dependencies = [ - "quote", - "wasm-bindgen-macro-support", -] - -[[package]] -name = "wasm-bindgen-macro-support" -version = "0.2.88" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", - "wasm-bindgen-backend", - "wasm-bindgen-shared", -] - -[[package]] -name = "wasm-bindgen-shared" -version = "0.2.88" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" - -[[package]] -name = "wayland-scanner" -version = "0.29.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f4303d8fa22ab852f789e75a967f0a2cdc430a607751c0499bada3e451cbd53" -dependencies = [ - "proc-macro2", - "quote", - "xml-rs", -] - -[[package]] -name = "web-sys" -version = "0.3.65" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" -dependencies = [ - "js-sys", - "wasm-bindgen", -] - -[[package]] -name = "webbrowser" -version = "0.8.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82b2391658b02c27719fc5a0a73d6e696285138e8b12fba9d4baa70451023c71" -dependencies = [ - "core-foundation", - "home", - "jni 0.21.1", - "log", - "ndk-context", - "objc", - "raw-window-handle", - "url", - "web-sys", -] - -[[package]] -name = "weezl" -version = "0.1.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9193164d4de03a926d909d3bc7c30543cecb35400c02114792c2cae20d5e2dbb" - -[[package]] -name = "wgpu" -version = "0.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed547920565c56c7a29afb4538ac5ae5048865a5d2f05bff3ad4fbeb921a9a2c" -dependencies = [ - "arrayvec", - "cfg-if", - "js-sys", - "log", - "naga", - "parking_lot", - "profiling", - "raw-window-handle", - "smallvec", - "static_assertions", - "wasm-bindgen", - "wasm-bindgen-futures", - "web-sys", - "wgpu-core", - "wgpu-hal", - "wgpu-types", -] - -[[package]] -name = "wgpu-core" -version = "0.17.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f8a44dd301a30ceeed3c27d8c0090433d3da04d7b2a4042738095a424d12ae7" -dependencies = [ - "arrayvec", - "bit-vec", - "bitflags 2.4.1", - "codespan-reporting", - "log", - "naga", - "parking_lot", - "profiling", - "raw-window-handle", - "rustc-hash", - "smallvec", - "thiserror", - "web-sys", - "wgpu-hal", - "wgpu-types", -] - -[[package]] -name = "wgpu-hal" -version = "0.17.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a80bf0e3c77399bb52850cb0830af9bad073d5cfcb9dd8253bef8125c42db17" -dependencies = [ - "android_system_properties", - "arrayvec", - "ash", - "bit-set", - "bitflags 2.4.1", - "block", - "core-graphics-types", - "d3d12", - "glow", - "gpu-alloc", - "gpu-allocator", - "gpu-descriptor", - "hassle-rs", - "js-sys", - "khronos-egl", - "libc", - "libloading 0.8.1", - "log", - "metal", - "naga", - "objc", - "parking_lot", - "profiling", - "range-alloc", - "raw-window-handle", - "renderdoc-sys", - "rustc-hash", - "smallvec", - "thiserror", - "wasm-bindgen", - "web-sys", - "wgpu-types", - "winapi", -] - -[[package]] -name = "wgpu-types" -version = "0.17.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee64d7398d0c2f9ca48922c902ef69c42d000c759f3db41e355f4a570b052b67" -dependencies = [ - "bitflags 2.4.1", - "js-sys", - "web-sys", -] - -[[package]] -name = "wide" -version = "0.7.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c68938b57b33da363195412cfc5fc37c9ed49aa9cfe2156fde64b8d2c9498242" -dependencies = [ - "bytemuck", - "safe_arch", -] - -[[package]] -name = "widestring" -version = "1.0.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "653f141f39ec16bba3c5abe400a0c60da7468261cc2cbf36805022876bc721a8" - -[[package]] -name = "winapi" -version = "0.3.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" -dependencies = [ - "winapi-i686-pc-windows-gnu", - "winapi-x86_64-pc-windows-gnu", -] - -[[package]] -name = "winapi-i686-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" - -[[package]] -name = "winapi-util" -version = "0.1.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f29e6f9198ba0d26b4c9f07dbe6f9ed633e1f3d5b8b414090084349e46a52596" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-wsapoll" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c17110f57155602a80dca10be03852116403c9ff3cd25b079d666f2aa3df6e" -dependencies = [ - "winapi", -] - -[[package]] -name = "winapi-x86_64-pc-windows-gnu" -version = "0.4.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" - -[[package]] -name = "windows" -version = "0.44.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e745dab35a0c4c77aa3ce42d595e13d2003d6902d6b08c9ef5fc326d08da12b" -dependencies = [ - "windows-targets 0.42.2", -] - -[[package]] -name = "windows" -version = "0.46.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cdacb41e6a96a052c6cb63a144f24900236121c6f63f4f8219fef5977ecb0c25" -dependencies = [ - "windows-targets 0.42.2", -] - -[[package]] -name = "windows" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e686886bc078bc1b0b600cac0147aadb815089b6e4da64016cbd754b6342700f" -dependencies = [ - "windows-implement", - "windows-interface", - "windows-targets 0.48.5", -] - -[[package]] -name = "windows" -version = "0.51.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca229916c5ee38c2f2bc1e9d8f04df975b4bd93f9955dc69fabb5d91270045c9" -dependencies = [ - "windows-core", - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-core" -version = "0.51.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-implement" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e2ee588991b9e7e6c8338edf3333fbe4da35dc72092643958ebb43f0ab2c49c" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "windows-interface" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6fb8df20c9bcaa8ad6ab513f7b40104840c8867d5751126e4df3b08388d0cc7" -dependencies = [ - "proc-macro2", - "quote", - "syn 1.0.109", -] - -[[package]] -name = "windows-sys" -version = "0.45.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75283be5efb2831d37ea142365f009c02ec203cd29a3ebecbc093d52315b66d0" -dependencies = [ - "windows-targets 0.42.2", -] - -[[package]] -name = "windows-sys" -version = "0.48.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" -dependencies = [ - "windows-targets 0.48.5", -] - -[[package]] -name = "windows-targets" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e5180c00cd44c9b1c88adb3693291f1cd93605ded80c250a75d472756b4d071" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - -[[package]] -name = "windows-targets" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" -dependencies = [ - "windows_aarch64_gnullvm 0.48.5", - "windows_aarch64_msvc 0.48.5", - "windows_i686_gnu 0.48.5", - "windows_i686_msvc 0.48.5", - "windows_x86_64_gnu 0.48.5", - "windows_x86_64_gnullvm 0.48.5", - "windows_x86_64_msvc 0.48.5", -] - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "597a5118570b68bc08d8d59125332c54f1ba9d9adeedeef5b99b02ba2b0698f8" - -[[package]] -name = "windows_aarch64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e08e8864a60f06ef0d0ff4ba04124db8b0fb3be5776a5cd47641e942e58c4d43" - -[[package]] -name = "windows_aarch64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" - -[[package]] -name = "windows_i686_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c61d927d8da41da96a81f029489353e68739737d3beca43145c8afec9a31a84f" - -[[package]] -name = "windows_i686_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" - -[[package]] -name = "windows_i686_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44d840b6ec649f480a41c8d80f9c65108b92d89345dd94027bfe06ac444d1060" - -[[package]] -name = "windows_i686_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8de912b8b8feb55c064867cf047dda097f92d51efad5b491dfb98f6bbb70cb36" - -[[package]] -name = "windows_x86_64_gnu" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26d41b46a36d453748aedef1486d5c7a85db22e56aff34643984ea85514e94a3" - -[[package]] -name = "windows_x86_64_gnullvm" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9aec5da331524158c6d1a4ac0ab1541149c0b9505fde06423b02f5ef0106b9f0" - -[[package]] -name = "windows_x86_64_msvc" -version = "0.48.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" - -[[package]] -name = "winit" -version = "0.28.7" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9596d90b45384f5281384ab204224876e8e8bf7d58366d9b795ad99aa9894b94" -dependencies = [ - "android-activity", - "bitflags 1.3.2", - "cfg_aliases", - "core-foundation", - "core-graphics", - "dispatch", - "instant", - "libc", - "log", - "mio", - "ndk", - "objc2", - "once_cell", - "orbclient", - "percent-encoding", - "raw-window-handle", - "redox_syscall 0.3.5", - "wasm-bindgen", - "wayland-scanner", - "web-sys", - "windows-sys 0.45.0", - "x11-dl", -] - -[[package]] -name = "winnow" -version = "0.5.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "829846f3e3db426d4cee4510841b71a8e58aa2a76b1132579487ae430ccd9c7b" -dependencies = [ - "memchr", -] - -[[package]] -name = "x11-dl" -version = "2.21.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38735924fedd5314a6e548792904ed8c6de6636285cb9fec04d5b1db85c1516f" -dependencies = [ - "libc", - "once_cell", - "pkg-config", -] - -[[package]] -name = "x11rb" -version = "0.10.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "592b4883219f345e712b3209c62654ebda0bb50887f330cbd018d0f654bfd507" -dependencies = [ - "gethostname", - "nix 0.24.3", - "winapi", - "winapi-wsapoll", - "x11rb-protocol", -] - -[[package]] -name = "x11rb-protocol" -version = "0.10.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "56b245751c0ac9db0e006dc812031482784e434630205a93c73cfefcaabeac67" -dependencies = [ - "nix 0.24.3", -] - -[[package]] -name = "xi-unicode" -version = "0.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a67300977d3dc3f8034dae89778f502b6ba20b269527b3223ba59c0cf393bb8a" - -[[package]] -name = "xml-rs" -version = "0.8.19" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fcb9cbac069e033553e8bb871be2fbdffcab578eb25bd0f7c508cedc6dcd75a" - -[[package]] -name = "zerocopy" -version = "0.7.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8cd369a67c0edfef15010f980c3cbe45d7f651deac2cd67ce097cd801de16557" -dependencies = [ - "zerocopy-derive", -] - -[[package]] -name = "zerocopy-derive" -version = "0.7.25" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c2f140bda219a26ccc0cdb03dba58af72590c53b22642577d88a927bc5c87d6b" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] diff --git a/examples/bevy_registry_export/basic/Cargo.toml b/examples/bevy_registry_export/basic/Cargo.toml index 9bdecc5..800d0d3 100644 --- a/examples/bevy_registry_export/basic/Cargo.toml +++ b/examples/bevy_registry_export/basic/Cargo.toml @@ -8,6 +8,8 @@ license = "MIT OR Apache-2.0" bevy="0.12" bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" } bevy_registry_export = { path = "../../../crates/bevy_registry_export" } +bevy_gltf_worlflow_examples_common = { path = "../../common" } + bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] } bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]} bevy_editor_pls = { version = "0.6" } diff --git a/examples/bevy_registry_export/basic/assets/registry.json b/examples/bevy_registry_export/basic/assets/registry.json index 5eeefca..88e3b13 100644 --- a/examples/bevy_registry_export/basic/assets/registry.json +++ b/examples/bevy_registry_export/basic/assets/registry.json @@ -71,16 +71,16 @@ "type": "array", "typeInfo": "List" }, - "alloc::vec::Vec": { + "alloc::vec::Vec": { "isComponent": false, "isResource": false, "items": { "type": { - "$ref": "#/$defs/bevy_bevy_registry_export_basic_example::test_components::TuppleVec3" + "$ref": "#/$defs/bevy_bevy_registry_export_basic_example::test_components::TupleVec3" } }, - "short_name": "Vec", - "title": "alloc::vec::Vec", + "short_name": "Vec", + "title": "alloc::vec::Vec", "type": "array", "typeInfo": "List" }, @@ -2111,179 +2111,6 @@ "type": "object", "typeInfo": "Enum" }, - "bevy_bevy_registry_export_basic_example::core::camera::camera_tracking::CameraTrackable": { - "additionalProperties": false, - "isComponent": true, - "isResource": false, - "properties": {}, - "required": [], - "short_name": "CameraTrackable", - "title": "bevy_bevy_registry_export_basic_example::core::camera::camera_tracking::CameraTrackable", - "type": "object", - "typeInfo": "Struct" - }, - "bevy_bevy_registry_export_basic_example::core::camera::camera_tracking::CameraTracking": { - "additionalProperties": false, - "isComponent": true, - "isResource": false, - "properties": { - "offset": { - "type": { - "$ref": "#/$defs/glam::Vec3" - } - } - }, - "required": [ - "offset" - ], - "short_name": "CameraTracking", - "title": "bevy_bevy_registry_export_basic_example::core::camera::camera_tracking::CameraTracking", - "type": "object", - "typeInfo": "Struct" - }, - "bevy_bevy_registry_export_basic_example::core::camera::camera_tracking::CameraTrackingOffset": { - "isComponent": true, - "isResource": false, - "items": false, - "prefixItems": [ - { - "type": { - "$ref": "#/$defs/glam::Vec3" - } - } - ], - "short_name": "CameraTrackingOffset", - "title": "bevy_bevy_registry_export_basic_example::core::camera::camera_tracking::CameraTrackingOffset", - "type": "array", - "typeInfo": "TupleStruct" - }, - "bevy_bevy_registry_export_basic_example::core::physics::physics_replace_proxies::AutoAABBCollider": { - "isComponent": true, - "isResource": false, - "oneOf": [ - "Cuboid", - "Ball", - "Capsule" - ], - "short_name": "AutoAABBCollider", - "title": "bevy_bevy_registry_export_basic_example::core::physics::physics_replace_proxies::AutoAABBCollider", - "type": "string", - "typeInfo": "Enum" - }, - "bevy_bevy_registry_export_basic_example::core::physics::physics_replace_proxies::Collider": { - "isComponent": true, - "isResource": false, - "oneOf": [ - { - "items": false, - "prefixItems": [ - { - "type": { - "$ref": "#/$defs/f32" - } - } - ], - "short_name": "Ball", - "title": "Ball", - "type": "array", - "typeInfo": "Tuple" - }, - { - "items": false, - "prefixItems": [ - { - "type": { - "$ref": "#/$defs/glam::Vec3" - } - } - ], - "short_name": "Cuboid", - "title": "Cuboid", - "type": "array", - "typeInfo": "Tuple" - }, - { - "items": false, - "prefixItems": [ - { - "type": { - "$ref": "#/$defs/glam::Vec3" - } - }, - { - "type": { - "$ref": "#/$defs/glam::Vec3" - } - }, - { - "type": { - "$ref": "#/$defs/f32" - } - } - ], - "short_name": "Capsule", - "title": "Capsule", - "type": "array", - "typeInfo": "Tuple" - }, - { - "title": "Mesh" - } - ], - "short_name": "Collider", - "title": "bevy_bevy_registry_export_basic_example::core::physics::physics_replace_proxies::Collider", - "type": "object", - "typeInfo": "Enum" - }, - "bevy_bevy_registry_export_basic_example::game::Interactible": { - "additionalProperties": false, - "isComponent": true, - "isResource": false, - "properties": {}, - "required": [], - "short_name": "Interactible", - "title": "bevy_bevy_registry_export_basic_example::game::Interactible", - "type": "object", - "typeInfo": "Struct" - }, - "bevy_bevy_registry_export_basic_example::game::Player": { - "additionalProperties": false, - "isComponent": true, - "isResource": false, - "properties": {}, - "required": [], - "short_name": "Player", - "title": "bevy_bevy_registry_export_basic_example::game::Player", - "type": "object", - "typeInfo": "Struct" - }, - "bevy_bevy_registry_export_basic_example::game::SoundMaterial": { - "isComponent": true, - "isResource": false, - "oneOf": [ - "Metal", - "Wood", - "Rock", - "Cloth", - "Squishy", - "None" - ], - "short_name": "SoundMaterial", - "title": "bevy_bevy_registry_export_basic_example::game::SoundMaterial", - "type": "string", - "typeInfo": "Enum" - }, - "bevy_bevy_registry_export_basic_example::game::picking::Pickable": { - "additionalProperties": false, - "isComponent": true, - "isResource": false, - "properties": {}, - "required": [], - "short_name": "Pickable", - "title": "bevy_bevy_registry_export_basic_example::game::picking::Pickable", - "type": "object", - "typeInfo": "Struct" - }, "bevy_bevy_registry_export_basic_example::test_components::BasicTest": { "additionalProperties": false, "isComponent": true, @@ -2389,7 +2216,7 @@ "type": "string", "typeInfo": "Enum" }, - "bevy_bevy_registry_export_basic_example::test_components::NestedTuppleStuff": { + "bevy_bevy_registry_export_basic_example::test_components::NestedTupleStuff": { "isComponent": true, "isResource": false, "items": false, @@ -2410,8 +2237,8 @@ } } ], - "short_name": "NestedTuppleStuff", - "title": "bevy_bevy_registry_export_basic_example::test_components::NestedTuppleStuff", + "short_name": "NestedTupleStuff", + "title": "bevy_bevy_registry_export_basic_example::test_components::NestedTupleStuff", "type": "array", "typeInfo": "TupleStruct" }, @@ -2427,7 +2254,7 @@ }, "color": { "type": { - "$ref": "#/$defs/bevy_bevy_registry_export_basic_example::test_components::TuppleTestColor" + "$ref": "#/$defs/bevy_bevy_registry_export_basic_example::test_components::TupleTestColor" } }, "colors_list": { @@ -2457,7 +2284,7 @@ }, "toggle": { "type": { - "$ref": "#/$defs/bevy_bevy_registry_export_basic_example::test_components::TuppleTestBool" + "$ref": "#/$defs/bevy_bevy_registry_export_basic_example::test_components::TupleTestBool" } } }, @@ -2483,7 +2310,7 @@ "properties": { "vec": { "type": { - "$ref": "#/$defs/bevy_bevy_registry_export_basic_example::test_components::TuppleVec3" + "$ref": "#/$defs/bevy_bevy_registry_export_basic_example::test_components::TupleVec3" } } }, @@ -2495,7 +2322,7 @@ "type": "object", "typeInfo": "Struct" }, - "bevy_bevy_registry_export_basic_example::test_components::TuppleTest2": { + "bevy_bevy_registry_export_basic_example::test_components::TupleTest2": { "isComponent": true, "isResource": false, "items": false, @@ -2516,12 +2343,12 @@ } } ], - "short_name": "TuppleTest2", - "title": "bevy_bevy_registry_export_basic_example::test_components::TuppleTest2", + "short_name": "TupleTest2", + "title": "bevy_bevy_registry_export_basic_example::test_components::TupleTest2", "type": "array", "typeInfo": "TupleStruct" }, - "bevy_bevy_registry_export_basic_example::test_components::TuppleTestBool": { + "bevy_bevy_registry_export_basic_example::test_components::TupleTestBool": { "isComponent": true, "isResource": false, "items": false, @@ -2532,12 +2359,12 @@ } } ], - "short_name": "TuppleTestBool", - "title": "bevy_bevy_registry_export_basic_example::test_components::TuppleTestBool", + "short_name": "TupleTestBool", + "title": "bevy_bevy_registry_export_basic_example::test_components::TupleTestBool", "type": "array", "typeInfo": "TupleStruct" }, - "bevy_bevy_registry_export_basic_example::test_components::TuppleTestColor": { + "bevy_bevy_registry_export_basic_example::test_components::TupleTestColor": { "isComponent": true, "isResource": false, "items": false, @@ -2548,12 +2375,12 @@ } } ], - "short_name": "TuppleTestColor", - "title": "bevy_bevy_registry_export_basic_example::test_components::TuppleTestColor", + "short_name": "TupleTestColor", + "title": "bevy_bevy_registry_export_basic_example::test_components::TupleTestColor", "type": "array", "typeInfo": "TupleStruct" }, - "bevy_bevy_registry_export_basic_example::test_components::TuppleTestF32": { + "bevy_bevy_registry_export_basic_example::test_components::TupleTestF32": { "isComponent": true, "isResource": false, "items": false, @@ -2564,12 +2391,12 @@ } } ], - "short_name": "TuppleTestF32", - "title": "bevy_bevy_registry_export_basic_example::test_components::TuppleTestF32", + "short_name": "TupleTestF32", + "title": "bevy_bevy_registry_export_basic_example::test_components::TupleTestF32", "type": "array", "typeInfo": "TupleStruct" }, - "bevy_bevy_registry_export_basic_example::test_components::TuppleTestStr": { + "bevy_bevy_registry_export_basic_example::test_components::TupleTestStr": { "isComponent": true, "isResource": false, "items": false, @@ -2580,12 +2407,12 @@ } } ], - "short_name": "TuppleTestStr", - "title": "bevy_bevy_registry_export_basic_example::test_components::TuppleTestStr", + "short_name": "TupleTestStr", + "title": "bevy_bevy_registry_export_basic_example::test_components::TupleTestStr", "type": "array", "typeInfo": "TupleStruct" }, - "bevy_bevy_registry_export_basic_example::test_components::TuppleTestU64": { + "bevy_bevy_registry_export_basic_example::test_components::TupleTestU64": { "isComponent": true, "isResource": false, "items": false, @@ -2596,12 +2423,12 @@ } } ], - "short_name": "TuppleTestU64", - "title": "bevy_bevy_registry_export_basic_example::test_components::TuppleTestU64", + "short_name": "TupleTestU64", + "title": "bevy_bevy_registry_export_basic_example::test_components::TupleTestU64", "type": "array", "typeInfo": "TupleStruct" }, - "bevy_bevy_registry_export_basic_example::test_components::TuppleVec": { + "bevy_bevy_registry_export_basic_example::test_components::TupleVec": { "isComponent": true, "isResource": false, "items": false, @@ -2612,12 +2439,12 @@ } } ], - "short_name": "TuppleVec", - "title": "bevy_bevy_registry_export_basic_example::test_components::TuppleVec", + "short_name": "TupleVec", + "title": "bevy_bevy_registry_export_basic_example::test_components::TupleVec", "type": "array", "typeInfo": "TupleStruct" }, - "bevy_bevy_registry_export_basic_example::test_components::TuppleVec2": { + "bevy_bevy_registry_export_basic_example::test_components::TupleVec2": { "isComponent": true, "isResource": false, "items": false, @@ -2628,12 +2455,12 @@ } } ], - "short_name": "TuppleVec2", - "title": "bevy_bevy_registry_export_basic_example::test_components::TuppleVec2", + "short_name": "TupleVec2", + "title": "bevy_bevy_registry_export_basic_example::test_components::TupleVec2", "type": "array", "typeInfo": "TupleStruct" }, - "bevy_bevy_registry_export_basic_example::test_components::TuppleVec3": { + "bevy_bevy_registry_export_basic_example::test_components::TupleVec3": { "isComponent": true, "isResource": false, "items": false, @@ -2644,12 +2471,12 @@ } } ], - "short_name": "TuppleVec3", - "title": "bevy_bevy_registry_export_basic_example::test_components::TuppleVec3", + "short_name": "TupleVec3", + "title": "bevy_bevy_registry_export_basic_example::test_components::TupleVec3", "type": "array", "typeInfo": "TupleStruct" }, - "bevy_bevy_registry_export_basic_example::test_components::TuppleVecF32F32": { + "bevy_bevy_registry_export_basic_example::test_components::TupleVecF32F32": { "isComponent": true, "isResource": false, "items": false, @@ -2660,8 +2487,8 @@ } } ], - "short_name": "TuppleVecF32F32", - "title": "bevy_bevy_registry_export_basic_example::test_components::TuppleVecF32F32", + "short_name": "TupleVecF32F32", + "title": "bevy_bevy_registry_export_basic_example::test_components::TupleVecF32F32", "type": "array", "typeInfo": "TupleStruct" }, @@ -2699,7 +2526,7 @@ "prefixItems": [ { "type": { - "$ref": "#/$defs/alloc::vec::Vec" + "$ref": "#/$defs/alloc::vec::Vec" } } ], @@ -3190,6 +3017,207 @@ "type": "object", "typeInfo": "Struct" }, + "bevy_gltf_worlflow_examples_common::core::camera::camera_replace_proxies::SSAOSettings": { + "additionalProperties": false, + "isComponent": true, + "isResource": false, + "properties": {}, + "required": [], + "short_name": "SSAOSettings", + "title": "bevy_gltf_worlflow_examples_common::core::camera::camera_replace_proxies::SSAOSettings", + "type": "object", + "typeInfo": "Struct" + }, + "bevy_gltf_worlflow_examples_common::core::camera::camera_tracking::CameraTrackable": { + "additionalProperties": false, + "isComponent": true, + "isResource": false, + "properties": {}, + "required": [], + "short_name": "CameraTrackable", + "title": "bevy_gltf_worlflow_examples_common::core::camera::camera_tracking::CameraTrackable", + "type": "object", + "typeInfo": "Struct" + }, + "bevy_gltf_worlflow_examples_common::core::camera::camera_tracking::CameraTracking": { + "additionalProperties": false, + "isComponent": true, + "isResource": false, + "properties": { + "offset": { + "type": { + "$ref": "#/$defs/glam::Vec3" + } + } + }, + "required": [ + "offset" + ], + "short_name": "CameraTracking", + "title": "bevy_gltf_worlflow_examples_common::core::camera::camera_tracking::CameraTracking", + "type": "object", + "typeInfo": "Struct" + }, + "bevy_gltf_worlflow_examples_common::core::camera::camera_tracking::CameraTrackingOffset": { + "isComponent": true, + "isResource": false, + "items": false, + "prefixItems": [ + { + "type": { + "$ref": "#/$defs/glam::Vec3" + } + } + ], + "short_name": "CameraTrackingOffset", + "title": "bevy_gltf_worlflow_examples_common::core::camera::camera_tracking::CameraTrackingOffset", + "type": "array", + "typeInfo": "TupleStruct" + }, + "bevy_gltf_worlflow_examples_common::core::lighting::lighting_replace_proxies::AmbientLightSettings": { + "additionalProperties": false, + "isComponent": true, + "isResource": false, + "properties": { + "brightness": { + "type": { + "$ref": "#/$defs/f32" + } + }, + "color": { + "type": { + "$ref": "#/$defs/bevy_render::color::Color" + } + } + }, + "required": [ + "color", + "brightness" + ], + "short_name": "AmbientLightSettings", + "title": "bevy_gltf_worlflow_examples_common::core::lighting::lighting_replace_proxies::AmbientLightSettings", + "type": "object", + "typeInfo": "Struct" + }, + "bevy_gltf_worlflow_examples_common::core::lighting::lighting_replace_proxies::ShadowmapSettings": { + "additionalProperties": false, + "isComponent": true, + "isResource": false, + "properties": { + "size": { + "type": { + "$ref": "#/$defs/usize" + } + } + }, + "required": [ + "size" + ], + "short_name": "ShadowmapSettings", + "title": "bevy_gltf_worlflow_examples_common::core::lighting::lighting_replace_proxies::ShadowmapSettings", + "type": "object", + "typeInfo": "Struct" + }, + "bevy_gltf_worlflow_examples_common::core::physics::physics_replace_proxies::AutoAABBCollider": { + "isComponent": true, + "isResource": false, + "oneOf": [ + "Cuboid", + "Ball", + "Capsule" + ], + "short_name": "AutoAABBCollider", + "title": "bevy_gltf_worlflow_examples_common::core::physics::physics_replace_proxies::AutoAABBCollider", + "type": "string", + "typeInfo": "Enum" + }, + "bevy_gltf_worlflow_examples_common::core::physics::physics_replace_proxies::Collider": { + "isComponent": true, + "isResource": false, + "oneOf": [ + { + "items": false, + "prefixItems": [ + { + "type": { + "$ref": "#/$defs/f32" + } + } + ], + "short_name": "Ball", + "title": "Ball", + "type": "array", + "typeInfo": "Tuple" + }, + { + "items": false, + "prefixItems": [ + { + "type": { + "$ref": "#/$defs/glam::Vec3" + } + } + ], + "short_name": "Cuboid", + "title": "Cuboid", + "type": "array", + "typeInfo": "Tuple" + }, + { + "items": false, + "prefixItems": [ + { + "type": { + "$ref": "#/$defs/glam::Vec3" + } + }, + { + "type": { + "$ref": "#/$defs/glam::Vec3" + } + }, + { + "type": { + "$ref": "#/$defs/f32" + } + } + ], + "short_name": "Capsule", + "title": "Capsule", + "type": "array", + "typeInfo": "Tuple" + }, + { + "title": "Mesh" + } + ], + "short_name": "Collider", + "title": "bevy_gltf_worlflow_examples_common::core::physics::physics_replace_proxies::Collider", + "type": "object", + "typeInfo": "Enum" + }, + "bevy_gltf_worlflow_examples_common::game::picking::Pickable": { + "additionalProperties": false, + "isComponent": true, + "isResource": false, + "properties": {}, + "required": [], + "short_name": "Pickable", + "title": "bevy_gltf_worlflow_examples_common::game::picking::Pickable", + "type": "object", + "typeInfo": "Struct" + }, + "bevy_gltf_worlflow_examples_common::game::player::Player": { + "additionalProperties": false, + "isComponent": true, + "isResource": false, + "properties": {}, + "required": [], + "short_name": "Player", + "title": "bevy_gltf_worlflow_examples_common::game::player::Player", + "type": "object", + "typeInfo": "Struct" + }, "bevy_hierarchy::components::children::Children": { "isComponent": true, "isResource": false, diff --git a/examples/bevy_registry_export/basic/src/assets/assets_core.rs b/examples/bevy_registry_export/basic/src/assets/assets_core.rs deleted file mode 100644 index 29b577a..0000000 --- a/examples/bevy_registry_export/basic/src/assets/assets_core.rs +++ /dev/null @@ -1,5 +0,0 @@ -use bevy::prelude::*; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct CoreAssets {} diff --git a/examples/bevy_registry_export/basic/src/assets/assets_game.rs b/examples/bevy_registry_export/basic/src/assets/assets_game.rs deleted file mode 100644 index b8e0665..0000000 --- a/examples/bevy_registry_export/basic/src/assets/assets_game.rs +++ /dev/null @@ -1,13 +0,0 @@ -use bevy::gltf::Gltf; -use bevy::prelude::*; -use bevy::utils::HashMap; -use bevy_asset_loader::prelude::*; - -#[derive(AssetCollection, Resource)] -pub struct GameAssets { - #[asset(key = "world")] - pub world: Handle, - - #[asset(key = "models", collection(typed, mapped))] - pub models: HashMap>, -} diff --git a/examples/bevy_registry_export/basic/src/assets/mod.rs b/examples/bevy_registry_export/basic/src/assets/mod.rs deleted file mode 100644 index a2c8b22..0000000 --- a/examples/bevy_registry_export/basic/src/assets/mod.rs +++ /dev/null @@ -1,35 +0,0 @@ -pub mod assets_core; -pub use assets_core::*; - -pub mod assets_game; -pub use assets_game::*; - -use bevy::prelude::*; -use bevy_asset_loader::prelude::*; - -use crate::state::AppState; - -pub struct AssetsPlugin; -impl Plugin for AssetsPlugin { - fn build(&self, app: &mut App) { - 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), - ) - .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); - } -} diff --git a/examples/bevy_registry_export/basic/src/core/camera/camera_replace_proxies.rs b/examples/bevy_registry_export/basic/src/core/camera/camera_replace_proxies.rs deleted file mode 100644 index 9055c95..0000000 --- a/examples/bevy_registry_export/basic/src/core/camera/camera_replace_proxies.rs +++ /dev/null @@ -1,24 +0,0 @@ -use bevy::core_pipeline::bloom::{BloomCompositeMode, BloomSettings}; -use bevy::core_pipeline::tonemapping::{DebandDither, Tonemapping}; -use bevy::prelude::*; - -use super::CameraTrackingOffset; - -pub fn camera_replace_proxies( - mut commands: Commands, - mut added_cameras: Query<(Entity, &mut Camera), (Added, With)>, -) { - for (entity, mut camera) in added_cameras.iter_mut() { - info!("detected added camera, updating proxy"); - camera.hdr = true; - commands - .entity(entity) - .insert(DebandDither::Enabled) - .insert(Tonemapping::BlenderFilmic) - .insert(BloomSettings { - intensity: 0.01, - composite_mode: BloomCompositeMode::Additive, - ..default() - }); - } -} diff --git a/examples/bevy_registry_export/basic/src/core/camera/mod.rs b/examples/bevy_registry_export/basic/src/core/camera/mod.rs deleted file mode 100644 index a6bbb65..0000000 --- a/examples/bevy_registry_export/basic/src/core/camera/mod.rs +++ /dev/null @@ -1,24 +0,0 @@ -pub mod camera_tracking; -pub use camera_tracking::*; - -pub mod camera_replace_proxies; -pub use camera_replace_proxies::*; - -use bevy::prelude::*; -use bevy_gltf_blueprints::GltfBlueprintsSet; - -pub struct CameraPlugin; -impl Plugin for CameraPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .register_type::() - .register_type::() - .add_systems( - Update, - ( - camera_replace_proxies.after(GltfBlueprintsSet::AfterSpawn), - camera_track, - ), - ); - } -} diff --git a/examples/bevy_registry_export/basic/src/core/lighting/lighting_replace_proxies.rs b/examples/bevy_registry_export/basic/src/core/lighting/lighting_replace_proxies.rs deleted file mode 100644 index 48c0908..0000000 --- a/examples/bevy_registry_export/basic/src/core/lighting/lighting_replace_proxies.rs +++ /dev/null @@ -1,25 +0,0 @@ -use bevy::prelude::*; - -use bevy::pbr::{CascadeShadowConfig, CascadeShadowConfigBuilder}; - -// fixme might be too specific to might needs, should it be moved out ? also these are all for lights, not models -pub fn lighting_replace_proxies( - mut added_dirights: Query<(Entity, &mut DirectionalLight), Added>, - mut added_spotlights: Query<&mut SpotLight, Added>, - mut commands: Commands, -) { - for (entity, mut light) in added_dirights.iter_mut() { - light.illuminance *= 5.0; - light.shadows_enabled = true; - let shadow_config: CascadeShadowConfig = CascadeShadowConfigBuilder { - first_cascade_far_bound: 15.0, - maximum_distance: 135.0, - ..default() - } - .into(); - commands.entity(entity).insert(shadow_config); - } - for mut light in added_spotlights.iter_mut() { - light.shadows_enabled = true; - } -} diff --git a/examples/bevy_registry_export/basic/src/core/lighting/mod.rs b/examples/bevy_registry_export/basic/src/core/lighting/mod.rs deleted file mode 100644 index c9688cd..0000000 --- a/examples/bevy_registry_export/basic/src/core/lighting/mod.rs +++ /dev/null @@ -1,18 +0,0 @@ -mod lighting_replace_proxies; -use lighting_replace_proxies::*; - -use bevy::pbr::{DirectionalLightShadowMap, NotShadowCaster}; -use bevy::prelude::*; - -pub struct LightingPlugin; -impl Plugin for LightingPlugin { - fn build(&self, app: &mut App) { - app - .insert_resource(DirectionalLightShadowMap { size: 4096 }) - // FIXME: adding these since they are missing - .register_type::() - - .add_systems(PreUpdate, lighting_replace_proxies) // FIXME: you should actually run this in a specific state most likely - ; - } -} diff --git a/examples/bevy_registry_export/basic/src/core/mod.rs b/examples/bevy_registry_export/basic/src/core/mod.rs index 7404994..5421e4e 100644 --- a/examples/bevy_registry_export/basic/src/core/mod.rs +++ b/examples/bevy_registry_export/basic/src/core/mod.rs @@ -1,18 +1,5 @@ -pub mod camera; -pub use camera::*; - -pub mod lighting; -pub use lighting::*; - -pub mod relationships; -pub use relationships::*; - -pub mod physics; -pub use physics::*; - use bevy::prelude::*; use bevy_gltf_blueprints::*; - use bevy_registry_export::*; pub struct CorePlugin; @@ -23,9 +10,6 @@ impl Plugin for CorePlugin { save_path: "assets/registry.json".into(), ..Default::default() }, - LightingPlugin, - CameraPlugin, - PhysicsPlugin, BlueprintsPlugin { legacy_mode: false, library_folder: "models/library".into(), diff --git a/examples/bevy_registry_export/basic/src/core/physics/controls.rs b/examples/bevy_registry_export/basic/src/core/physics/controls.rs deleted file mode 100644 index b478d12..0000000 --- a/examples/bevy_registry_export/basic/src/core/physics/controls.rs +++ /dev/null @@ -1,12 +0,0 @@ -use bevy::{log::info, prelude::ResMut}; -use bevy_rapier3d::prelude::RapierConfiguration; - -pub fn pause_physics(mut physics_config: ResMut) { - info!("pausing physics"); - physics_config.physics_pipeline_active = false; -} - -pub fn resume_physics(mut physics_config: ResMut) { - info!("unpausing physics"); - physics_config.physics_pipeline_active = true; -} diff --git a/examples/bevy_registry_export/basic/src/core/physics/mod.rs b/examples/bevy_registry_export/basic/src/core/physics/mod.rs deleted file mode 100644 index cd7d523..0000000 --- a/examples/bevy_registry_export/basic/src/core/physics/mod.rs +++ /dev/null @@ -1,37 +0,0 @@ -pub mod physics_replace_proxies; -use bevy_rapier3d::{ - prelude::{NoUserData, RapierPhysicsPlugin}, - render::RapierDebugRenderPlugin, -}; -pub use physics_replace_proxies::*; - -pub mod utils; - -pub mod controls; -pub use controls::*; - -use crate::state::GameState; -use bevy::prelude::*; -// use super::blueprints::GltfBlueprintsSet; -use bevy_gltf_blueprints::GltfBlueprintsSet; -// use crate::Collider; -pub struct PhysicsPlugin; -impl Plugin for PhysicsPlugin { - fn build(&self, app: &mut App) { - app.add_plugins(( - RapierPhysicsPlugin::::default(), - RapierDebugRenderPlugin::default(), - )) - .register_type::() - .register_type::() - // find a way to make serde's stuff serializable - // .register_type::() - //bevy_rapier3d::dynamics::CoefficientCombineRule - .add_systems( - Update, - physics_replace_proxies.after(GltfBlueprintsSet::AfterSpawn), - ) - .add_systems(OnEnter(GameState::InGame), resume_physics) - .add_systems(OnExit(GameState::InGame), pause_physics); - } -} diff --git a/examples/bevy_registry_export/basic/src/core/physics/physics_replace_proxies.rs b/examples/bevy_registry_export/basic/src/core/physics/physics_replace_proxies.rs deleted file mode 100644 index b91462c..0000000 --- a/examples/bevy_registry_export/basic/src/core/physics/physics_replace_proxies.rs +++ /dev/null @@ -1,101 +0,0 @@ -use bevy::prelude::*; -// use bevy::render::primitives::Aabb; -use bevy_rapier3d::geometry::Collider as RapierCollider; -use bevy_rapier3d::prelude::{ActiveCollisionTypes, ActiveEvents, ComputedColliderShape}; - -use super::utils::*; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum Collider { - Ball(f32), - Cuboid(Vec3), - Capsule(Vec3, Vec3, f32), - #[default] - Mesh, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum AutoAABBCollider { - #[default] - Cuboid, - Ball, - Capsule, -} - -// replaces all physics stand-ins with the actual rapier types -pub fn physics_replace_proxies( - meshes: Res>, - mesh_handles: Query<&Handle>, - mut proxy_colliders: Query< - (Entity, &Collider, &Name, &mut Visibility), - (Without, Added), - >, - // needed for tri meshes - children: Query<&Children>, - - mut commands: Commands, -) { - for proxy_colider in proxy_colliders.iter_mut() { - let (entity, collider_proxy, name, mut visibility) = proxy_colider; - // we hide the collider meshes: perhaps they should be removed altogether once processed ? - if name.ends_with("_collider") || name.ends_with("_sensor") { - *visibility = Visibility::Hidden; - } - - let mut rapier_collider: RapierCollider; - match collider_proxy { - Collider::Ball(radius) => { - info!("generating collider from proxy: ball"); - rapier_collider = RapierCollider::ball(*radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Cuboid(size) => { - info!("generating collider from proxy: cuboid"); - rapier_collider = RapierCollider::cuboid(size.x, size.y, size.z); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Capsule(a, b, radius) => { - info!("generating collider from proxy: capsule"); - rapier_collider = RapierCollider::capsule(*a, *b, *radius); - commands.entity(entity) - .insert(rapier_collider) - .insert(ActiveEvents::COLLISION_EVENTS) // FIXME: this is just for demo purposes !!! - ; - } - Collider::Mesh => { - info!("generating collider from proxy: mesh"); - for (_, collider_mesh) in - Mesh::search_in_children(entity, &children, &meshes, &mesh_handles) - { - rapier_collider = RapierCollider::from_bevy_mesh( - collider_mesh, - &ComputedColliderShape::TriMesh, - ) - .unwrap(); - commands - .entity(entity) - .insert(rapier_collider) - // FIXME: this is just for demo purposes !!! - .insert( - ActiveCollisionTypes::default() - | ActiveCollisionTypes::KINEMATIC_STATIC - | ActiveCollisionTypes::STATIC_STATIC - | ActiveCollisionTypes::DYNAMIC_STATIC, - ) - .insert(ActiveEvents::COLLISION_EVENTS); - // .insert(ActiveEvents::COLLISION_EVENTS) - // break; - // RapierCollider::convex_hull(points) - } - } - } - } -} diff --git a/examples/bevy_registry_export/basic/src/core/physics/utils.rs b/examples/bevy_registry_export/basic/src/core/physics/utils.rs deleted file mode 100644 index 7886710..0000000 --- a/examples/bevy_registry_export/basic/src/core/physics/utils.rs +++ /dev/null @@ -1,175 +0,0 @@ -use bevy::prelude::*; -use bevy::render::mesh::{MeshVertexAttributeId, PrimitiveTopology, VertexAttributeValues}; -// TAKEN VERBATIB FROM https://github.com/janhohenheim/foxtrot/blob/src/util/trait_extension.rs - -pub(crate) trait Vec3Ext: Copy { - fn is_approx_zero(self) -> bool; - fn split(self, up: Vec3) -> SplitVec3; -} -impl Vec3Ext for Vec3 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn split(self, up: Vec3) -> SplitVec3 { - let vertical = up * self.dot(up); - let horizontal = self - vertical; - SplitVec3 { - vertical, - horizontal, - } - } -} - -#[derive(Debug, Clone, Copy, PartialEq)] -pub(crate) struct SplitVec3 { - pub(crate) vertical: Vec3, - pub(crate) horizontal: Vec3, -} - -pub(crate) trait Vec2Ext: Copy { - fn is_approx_zero(self) -> bool; - fn x0y(self) -> Vec3; -} -impl Vec2Ext for Vec2 { - #[inline] - fn is_approx_zero(self) -> bool { - self.length_squared() < 1e-5 - } - - #[inline] - fn x0y(self) -> Vec3 { - Vec3::new(self.x, 0., self.y) - } -} - -pub(crate) trait MeshExt { - fn transform(&mut self, transform: Transform); - fn transformed(&self, transform: Transform) -> Mesh; - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]>; - fn search_in_children<'a>( - parent: Entity, - children: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)>; -} - -impl MeshExt for Mesh { - fn transform(&mut self, transform: Transform) { - for coords in self.read_coords_mut(Mesh::ATTRIBUTE_POSITION.clone()) { - let vec3 = (*coords).into(); - let transformed = transform.transform_point(vec3); - *coords = transformed.into(); - } - for normal in self.read_coords_mut(Mesh::ATTRIBUTE_NORMAL.clone()) { - let vec3 = (*normal).into(); - let transformed = transform.rotation.mul_vec3(vec3); - *normal = transformed.into(); - } - } - - fn transformed(&self, transform: Transform) -> Mesh { - let mut mesh = self.clone(); - mesh.transform(transform); - mesh - } - - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]> { - // Guaranteed by Bevy for the current usage - match self - .attribute_mut(id) - .expect("Failed to read unknown mesh attribute") - { - VertexAttributeValues::Float32x3(values) => values, - // Guaranteed by Bevy for the current usage - _ => unreachable!(), - } - } - - fn search_in_children<'a>( - parent: Entity, - children_query: &'a Query<&Children>, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> Vec<(Entity, &'a Mesh)> { - if let Ok(children) = children_query.get(parent) { - let mut result: Vec<_> = children - .iter() - .filter_map(|entity| mesh_handles.get(*entity).ok().map(|mesh| (*entity, mesh))) - .map(|(entity, mesh_handle)| { - ( - entity, - meshes - .get(mesh_handle) - .expect("Failed to get mesh from handle"), - ) - }) - .map(|(entity, mesh)| { - assert_eq!(mesh.primitive_topology(), PrimitiveTopology::TriangleList); - (entity, mesh) - }) - .collect(); - let mut inner_result = children - .iter() - .flat_map(|entity| { - Self::search_in_children(*entity, children_query, meshes, mesh_handles) - }) - .collect(); - result.append(&mut inner_result); - result - } else { - Vec::new() - } - } -} - -pub(crate) trait F32Ext: Copy { - fn is_approx_zero(self) -> bool; - fn squared(self) -> f32; - fn lerp(self, other: f32, ratio: f32) -> f32; -} - -impl F32Ext for f32 { - #[inline] - fn is_approx_zero(self) -> bool { - self.abs() < 1e-5 - } - - #[inline] - fn squared(self) -> f32 { - self * self - } - - #[inline] - fn lerp(self, other: f32, ratio: f32) -> f32 { - self.mul_add(1. - ratio, other * ratio) - } -} - -pub(crate) trait TransformExt: Copy { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform; - fn lerp(self, other: Transform, ratio: f32) -> Transform; -} - -impl TransformExt for Transform { - fn horizontally_looking_at(self, target: Vec3, up: Vec3) -> Transform { - let direction = target - self.translation; - let horizontal_direction = direction - up * direction.dot(up); - let look_target = self.translation + horizontal_direction; - self.looking_at(look_target, up) - } - - fn lerp(self, other: Transform, ratio: f32) -> Transform { - let translation = self.translation.lerp(other.translation, ratio); - let rotation = self.rotation.slerp(other.rotation, ratio); - let scale = self.scale.lerp(other.scale, ratio); - Transform { - translation, - rotation, - scale, - } - } -} diff --git a/examples/bevy_registry_export/basic/src/core/physics/utils_old.rs b/examples/bevy_registry_export/basic/src/core/physics/utils_old.rs deleted file mode 100644 index c210dd3..0000000 --- a/examples/bevy_registry_export/basic/src/core/physics/utils_old.rs +++ /dev/null @@ -1,75 +0,0 @@ -use bevy::prelude::*; -use bevy::render::mesh::{MeshVertexAttributeId, PrimitiveTopology, VertexAttributeValues}; -// TAKEN VERBATIB FROM https://github.com/janhohenheim/foxtrot/blob/6e31fc02652fc9d085a4adde0a73ab007dbbb0dc/src/util/trait_extension.rs - -pub trait Vec3Ext { - #[allow(clippy::wrong_self_convention)] // Because [`Vec3`] is [`Copy`] - fn is_approx_zero(self) -> bool; - fn x0z(self) -> Vec3; -} -impl Vec3Ext for Vec3 { - fn is_approx_zero(self) -> bool { - [self.x, self.y, self.z].iter().all(|&x| x.abs() < 1e-5) - } - fn x0z(self) -> Vec3 { - Vec3::new(self.x, 0., self.z) - } -} - -pub trait MeshExt { - fn transform(&mut self, transform: Transform); - fn transformed(&self, transform: Transform) -> Mesh; - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]>; - fn search_in_children<'a>( - children: &'a Children, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> (Entity, &'a Mesh); -} - -impl MeshExt for Mesh { - fn transform(&mut self, transform: Transform) { - for attribute in [Mesh::ATTRIBUTE_POSITION, Mesh::ATTRIBUTE_NORMAL] { - for coords in self.read_coords_mut(attribute.clone()) { - let vec3 = (*coords).into(); - let transformed = transform.transform_point(vec3); - *coords = transformed.into(); - } - } - } - - fn transformed(&self, transform: Transform) -> Mesh { - let mut mesh = self.clone(); - mesh.transform(transform); - mesh - } - - fn read_coords_mut(&mut self, id: impl Into) -> &mut Vec<[f32; 3]> { - match self.attribute_mut(id).unwrap() { - VertexAttributeValues::Float32x3(values) => values, - // Guaranteed by Bevy - _ => unreachable!(), - } - } - - fn search_in_children<'a>( - children: &'a Children, - meshes: &'a Assets, - mesh_handles: &'a Query<&Handle>, - ) -> (Entity, &'a Mesh) { - let entity_handles: Vec<_> = children - .iter() - .filter_map(|entity| mesh_handles.get(*entity).ok().map(|mesh| (*entity, mesh))) - .collect(); - assert_eq!( - entity_handles.len(), - 1, - "Collider must contain exactly one mesh, but found {}", - entity_handles.len() - ); - let (entity, mesh_handle) = entity_handles.first().unwrap(); - let mesh = meshes.get(mesh_handle).unwrap(); - assert_eq!(mesh.primitive_topology(), PrimitiveTopology::TriangleList); - (*entity, mesh) - } -} diff --git a/examples/bevy_registry_export/basic/src/core/relationships/mod.rs b/examples/bevy_registry_export/basic/src/core/relationships/mod.rs deleted file mode 100644 index 4128453..0000000 --- a/examples/bevy_registry_export/basic/src/core/relationships/mod.rs +++ /dev/null @@ -1,11 +0,0 @@ -pub mod relationships_insert_dependant_components; -pub use relationships_insert_dependant_components::*; - -use bevy::prelude::*; - -pub struct EcsRelationshipsPlugin; -impl Plugin for EcsRelationshipsPlugin { - fn build(&self, app: &mut App) { - app; - } -} diff --git a/examples/bevy_registry_export/basic/src/core/relationships/relationships_insert_dependant_components.rs b/examples/bevy_registry_export/basic/src/core/relationships/relationships_insert_dependant_components.rs deleted file mode 100644 index 4e9ad17..0000000 --- a/examples/bevy_registry_export/basic/src/core/relationships/relationships_insert_dependant_components.rs +++ /dev/null @@ -1,15 +0,0 @@ -use bevy::prelude::*; - -pub fn insert_dependant_component< - Dependant: Component, - Dependency: Component + std::default::Default, ->( - mut commands: Commands, - entities_without_depency: Query<(Entity, &Name), (With, Without)>, -) { - for (entity, name) in entities_without_depency.iter() { - let name = name.clone().to_string(); - commands.entity(entity).insert(Dependency::default()); - warn!("found an entity called {} with a {} component but without an {}, please check your assets", name.clone(), std::any::type_name::(), std::any::type_name::()); - } -} 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 2a077f7..2338956 100644 --- a/examples/bevy_registry_export/basic/src/game/in_game.rs +++ b/examples/bevy_registry_export/basic/src/game/in_game.rs @@ -1,10 +1,6 @@ use bevy::prelude::*; - -use crate::{ - assets::GameAssets, - state::{GameState, InAppRunning}, -}; use bevy_gltf_blueprints::{BluePrintBundle, BlueprintName, GameWorldTag}; +use bevy_gltf_worlflow_examples_common::{assets::GameAssets, GameState, InAppRunning}; use bevy_rapier3d::prelude::Velocity; use rand::Rng; diff --git a/examples/bevy_registry_export/basic/src/game/in_main_menu.rs b/examples/bevy_registry_export/basic/src/game/in_main_menu.rs index 586063a..c1a4b8b 100644 --- a/examples/bevy_registry_export/basic/src/game/in_main_menu.rs +++ b/examples/bevy_registry_export/basic/src/game/in_main_menu.rs @@ -1,6 +1,5 @@ use bevy::prelude::*; - -use crate::state::{AppState, InMainMenu}; +use bevy_gltf_worlflow_examples_common::{AppState, InMainMenu}; pub fn setup_main_menu(mut commands: Commands) { commands.spawn((Camera2dBundle::default(), InMainMenu)); diff --git a/examples/bevy_registry_export/basic/src/game/mod.rs b/examples/bevy_registry_export/basic/src/game/mod.rs index 1318ee1..b236141 100644 --- a/examples/bevy_registry_export/basic/src/game/mod.rs +++ b/examples/bevy_registry_export/basic/src/game/mod.rs @@ -4,87 +4,19 @@ pub use in_game::*; pub mod in_main_menu; pub use in_main_menu::*; -pub mod picking; -pub use picking::*; - -use crate::state::{AppState, GameState}; use bevy::prelude::*; - -// this file is just for demo purposes, contains various types of components, systems etc - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub enum SoundMaterial { - Metal, - Wood, - Rock, - Cloth, - Squishy, - #[default] - None, -} - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Player; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo component showing auto injection of components -pub struct ShouldBeWithPlayer; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -/// Demo marker component -pub struct Interactible; - -fn player_move_demo( - keycode: Res>, - mut players: Query<&mut Transform, With>, -) { - let speed = 0.2; - if let Ok(mut player) = players.get_single_mut() { - if keycode.pressed(KeyCode::Left) { - player.translation.x += speed; - } - if keycode.pressed(KeyCode::Right) { - player.translation.x -= speed; - } - - if keycode.pressed(KeyCode::Up) { - player.translation.z += speed; - } - if keycode.pressed(KeyCode::Down) { - player.translation.z -= speed; - } - } -} +use bevy_gltf_worlflow_examples_common::{AppState, GameState}; pub struct GamePlugin; impl Plugin for GamePlugin { fn build(&self, app: &mut App) { - app.add_plugins(PickingPlugin) - .register_type::() - .register_type::() - .register_type::() - // little helper utility, to automatically inject components that are dependant on an other component - // ie, here an Entity with a Player component should also always have a ShouldBeWithPlayer component - // you get a warning if you use this, as I consider this to be stop-gap solution (usually you should have either a bundle, or directly define all needed components) - .add_systems( - Update, - ( - // insert_dependant_component::, - player_move_demo, //.run_if(in_state(AppState::Running)), - // test_collision_events - spawn_test, - spawn_test_unregisted_components, - ) - .run_if(in_state(GameState::InGame)), - ) - .add_systems(OnEnter(AppState::MenuRunning), setup_main_menu) - .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); + app.add_systems( + Update, + (spawn_test, spawn_test_unregisted_components).run_if(in_state(GameState::InGame)), + ) + .add_systems(OnEnter(AppState::MenuRunning), setup_main_menu) + .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); } } diff --git a/examples/bevy_registry_export/basic/src/game/picking.rs b/examples/bevy_registry_export/basic/src/game/picking.rs deleted file mode 100644 index 6731bbb..0000000 --- a/examples/bevy_registry_export/basic/src/game/picking.rs +++ /dev/null @@ -1,34 +0,0 @@ -use super::Player; -use bevy::prelude::*; -use bevy_gltf_blueprints::GltfBlueprintsSet; - -#[derive(Component, Reflect, Default, Debug)] -#[reflect(Component)] -pub struct Pickable; - -// very simple, crude picking (as in picking up objects) implementation - -pub fn picking( - players: Query<&GlobalTransform, With>, - pickables: Query<(Entity, &GlobalTransform), With>, - mut commands: Commands, -) { - for player_transforms in players.iter() { - for (pickable, pickable_transforms) in pickables.iter() { - let distance = player_transforms - .translation() - .distance(pickable_transforms.translation()); - if distance < 2.5 { - commands.entity(pickable).despawn_recursive(); - } - } - } -} - -pub struct PickingPlugin; -impl Plugin for PickingPlugin { - fn build(&self, app: &mut App) { - app.register_type::() - .add_systems(Update, (picking.after(GltfBlueprintsSet::AfterSpawn),)); - } -} diff --git a/examples/bevy_registry_export/basic/src/main.rs b/examples/bevy_registry_export/basic/src/main.rs index 6edba33..8fca426 100644 --- a/examples/bevy_registry_export/basic/src/main.rs +++ b/examples/bevy_registry_export/basic/src/main.rs @@ -1,15 +1,10 @@ use bevy::prelude::*; use bevy_editor_pls::prelude::*; +use bevy_gltf_worlflow_examples_common::CommonPlugin; mod core; use crate::core::*; -pub mod assets; -use assets::*; - -pub mod state; -use state::*; - mod game; use game::*; @@ -23,8 +18,7 @@ fn main() { // editor EditorPlugin::default(), // our custom plugins - StatePlugin, - AssetsPlugin, + CommonPlugin, CorePlugin, // reusable plugins GamePlugin, // specific to our game ComponentsTestPlugin, // Showcases different type of components /structs diff --git a/examples/bevy_registry_export/basic/src/state.rs b/examples/bevy_registry_export/basic/src/state.rs deleted file mode 100644 index 8e983d9..0000000 --- a/examples/bevy_registry_export/basic/src/state.rs +++ /dev/null @@ -1,54 +0,0 @@ -use bevy::app::AppExit; -use bevy::prelude::*; - -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, States)] -pub enum AppState { - #[default] - CoreLoading, - MenuRunning, - AppLoading, - AppRunning, - AppEnding, - - // FIXME: not sure - LoadingGame, -} - -#[derive(Debug, Clone, Copy, Eq, PartialEq, Hash, Default, States)] -pub enum GameState { - #[default] - None, - - InMenu, - InGame, - - InGameOver, - - InSaving, - InLoading, -} - -// tag components for all entities within a certain state (for despawning them if needed) , FIXME: seems kinda hack-ish -#[derive(Component)] -pub struct InCoreLoading; -#[derive(Component, Default)] -pub struct InMenuRunning; -#[derive(Component)] -pub struct InAppLoading; -#[derive(Component)] -pub struct InAppRunning; - -// components for tagging in game vs in game menu stuff -#[derive(Component, Default)] -pub struct InMainMenu; -#[derive(Component, Default)] -pub struct InMenu; -#[derive(Component, Default)] -pub struct InGame; - -pub struct StatePlugin; -impl Plugin for StatePlugin { - fn build(&self, app: &mut App) { - app.add_state::().add_state::(); - } -} diff --git a/examples/bevy_registry_export/basic/src/test_components.rs b/examples/bevy_registry_export/basic/src/test_components.rs index 39cd711..deebb1d 100644 --- a/examples/bevy_registry_export/basic/src/test_components.rs +++ b/examples/bevy_registry_export/basic/src/test_components.rs @@ -6,43 +6,43 @@ struct UnitTest; #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -struct TuppleTestF32(f32); +struct TupleTestF32(f32); #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -struct TuppleTestU64(u64); +struct TupleTestU64(u64); #[derive(Component, Reflect, Default, Debug, Deref, DerefMut)] #[reflect(Component)] -pub struct TuppleTestStr(String); +pub struct TupleTestStr(String); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTest2(f32, u64, String); +struct TupleTest2(f32, u64, String); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTestBool(bool); +struct TupleTestBool(bool); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec2(Vec2); +struct TupleVec2(Vec2); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec3(Vec3); +struct TupleVec3(Vec3); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVec(Vec); +struct TupleVec(Vec); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleVecF32F32(Vec<(f32, f32)>); +struct TupleVecF32F32(Vec<(f32, f32)>); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -struct TuppleTestColor(Color); +struct TupleTestColor(Color); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] @@ -70,8 +70,8 @@ pub struct NestingTestLevel2 { text: String, enable: bool, enum_inner: EnumTest, - color: TuppleTestColor, - toggle: TuppleTestBool, + color: TupleTestColor, + toggle: TupleTestBool, basic: BasicTest, pub nested: NestingTestLevel3, colors_list: VecOfColors, @@ -80,12 +80,12 @@ pub struct NestingTestLevel2 { #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] pub struct NestingTestLevel3 { - vec: TuppleVec3, + vec: TupleVec3, } #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -pub struct NestedTuppleStuff(f32, u64, NestingTestLevel2); +pub struct NestedTupleStuff(f32, u64, NestingTestLevel2); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] @@ -100,7 +100,7 @@ pub enum EnumComplex { #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] -pub struct VecOfVec3s2(Vec); +pub struct VecOfVec3s2(Vec); #[derive(Component, Reflect, Default, Debug)] #[reflect(Component)] @@ -110,26 +110,26 @@ impl Plugin for ComponentsTestPlugin { fn build(&self, app: &mut App) { app.register_type::() .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() - .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() + .register_type::() .register_type::() - .register_type::() - .register_type::() + .register_type::() + .register_type::() .register_type::>() .register_type::() .register_type::() - .register_type::() + .register_type::() .register_type::() .register_type::() - .register_type::() + .register_type::() .register_type::<(f32, f32)>() .register_type::>() - .register_type::>() + .register_type::>() .register_type::>() .register_type::(); } diff --git a/examples/bevy_gltf_blueprints/multiple_levels/Cargo.toml b/examples/common/Cargo.toml similarity index 70% rename from examples/bevy_gltf_blueprints/multiple_levels/Cargo.toml rename to examples/common/Cargo.toml index ac7991e..9f19715 100644 --- a/examples/bevy_gltf_blueprints/multiple_levels/Cargo.toml +++ b/examples/common/Cargo.toml @@ -1,12 +1,12 @@ [package] -name = "bevy_gltf_blueprints_multiple_levels" -version = "0.3.0" +name = "bevy_gltf_worlflow_examples_common" +version = "0.1.0" edition = "2021" license = "MIT OR Apache-2.0" [dependencies] bevy="0.12" -bevy_gltf_blueprints = { path = "../../../crates/bevy_gltf_blueprints" } +bevy_gltf_blueprints = { path = "../../crates/bevy_gltf_blueprints" } bevy_rapier3d = { version = "0.23.0", features = [ "serde-serialize", "debug-render-3d", "enhanced-determinism"] } bevy_asset_loader = { version = "0.18", features = ["standard_dynamic_assets" ]} bevy_editor_pls = { version = "0.6" } diff --git a/examples/bevy_gltf_blueprints/animation/src/assets/assets_core.rs b/examples/common/src/assets/assets_core.rs similarity index 100% rename from examples/bevy_gltf_blueprints/animation/src/assets/assets_core.rs rename to examples/common/src/assets/assets_core.rs diff --git a/examples/common/src/assets/assets_game.rs b/examples/common/src/assets/assets_game.rs new file mode 100644 index 0000000..988e964 --- /dev/null +++ b/examples/common/src/assets/assets_game.rs @@ -0,0 +1,24 @@ +use bevy::gltf::Gltf; +use bevy::prelude::*; +use bevy::utils::HashMap; +use bevy_asset_loader::prelude::*; + +#[derive(AssetCollection, Resource)] +pub struct GameAssets { + #[asset(key = "world")] + pub world: Handle, + + #[asset(key = "world_dynamic", optional)] + pub world_dynamic: Option>, + + #[asset(key = "level1", optional)] + pub level1: Option>, + #[asset(key = "level2", optional)] + pub level2: Option>, + + #[asset(key = "models", collection(typed, mapped))] + pub models: HashMap>, + + #[asset(key = "materials", collection(typed, mapped), optional)] + pub materials: Option>>, +} diff --git a/examples/bevy_gltf_blueprints/animation/src/assets/mod.rs b/examples/common/src/assets/mod.rs similarity index 100% rename from examples/bevy_gltf_blueprints/animation/src/assets/mod.rs rename to examples/common/src/assets/mod.rs diff --git a/examples/common/src/core/audio/mod.rs b/examples/common/src/core/audio/mod.rs new file mode 100644 index 0000000..24b7949 --- /dev/null +++ b/examples/common/src/core/audio/mod.rs @@ -0,0 +1,21 @@ +use bevy::prelude::*; + +#[derive(Component, Reflect, Default, Debug)] +#[reflect(Component)] +pub enum SoundMaterial { + Metal, + Wood, + Rock, + Cloth, + Squishy, + #[default] + None, +} + + +pub struct AudioPlugin; +impl Plugin for AudioPlugin { + fn build(&self, app: &mut App) { + app.register_type::(); + } +} diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/core/camera/camera_replace_proxies.rs b/examples/common/src/core/camera/camera_replace_proxies.rs similarity index 98% rename from examples/bevy_gltf_blueprints/basic_scene_components/src/core/camera/camera_replace_proxies.rs rename to examples/common/src/core/camera/camera_replace_proxies.rs index 76c8602..c72e84a 100644 --- a/examples/bevy_gltf_blueprints/basic_scene_components/src/core/camera/camera_replace_proxies.rs +++ b/examples/common/src/core/camera/camera_replace_proxies.rs @@ -10,6 +10,7 @@ use super::CameraTrackingOffset; #[reflect(Component)] pub struct SSAOSettings; +#[allow(clippy::type_complexity)] pub fn camera_replace_proxies( mut commands: Commands, mut added_cameras: Query< diff --git a/examples/bevy_registry_export/basic/src/core/camera/camera_tracking.rs b/examples/common/src/core/camera/camera_tracking.rs similarity index 98% rename from examples/bevy_registry_export/basic/src/core/camera/camera_tracking.rs rename to examples/common/src/core/camera/camera_tracking.rs index c498617..208e605 100644 --- a/examples/bevy_registry_export/basic/src/core/camera/camera_tracking.rs +++ b/examples/common/src/core/camera/camera_tracking.rs @@ -30,6 +30,7 @@ impl Default for CameraTrackingOffset { /// Add this component to an entity if you want it to be tracked by a Camera pub struct CameraTrackable; +#[allow(clippy::type_complexity)] pub fn camera_track( mut tracking_cameras: Query< (&mut Transform, &CameraTrackingOffset), diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/core/camera/mod.rs b/examples/common/src/core/camera/mod.rs similarity index 100% rename from examples/bevy_gltf_blueprints/basic_scene_components/src/core/camera/mod.rs rename to examples/common/src/core/camera/mod.rs diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/core/lighting/lighting_replace_proxies.rs b/examples/common/src/core/lighting/lighting_replace_proxies.rs similarity index 100% rename from examples/bevy_gltf_blueprints/basic_scene_components/src/core/lighting/lighting_replace_proxies.rs rename to examples/common/src/core/lighting/lighting_replace_proxies.rs diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/core/lighting/mod.rs b/examples/common/src/core/lighting/mod.rs similarity index 100% rename from examples/bevy_gltf_blueprints/basic_scene_components/src/core/lighting/mod.rs rename to examples/common/src/core/lighting/mod.rs diff --git a/examples/bevy_gltf_components/basic/src/core/mod.rs b/examples/common/src/core/mod.rs similarity index 85% rename from examples/bevy_gltf_components/basic/src/core/mod.rs rename to examples/common/src/core/mod.rs index d6d4775..8c75182 100644 --- a/examples/bevy_gltf_components/basic/src/core/mod.rs +++ b/examples/common/src/core/mod.rs @@ -4,13 +4,14 @@ pub use camera::*; pub mod lighting; pub use lighting::*; -pub mod relationships; -pub use relationships::*; +//pub mod relationships; +//pub use relationships::*; pub mod physics; pub use physics::*; use bevy::prelude::*; + pub struct CorePlugin; impl Plugin for CorePlugin { fn build(&self, app: &mut App) { diff --git a/examples/bevy_gltf_save_load/basic/src/core/physics/controls.rs b/examples/common/src/core/physics/controls.rs similarity index 100% rename from examples/bevy_gltf_save_load/basic/src/core/physics/controls.rs rename to examples/common/src/core/physics/controls.rs diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/core/physics/mod.rs b/examples/common/src/core/physics/mod.rs similarity index 100% rename from examples/bevy_gltf_blueprints/basic_scene_components/src/core/physics/mod.rs rename to examples/common/src/core/physics/mod.rs diff --git a/examples/bevy_gltf_blueprints/animation/src/core/physics/physics_replace_proxies.rs b/examples/common/src/core/physics/physics_replace_proxies.rs similarity index 99% rename from examples/bevy_gltf_blueprints/animation/src/core/physics/physics_replace_proxies.rs rename to examples/common/src/core/physics/physics_replace_proxies.rs index b91462c..498c482 100644 --- a/examples/bevy_gltf_blueprints/animation/src/core/physics/physics_replace_proxies.rs +++ b/examples/common/src/core/physics/physics_replace_proxies.rs @@ -25,6 +25,7 @@ pub enum AutoAABBCollider { } // replaces all physics stand-ins with the actual rapier types +#[allow(clippy::type_complexity)] pub fn physics_replace_proxies( meshes: Res>, mesh_handles: Query<&Handle>, diff --git a/examples/bevy_gltf_blueprints/animation/src/core/physics/utils.rs b/examples/common/src/core/physics/utils.rs similarity index 100% rename from examples/bevy_gltf_blueprints/animation/src/core/physics/utils.rs rename to examples/common/src/core/physics/utils.rs diff --git a/examples/bevy_gltf_blueprints/animation/src/core/relationships/mod.rs b/examples/common/src/core/relationships/mod.rs similarity index 100% rename from examples/bevy_gltf_blueprints/animation/src/core/relationships/mod.rs rename to examples/common/src/core/relationships/mod.rs diff --git a/examples/bevy_gltf_blueprints/animation/src/core/relationships/relationships_insert_dependant_components.rs b/examples/common/src/core/relationships/relationships_insert_dependant_components.rs similarity index 100% rename from examples/bevy_gltf_blueprints/animation/src/core/relationships/relationships_insert_dependant_components.rs rename to examples/common/src/core/relationships/relationships_insert_dependant_components.rs diff --git a/examples/common/src/game/interactions/mod.rs b/examples/common/src/game/interactions/mod.rs new file mode 100644 index 0000000..4e01590 --- /dev/null +++ b/examples/common/src/game/interactions/mod.rs @@ -0,0 +1,11 @@ +#[derive(Component, Reflect, Default, Debug)] +#[reflect(Component)] +/// Demo marker component +pub struct Interactible; + +pub struct InteractionsPlugin; +impl Plugin for InteractionsPlugin { + fn build(&self, app: &mut App) { + app.register_type::(); + } +} diff --git a/examples/common/src/game/mod.rs b/examples/common/src/game/mod.rs new file mode 100644 index 0000000..50dab57 --- /dev/null +++ b/examples/common/src/game/mod.rs @@ -0,0 +1,36 @@ +/*pub mod in_game; +pub use in_game::*; + +pub mod in_main_menu; +pub use in_main_menu::*;*/ + +pub mod player; +pub use player::*; + +pub mod picking; +pub use picking::*; + +/* +use crate::{ + state::{AppState, GameState}, +};*/ +use bevy::prelude::*; + +pub struct GamePlugin; +impl Plugin for GamePlugin { + fn build(&self, app: &mut App) { + app.add_plugins(( + PlayerPlugin, + PickingPlugin + )) + /* .register_type::() + .register_type::() + .register_type::() + + .add_systems(OnEnter(AppState::MenuRunning), setup_main_menu) + .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);*/ + ; + } +} diff --git a/examples/bevy_gltf_blueprints/basic_scene_components/src/game/picking.rs b/examples/common/src/game/picking/mod.rs similarity index 98% rename from examples/bevy_gltf_blueprints/basic_scene_components/src/game/picking.rs rename to examples/common/src/game/picking/mod.rs index 6731bbb..a237e5c 100644 --- a/examples/bevy_gltf_blueprints/basic_scene_components/src/game/picking.rs +++ b/examples/common/src/game/picking/mod.rs @@ -1,4 +1,4 @@ -use super::Player; +use crate::Player; use bevy::prelude::*; use bevy_gltf_blueprints::GltfBlueprintsSet; diff --git a/examples/common/src/game/player/mod.rs b/examples/common/src/game/player/mod.rs new file mode 100644 index 0000000..f8ef408 --- /dev/null +++ b/examples/common/src/game/player/mod.rs @@ -0,0 +1,40 @@ +use bevy::prelude::*; + +use crate::GameState; + +#[derive(Component, Reflect, Default, Debug)] +#[reflect(Component)] +/// Demo marker component +pub struct Player; + +fn player_move_demo( + keycode: Res>, + mut players: Query<&mut Transform, With>, +) { + let speed = 0.2; + if let Ok(mut player) = players.get_single_mut() { + if keycode.pressed(KeyCode::Left) { + player.translation.x += speed; + } + if keycode.pressed(KeyCode::Right) { + player.translation.x -= speed; + } + + if keycode.pressed(KeyCode::Up) { + player.translation.z += speed; + } + if keycode.pressed(KeyCode::Down) { + player.translation.z -= speed; + } + } +} + +pub struct PlayerPlugin; +impl Plugin for PlayerPlugin { + fn build(&self, app: &mut App) { + app.register_type::().add_systems( + Update, + (player_move_demo,).run_if(in_state(GameState::InGame)), + ); + } +} diff --git a/examples/common/src/lib.rs b/examples/common/src/lib.rs new file mode 100644 index 0000000..c41040c --- /dev/null +++ b/examples/common/src/lib.rs @@ -0,0 +1,20 @@ +pub mod state; +pub use state::*; + +pub mod assets; +use assets::*; + +pub mod core; +pub use core::*; + +pub mod game; +pub use game::*; + +use bevy::prelude::*; + +pub struct CommonPlugin; +impl Plugin for CommonPlugin { + fn build(&self, app: &mut App) { + app.add_plugins((StatePlugin, AssetsPlugin, CorePlugin, GamePlugin)); + } +} diff --git a/examples/bevy_gltf_save_load/basic/src/state.rs b/examples/common/src/state.rs similarity index 100% rename from examples/bevy_gltf_save_load/basic/src/state.rs rename to examples/common/src/state.rs