Clean up now-unused files due to changes in the transform system (#849)

This commit is contained in:
Nathan Stocks 2020-11-12 18:24:41 -07:00 committed by GitHub
parent e03f17ba7f
commit a0b16e8620
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 0 additions and 260 deletions

View File

@ -1,156 +0,0 @@
// extern crate legion;
// extern crate legion_transform;
// use legion::prelude::*;
// use legion_transform::prelude::*;
fn main() {}
// #[allow(unused)]
// fn tldr_sample() {
// // Create a normal Legion World
// let mut world = Universe::default().create_world();
// // Create a system bundle (vec of systems) for LegionTransform
// let transform_system_bundle = transform_system_bundle::build(&mut world);
// let parent_entity = *world
// .insert(
// (),
// vec![(
// // Always needed for an Entity that has any space transform
// LocalToWorld::identity(),
// // The only mutable space transform a parent has is a translation.
// Translation::new(100.0, 0.0, 0.0),
// )],
// )
// .first()
// .unwrap();
// world.insert(
// (),
// vec![
// (
// // Again, always need a `LocalToWorld` component for the Entity to have a custom
// // space transform.
// LocalToWorld::identity(),
// // Here we define a Translation, Rotation and uniform Scale.
// Translation::new(1.0, 2.0, 3.0),
// Rotation::from_euler_angles(3.14, 0.0, 0.0),
// Scale(2.0),
// // Add a Parent and LocalToParent component to attach a child to a parent.
// Parent(parent_entity),
// LocalToParent::identity(),
// );
// 4
// ],
// );
// }
// fn main() {
// // Create a normal Legion World
// let mut world = Universe::default().create_world();
// // Create a system bundle (vec of systems) for LegionTransform
// let transform_system_bundle = transform_system_bundle::build(&mut world);
// // See `./types_of_transforms.rs` for an explanation of space-transform types.
// let parent_entity = *world
// .insert(
// (),
// vec![(LocalToWorld::identity(), Translation::new(100.0, 0.0, 0.0))],
// )
// .first()
// .unwrap();
// let four_children: Vec<_> = world
// .insert(
// (),
// vec![
// (
// LocalToWorld::identity(),
// Translation::new(1.0, 2.0, 3.0),
// Rotation::from_euler_angles(3.14, 0.0, 0.0),
// Scale(2.0),
// // Add a Parent and LocalToParent component to attach a child to a parent.
// Parent(parent_entity),
// LocalToParent::identity(),
// );
// 4
// ],
// )
// .iter()
// .cloned()
// .collect();
// // At this point the parent does NOT have a `Children` component attached to it. The `Children`
// // component is updated by the transform system bundle and thus can be out of date (or
// // non-existent for newly added members). By this logic, the `Parent` components should be
// // considered the always-correct 'source of truth' for any hierarchy.
// for system in transform_system_bundle.iter() {
// system.run(&mut world);
// system.command_buffer_mut().write(&mut world);
// }
// // At this point all parents with children have a correct `Children` component.
// let parents_children = world
// .get_component::<Children>(parent_entity)
// .unwrap()
// .0
// .clone();
// println!("Parent {}", parent_entity);
// for child in parents_children.iter() {
// println!(" -> Has child: {}", child);
// }
// // Each child will also have a `LocalToParent` component attached to it, which is a
// // space-transform from its local space to that of its parent.
// for child in four_children.iter() {
// println!("The child {}", child);
// println!(
// " -> Has a LocalToParent matrix: {}",
// *world.get_component::<LocalToParent>(*child).unwrap()
// );
// println!(
// " -> Has a LocalToWorld matrix: {}",
// *world.get_component::<LocalToWorld>(*child).unwrap()
// );
// }
// // Re-parent the second child to be a grandchild of the first.
// world.add_component(four_children[1], Parent(four_children[0]));
// // Re-running the system will cleanup and fix all `Children` components.
// for system in transform_system_bundle.iter() {
// system.run(&world);
// system.command_buffer_mut().write(&mut world);
// }
// println!("After the second child was re-parented as a grandchild of the first child...");
// for child in world
// .get_component::<Children>(parent_entity)
// .unwrap()
// .0
// .iter()
// {
// println!("Parent {} has child: {}", parent_entity, child);
// }
// for grandchild in world
// .get_component::<Children>(four_children[0])
// .unwrap()
// .0
// .iter()
// {
// println!("Child {} has grandchild: {}", four_children[0], grandchild);
// }
// println!("Grandchild: {}", four_children[1]);
// println!(
// " -> Has a LocalToWorld matrix: {}",
// *world
// .get_component::<LocalToWorld>(four_children[1])
// .unwrap()
// );
// }

View File

@ -1,94 +0,0 @@
// extern crate legion;
// // extern crate legion_transform;
// use legion::prelude::*;
// use legion_transform::prelude::*;
fn main() {}
// fn main() {
// // Create a normal Legion World
// let mut world = Universe::default().create_world();
// // Create a system bundle (vec of systems) for LegionTransform
// let transform_system_bundle = transform_system_bundle::build(&mut world);
// // A user-defined space transform is split into 4 different components: [`Translation`,
// // `Rotation`, `Scale`, `NonUniformScale`]. Any combination of these components can be added to
// // an entity to transform it's space (exception: `Scale` and `NonUniformScale` are mutually
// // exclusive).
// // Note that all entities need an explicitly added `LocalToWorld` component to be considered for
// // processing during transform system passes.
// // Add an entity with just a Translation
// // See: https://www.nalgebra.org/rustdoc/nalgebra/geometry/struct.Translation.html
// // API on Translation, as a LegionTransform `Translation` is just a nalgebra `Translation3`.
// world.insert(
// (),
// vec![(LocalToWorld::identity(), Translation::new(1.0, 2.0, 3.0))],
// );
// // Add an entity with just a Rotation.
// // See: https://www.nalgebra.org/rustdoc/nalgebra/geometry/type.UnitQuaternion.html for the full
// // API on Rotation, as a LegionTransform `Rotation` is just a nalgebra `UnityQuaternion`.
// world.insert(
// (),
// vec![(
// LocalToWorld::identity(),
// Rotation::from_euler_angles(3.14, 0.0, 0.0),
// )],
// );
// // Add an entity with just a uniform Scale (the default and strongly-preferred scale component).
// // This is simply a `f32` wrapper.
// world.insert((), vec![(LocalToWorld::identity(), Scale(2.0))]);
// // Add an entity with just a NonUniformScale (This should be avoided unless you **really** need
// // non-uniform scaling as it breaks things like physics colliders.
// // See: https://docs.rs/nalgebra/0.10.1/nalgebra/struct.Vector3.html for the full API on
// // NonUniformScale, as a LegionTransform `NonUniformScale` is simply a nalgebra `Vector3`,
// // although note that it is wrapped in a tuple-struct.
// world.insert(
// (),
// vec![(
// LocalToWorld::identity(),
// NonUniformScale::new(1.0, 2.0, 1.0),
// )],
// );
// // Add an entity with a combination of Translation and Rotation
// world.insert(
// (),
// vec![(
// LocalToWorld::identity(),
// Translation::new(1.0, 2.0, 3.0),
// Rotation::from_euler_angles(3.14, 0.0, 0.0),
// )],
// );
// // Add an entity with a combination of Translation and Rotation and uniform Scale.
// world.insert(
// (),
// vec![(
// LocalToWorld::identity(),
// Translation::new(1.0, 2.0, 3.0),
// Rotation::from_euler_angles(3.14, 0.0, 0.0),
// Scale(2.0),
// )],
// );
// // Run the system bundle (this API will likely change).
// for system in transform_system_bundle.iter() {
// system.run(&world);
// system.command_buffer_mut().write(&mut world);
// }
// // At this point all `LocalToWorld` components have correct values in them. Running the system
// // again will result in a short-circuit as only changed components are considered for update.
// let mut query = <Read<LocalToWorld>>::query();
// for (entity, transform) in query.iter_entities(&mut world) {
// println!(
// "Entity {} and a LocalToWorld matrix: {}",
// entity, *transform
// );
// }
// }

View File

@ -1,10 +0,0 @@
use crate::{
hierarchy_maintenance_system, local_transform_systems::local_transform_systems,
transform_propagate_system::transform_propagate_system, transform_systems,
};
use bevy_ecs::{IntoSystem, System};
use hierarchy_maintenance_system::hierarchy_maintenance_systems;
use transform_systems::transform_systems;