1use bevy::prelude::*;
4
5fn main() {
6 App::new()
7 .add_plugins(DefaultPlugins)
8 .add_systems(Startup, setup)
9 .run();
10}
11
12fn setup(
14 mut commands: Commands,
15 mut meshes: ResMut<Assets<Mesh>>,
16 mut materials: ResMut<Assets<StandardMaterial>>,
17) {
18 commands.spawn((
20 Mesh3d(meshes.add(Plane3d::default().mesh().size(5.0, 5.0))),
21 MeshMaterial3d(materials.add(Color::srgb(0.3, 0.5, 0.3))),
22 ));
23
24 commands.spawn((
26 Mesh3d(meshes.add(Cuboid::default())),
27 MeshMaterial3d(materials.add(Color::srgb(0.8, 0.7, 0.6))),
28 Transform::from_xyz(0.0, 0.5, 0.0),
29 ));
30
31 commands.spawn((
33 PointLight {
34 shadows_enabled: true,
35 ..default()
36 },
37 Transform::from_xyz(4.0, 8.0, 4.0),
38 ));
39
40 commands.spawn((
42 Camera3d::default(),
43 Transform::from_xyz(-2.0, 2.5, 5.0).looking_at(Vec3::ZERO, Vec3::Y),
44 ));
45
46 commands.spawn((
48 Camera3d::default(),
49 Camera {
50 order: 1,
52 clear_color: ClearColorConfig::None,
53 ..default()
54 },
55 Transform::from_xyz(10.0, 10., -5.0).looking_at(Vec3::ZERO, Vec3::Y),
56 ));
57}