Skip to content

Commit

Permalink
ecs: use generational entity ids and other optimizations
Browse files Browse the repository at this point in the history
  • Loading branch information
cart committed Sep 17, 2020
1 parent 34c6f5f commit a1f127d
Show file tree
Hide file tree
Showing 35 changed files with 1,202 additions and 750 deletions.
22 changes: 11 additions & 11 deletions assets/scenes/load_scene_example.scn
Original file line number Diff line number Diff line change
@@ -1,30 +1,30 @@
[
(
entity: 328997855,
entity: 0,
components: [
{
"type": "ComponentA",
"type": "ComponentB",
"map": {
"x": 3.0,
"y": 4.0,
"value": "hello",
},
},
],
),
(
entity: 404566393,
components: [
{
"type": "ComponentA",
"map": {
"x": 1.0,
"y": 2.0,
},
},
],
),
(
entity: 1,
components: [
{
"type": "ComponentB",
"type": "ComponentA",
"map": {
"value": "hello",
"x": 3.0,
"y": 4.0,
},
},
],
Expand Down
6 changes: 4 additions & 2 deletions crates/bevy_app/src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ impl App {
}

pub fn update(&mut self) {
self.schedule.initialize(&mut self.resources);
self.schedule
.initialize(&mut self.world, &mut self.resources);
self.executor
.run(&mut self.schedule, &mut self.world, &mut self.resources);
}
Expand All @@ -69,7 +70,8 @@ impl App {
.unwrap_or_else(DefaultTaskPoolOptions::default)
.create_default_pools(&mut self.resources);

self.startup_schedule.initialize(&mut self.resources);
self.startup_schedule
.initialize(&mut self.world, &mut self.resources);
self.startup_executor.run(
&mut self.startup_schedule,
&mut self.world,
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_ecs/hecs/benches/bench.rs
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ fn iterate_100k(b: &mut Bencher) {
world.spawn((Position(-(i as f32)), Velocity(i as f32)));
}
b.iter(|| {
for (mut pos, vel) in &mut world.query::<(&mut Position, &Velocity)>() {
for (mut pos, vel) in &mut world.query_mut::<(&mut Position, &Velocity)>() {
pos.0 += vel.0;
}
})
Expand Down
39 changes: 0 additions & 39 deletions crates/bevy_ecs/hecs/examples/format.rs

This file was deleted.

Loading

0 comments on commit a1f127d

Please sign in to comment.