Created
March 21, 2024 13:53
-
-
Save barlog-m/0d96e12f197a4f81a029dac6afe5f195 to your computer and use it in GitHub Desktop.
Bevy ambient light question
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use bevy::prelude::*; | |
fn main() { | |
App::new() | |
.add_plugins(DefaultPlugins) | |
.insert_resource(AmbientLight { | |
color: Color::default(), | |
brightness: 0.02, | |
}) | |
.add_systems(Startup, setup) | |
.run(); | |
} | |
fn setup( | |
mut commands: Commands, | |
mut meshes: ResMut<Assets<Mesh>>, | |
mut materials: ResMut<Assets<StandardMaterial>>) { | |
commands.spawn(PbrBundle { | |
mesh: meshes.add(Plane3d::default().mesh().size(10.0, 10.0)), | |
material: materials.add(StandardMaterial { | |
base_color: Color::WHITE, | |
perceptual_roughness: 1.0, | |
..default() | |
}), | |
..default() | |
}); | |
commands.spawn(Camera3dBundle { | |
transform: Transform::from_xyz(0.0, 20.0, 0.0).looking_at(Vec3::ZERO, Vec3::Z), | |
..default() | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment