update example

This commit is contained in:
Carter Anderson 2019-12-03 19:01:48 -08:00
parent 0e0eb97430
commit 25b7dad1c2
2 changed files with 27 additions and 22 deletions

View file

@ -89,9 +89,9 @@ fn build_spawner_system(world: &mut World) -> Box<dyn Schedulable> {
mesh_storage.get_named("cube").unwrap() mesh_storage.get_named("cube").unwrap()
}; };
let duration = 1000000.0; let duration = 10000.0;
let mut elapsed = duration; let mut elapsed = duration;
let batch_size = 1; let batch_size = 5;
SystemBuilder::new("Spawner") SystemBuilder::new("Spawner")
.read_resource::<Time>() .read_resource::<Time>()
@ -136,7 +136,7 @@ fn main() {
let plane = Mesh::load(MeshType::Plane{ size: 25 }); let plane = Mesh::load(MeshType::Plane{ size: 25 });
let mut mesh_storage = AssetStorage::<Mesh, MeshType>::new(); let mut mesh_storage = AssetStorage::<Mesh, MeshType>::new();
let _ = mesh_storage.add(cube, "cube"); let _cube_handle = mesh_storage.add(cube, "cube");
let plane_handle = mesh_storage.add(plane, "plane"); let plane_handle = mesh_storage.add(plane, "plane");
world.resources.insert(mesh_storage); world.resources.insert(mesh_storage);
@ -163,8 +163,8 @@ fn main() {
( (
Light { Light {
color: wgpu::Color { color: wgpu::Color {
r: 0.5, r: 0.8,
g: 1.0, g: 0.8,
b: 0.5, b: 0.5,
a: 1.0, a: 1.0,
}, },
@ -172,24 +172,29 @@ fn main() {
depth: 1.0 .. 20.0, depth: 1.0 .. 20.0,
target_view: None, target_view: None,
}, },
Material::new(math::vec4(0.5, 0.3, 0.3, 1.0) * random::<f32>()),
// cube_handle.clone(),
LocalToWorld::identity(), LocalToWorld::identity(),
Translation::new(7.0, -5.0, 10.0) Translation::new(4.0, -4.0, 5.0),
), Rotation::from_euler_angles(-math::pi::<f32>() / 2.0, 0.0, 0.0)
(
Light {
color: wgpu::Color {
r: 1.0,
g: 0.5,
b: 0.5,
a: 1.0,
},
fov: f32::to_radians(45.0),
depth: 1.0 .. 20.0,
target_view: None,
},
LocalToWorld::identity(),
Translation::new(-5.0, 7.0, 10.0)
), ),
// (
// Light {
// color: wgpu::Color {
// r: 1.0,
// g: 0.5,
// b: 0.5,
// a: 1.0,
// },
// fov: f32::to_radians(45.0),
// depth: 1.0 .. 20.0,
// target_view: None,
// },
// // Material::new(math::vec4(0.5, 0.3, 0.3, 1.0) * random::<f32>()),
// // cube_handle.clone(),
// LocalToWorld::identity(),
// Translation::new(-5.0, 7.0, 10.0)
// ),
]); ]);
world.insert((), vec![ world.insert((), vec![

View file

@ -209,7 +209,7 @@ impl Application {
let (window, hidpi_factor, size, surface) = { let (window, hidpi_factor, size, surface) = {
let window = winit::window::Window::new(&event_loop).unwrap(); let window = winit::window::Window::new(&event_loop).unwrap();
window.set_title("bevy"); window.set_title("bevy");
window.set_inner_size((1920, 1080).into()); window.set_inner_size((1280, 720).into());
let hidpi_factor = window.hidpi_factor(); let hidpi_factor = window.hidpi_factor();
let size = window.inner_size().to_physical(hidpi_factor); let size = window.inner_size().to_physical(hidpi_factor);
let surface = wgpu::Surface::create(&window); let surface = wgpu::Surface::create(&window);