initial working demo sans networking
Signed-off-by: Sienna Meridian Satterwhite <sienna@r3t.io>
This commit is contained in:
53
crates/app/src/rendering.rs
Normal file
53
crates/app/src/rendering.rs
Normal file
@@ -0,0 +1,53 @@
|
||||
//! Lighting and ground plane setup
|
||||
|
||||
use bevy::prelude::*;
|
||||
|
||||
pub struct RenderingPlugin;
|
||||
|
||||
impl Plugin for RenderingPlugin {
|
||||
fn build(&self, app: &mut App) {
|
||||
app.add_systems(Startup, setup_lighting_and_ground);
|
||||
}
|
||||
}
|
||||
|
||||
/// Set up lighting and ground plane
|
||||
///
|
||||
/// Creates a directional light (sun), ambient light, and a green ground plane.
|
||||
/// Camera setup is handled separately in the camera module.
|
||||
fn setup_lighting_and_ground(
|
||||
mut commands: Commands,
|
||||
mut meshes: ResMut<Assets<Mesh>>,
|
||||
mut materials: ResMut<Assets<StandardMaterial>>,
|
||||
) {
|
||||
info!("Setting up lighting and ground plane");
|
||||
|
||||
// Directional light (sun)
|
||||
commands.spawn((
|
||||
DirectionalLight {
|
||||
illuminance: 10000.0,
|
||||
shadows_enabled: true,
|
||||
..default()
|
||||
},
|
||||
Transform::from_xyz(4.0, 8.0, 4.0).looking_at(Vec3::ZERO, Vec3::Y),
|
||||
));
|
||||
|
||||
// Ambient light
|
||||
commands.insert_resource(AmbientLight {
|
||||
color: Color::WHITE,
|
||||
brightness: 150.0,
|
||||
affects_lightmapped_meshes: false,
|
||||
});
|
||||
|
||||
// Ground plane
|
||||
commands.spawn((
|
||||
Mesh3d(meshes.add(Plane3d::default().mesh().size(20.0, 20.0))),
|
||||
MeshMaterial3d(materials.add(StandardMaterial {
|
||||
base_color: Color::srgb(0.3, 0.5, 0.3),
|
||||
perceptual_roughness: 0.9,
|
||||
..default()
|
||||
})),
|
||||
Transform::from_xyz(0.0, 0.0, 0.0),
|
||||
));
|
||||
|
||||
info!("Lighting and ground setup complete");
|
||||
}
|
||||
Reference in New Issue
Block a user