mirror of
https://github.com/bevyengine/bevy
synced 2024-11-21 20:23:28 +00:00
remove "asset scopes" now that resources are separate from world
This commit is contained in:
parent
f6dd6a5ca9
commit
91a6c0d9db
9 changed files with 26 additions and 55 deletions
|
@ -74,10 +74,8 @@ fn main() {
|
|||
}
|
||||
|
||||
fn setup(world: &mut World, resources: &mut Resources) {
|
||||
let cube_handle = {
|
||||
let mut mesh_storage = resources.get_mut::<AssetStorage<Mesh>>().unwrap();
|
||||
mesh_storage.add(Mesh::load(MeshType::Cube))
|
||||
};
|
||||
let mut mesh_storage = resources.get_mut::<AssetStorage<Mesh>>().unwrap();
|
||||
let cube_handle = mesh_storage.add(Mesh::load(MeshType::Cube));
|
||||
|
||||
world
|
||||
.build()
|
||||
|
|
|
@ -161,13 +161,9 @@ fn create_entities_builder_archetype(
|
|||
}
|
||||
|
||||
fn setup(world: &mut World, resources: &mut Resources) {
|
||||
let cube = Mesh::load(MeshType::Cube);
|
||||
let plane = Mesh::load(MeshType::Plane { size: 10.0 });
|
||||
|
||||
let (cube_handle, plane_handle) = {
|
||||
let mut mesh_storage = resources.get_mut::<AssetStorage<Mesh>>().unwrap();
|
||||
(mesh_storage.add(cube), mesh_storage.add(plane))
|
||||
};
|
||||
let mut mesh_storage = resources.get_mut::<AssetStorage<Mesh>>().unwrap();
|
||||
let cube_handle = mesh_storage.add(Mesh::load(MeshType::Cube));
|
||||
let plane_handle = mesh_storage.add(Mesh::load(MeshType::Plane { size: 10.0 }));
|
||||
|
||||
// no-archetype precompile: 1.24 sec
|
||||
// archetype precompile: 1.07 sec
|
||||
|
|
|
@ -30,11 +30,8 @@ fn main() {
|
|||
}
|
||||
|
||||
fn setup(world: &mut World, resources: &mut Resources) {
|
||||
let cube = Mesh::load(MeshType::Cube);
|
||||
let cube_handle = {
|
||||
let mut mesh_storage = resources.get_mut::<AssetStorage<Mesh>>().unwrap();
|
||||
mesh_storage.add(cube)
|
||||
};
|
||||
let mut mesh_storage = resources.get_mut::<AssetStorage<Mesh>>().unwrap();
|
||||
let cube_handle = mesh_storage.add(Mesh::load(MeshType::Cube));
|
||||
|
||||
world.insert(
|
||||
(),
|
||||
|
|
|
@ -23,9 +23,8 @@ fn build_rotator_system() -> Box<dyn Schedulable> {
|
|||
}
|
||||
|
||||
fn setup(world: &mut World, resources: &mut Resources) {
|
||||
let cube = Mesh::load(MeshType::Cube);
|
||||
let mut mesh_storage = resources.get_mut::<AssetStorage<Mesh>>().unwrap();
|
||||
let cube_handle = mesh_storage.add(cube);
|
||||
let cube_handle = mesh_storage.add(Mesh::load(MeshType::Cube));
|
||||
|
||||
world
|
||||
.build()
|
||||
|
|
|
@ -15,13 +15,9 @@ impl AppPlugin for ExamplePlugin {
|
|||
}
|
||||
|
||||
pub fn setup(world: &mut World, resources: &mut Resources) {
|
||||
let cube = Mesh::load(MeshType::Cube);
|
||||
let plane = Mesh::load(MeshType::Plane { size: 10.0 });
|
||||
|
||||
let (cube_handle, plane_handle) = {
|
||||
let mut mesh_storage = resources.get_mut::<AssetStorage<Mesh>>().unwrap();
|
||||
(mesh_storage.add(cube), mesh_storage.add(plane))
|
||||
};
|
||||
let mut mesh_storage = resources.get_mut::<AssetStorage<Mesh>>().unwrap();
|
||||
let cube_handle = mesh_storage.add(Mesh::load(MeshType::Cube));
|
||||
let plane_handle = mesh_storage.add(Mesh::load(MeshType::Plane { size: 10.0 }));
|
||||
|
||||
world.build()
|
||||
// plane
|
||||
|
|
|
@ -5,13 +5,9 @@ fn main() {
|
|||
}
|
||||
|
||||
fn setup(world: &mut World, resources: &mut Resources) {
|
||||
let cube = Mesh::load(MeshType::Cube);
|
||||
let plane = Mesh::load(MeshType::Plane { size: 10.0 });
|
||||
|
||||
let (cube_handle, plane_handle) = {
|
||||
let mut mesh_storage = resources.get_mut::<AssetStorage<Mesh>>().unwrap();
|
||||
(mesh_storage.add(cube), mesh_storage.add(plane))
|
||||
};
|
||||
let mut mesh_storage = resources.get_mut::<AssetStorage<Mesh>>().unwrap();
|
||||
let cube_handle = mesh_storage.add(Mesh::load(MeshType::Cube));
|
||||
let plane_handle = mesh_storage.add(Mesh::load(MeshType::Plane { size: 10.0 }));
|
||||
|
||||
world
|
||||
.build()
|
||||
|
|
|
@ -62,13 +62,9 @@ fn build_print_status_system() -> Box<dyn Schedulable> {
|
|||
}
|
||||
|
||||
fn setup(world: &mut World, resources: &mut Resources) {
|
||||
let cube = Mesh::load(MeshType::Cube);
|
||||
let plane = Mesh::load(MeshType::Plane { size: 10.0 });
|
||||
|
||||
let (cube_handle, plane_handle) = {
|
||||
let mut mesh_storage = resources.get_mut::<AssetStorage<Mesh>>().unwrap();
|
||||
(mesh_storage.add(cube), mesh_storage.add(plane))
|
||||
};
|
||||
let mut mesh_storage = resources.get_mut::<AssetStorage<Mesh>>().unwrap();
|
||||
let cube_handle = mesh_storage.add(Mesh::load(MeshType::Cube));
|
||||
let plane_handle = mesh_storage.add(Mesh::load(MeshType::Plane { size: 10.0 }));
|
||||
|
||||
let mut builder = world
|
||||
.build()
|
||||
|
|
|
@ -5,18 +5,14 @@ fn main() {
|
|||
}
|
||||
|
||||
fn setup(world: &mut World, resources: &mut Resources) {
|
||||
let cube_handle = {
|
||||
let mut mesh_storage = resources.get_mut::<AssetStorage<Mesh>>().unwrap();
|
||||
mesh_storage.add(Mesh::load(MeshType::Cube))
|
||||
};
|
||||
let mut mesh_storage = resources.get_mut::<AssetStorage<Mesh>>().unwrap();
|
||||
let cube_handle = mesh_storage.add(Mesh::load(MeshType::Cube));
|
||||
|
||||
let texture_handle = {
|
||||
let mut texture_storage = resources.get_mut::<AssetStorage<Texture>>().unwrap();
|
||||
let texture = Texture::load(TextureType::Png(
|
||||
concat!(env!("CARGO_MANIFEST_DIR"), "/assets/temp_bevy_logo.png").to_string(),
|
||||
));
|
||||
texture_storage.add(texture)
|
||||
};
|
||||
let mut texture_storage = resources.get_mut::<AssetStorage<Texture>>().unwrap();
|
||||
let texture = Texture::load(TextureType::Png(
|
||||
concat!(env!("CARGO_MANIFEST_DIR"), "/assets/temp_bevy_logo.png").to_string(),
|
||||
));
|
||||
let texture_handle = texture_storage.add(texture);
|
||||
|
||||
world
|
||||
.build()
|
||||
|
|
|
@ -5,11 +5,8 @@ fn main() {
|
|||
}
|
||||
|
||||
fn setup(world: &mut World, resources: &mut Resources) {
|
||||
let cube = Mesh::load(MeshType::Cube);
|
||||
let cube_handle = {
|
||||
let mut mesh_storage = resources.get_mut::<AssetStorage<Mesh>>().unwrap();
|
||||
mesh_storage.add(cube)
|
||||
};
|
||||
let mut mesh_storage = resources.get_mut::<AssetStorage<Mesh>>().unwrap();
|
||||
let cube_handle = mesh_storage.add(Mesh::load(MeshType::Cube));
|
||||
|
||||
world
|
||||
.build()
|
||||
|
|
Loading…
Reference in a new issue