2020-07-30 01:15:15 +00:00
|
|
|
use bevy::prelude::*;
|
|
|
|
|
|
|
|
/// This example shows how to configure Multi-Sample Anti-Aliasing. Setting the sample count higher will result in smoother edges,
|
|
|
|
/// but it will also increase the cost to render those edges. The range should generally be somewhere between 1 (no multi sampling,
|
|
|
|
/// but cheap) to 8 (crisp but expensive)
|
|
|
|
fn main() {
|
|
|
|
App::build()
|
2021-01-30 20:55:13 +00:00
|
|
|
.insert_resource(Msaa { samples: 4 })
|
2020-11-03 03:01:17 +00:00
|
|
|
.add_plugins(DefaultPlugins)
|
2020-12-16 05:57:16 +00:00
|
|
|
.add_startup_system(setup.system())
|
2020-07-30 01:15:15 +00:00
|
|
|
.run();
|
|
|
|
}
|
|
|
|
|
|
|
|
/// set up a simple 3D scene
|
|
|
|
fn setup(
|
2020-11-08 20:34:05 +00:00
|
|
|
commands: &mut Commands,
|
2020-07-30 01:15:15 +00:00
|
|
|
mut meshes: ResMut<Assets<Mesh>>,
|
|
|
|
mut materials: ResMut<Assets<StandardMaterial>>,
|
|
|
|
) {
|
|
|
|
// add entities to the world
|
|
|
|
commands
|
|
|
|
// cube
|
2020-11-16 04:32:23 +00:00
|
|
|
.spawn(PbrBundle {
|
2020-11-21 22:51:24 +00:00
|
|
|
mesh: meshes.add(Mesh::from(shape::Cube { size: 2.0 })),
|
2020-10-12 23:54:22 +00:00
|
|
|
material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()),
|
2020-07-30 01:15:15 +00:00
|
|
|
..Default::default()
|
|
|
|
})
|
|
|
|
// light
|
2020-11-16 04:32:23 +00:00
|
|
|
.spawn(LightBundle {
|
2021-01-07 01:17:06 +00:00
|
|
|
transform: Transform::from_xyz(4.0, 8.0, 4.0),
|
2020-07-30 01:15:15 +00:00
|
|
|
..Default::default()
|
|
|
|
})
|
|
|
|
// camera
|
2021-01-30 10:31:03 +00:00
|
|
|
.spawn(PerspectiveCameraBundle {
|
2021-01-07 01:17:06 +00:00
|
|
|
transform: Transform::from_xyz(-3.0, 3.0, 5.0)
|
2020-10-18 20:48:15 +00:00
|
|
|
.looking_at(Vec3::default(), Vec3::unit_y()),
|
2020-07-30 01:15:15 +00:00
|
|
|
..Default::default()
|
|
|
|
});
|
|
|
|
}
|