PixSpace/src/scene.rs

32 lines
901 B
Rust
Raw Normal View History

2022-12-11 23:41:22 +01:00
use bevy::prelude::*;
2022-11-17 23:18:30 +01:00
pub fn build_scene(
mut commands: Commands,
mut meshes: ResMut<Assets<Mesh>>,
mut materials: ResMut<Assets<StandardMaterial>>,
) {
// plane
commands.spawn(PbrBundle {
mesh: meshes.add(Mesh::from(shape::Plane { size: 4.0 })),
2022-11-17 23:18:30 +01:00
material: materials.add(Color::rgb(0.3, 0.5, 0.3).into()),
..default()
});
// cube
commands.spawn(PbrBundle {
mesh: meshes.add(Mesh::from(shape::Cube { size: 1.0 })),
material: materials.add(Color::rgb(0.8, 0.7, 0.6).into()),
transform: Transform::from_xyz(0.0, 0.5, 0.0),
..default()
});
// light
commands.spawn(PointLightBundle {
point_light: PointLight {
intensity: 1500.0,
shadows_enabled: true,
..default()
},
transform: Transform::from_xyz(4.0, 1.0, -4.0),
2022-11-17 23:18:30 +01:00
..default()
});
2022-12-11 23:41:22 +01:00
}