diff --git a/src/world.rs b/src/world.rs index 8052baf..ad62488 100644 --- a/src/world.rs +++ b/src/world.rs @@ -15,6 +15,7 @@ const RING_THICKNESS: f64 = 8.0e6; const STARS_MAX_MAGNITUDE: f32 = 5.5; // max 7.0, see generate_starchart.py const CENTER_WORLD_ON_PLAYER: bool = true; +const SKYBOX: bool = false; const ASTEROID_SPAWN_STEP: f64 = 500.0; const ASTEROID_VIEW_RADIUS: f64 = 3000.0; @@ -182,25 +183,22 @@ pub fn setup( info!("Generated {starcount} stars"); // Add shaded skybox - //let mut mesh = Mesh::from(Sphere::new(1e9).mesh().uv(50, 50)); - let mut mesh = Mesh::from(Sphere::new(1e10).mesh().uv(5, 5)); - //let mut mesh = Mesh::from(Cuboid::from_size(Vec3::splat(2e10))); - if let Some(Indices::U32(indices)) = mesh.indices_mut() { - // Reverse the order of each triangle to avoid backface culling - for slice in indices.chunks_mut(3) { - slice.reverse(); + if SKYBOX { + let mut mesh = Mesh::from(Sphere::new(1e10).mesh().uv(5, 5)); + //let mut mesh = Mesh::from(Cuboid::from_size(Vec3::splat(2e10))); + if let Some(Indices::U32(indices)) = mesh.indices_mut() { + // Reverse the order of each triangle to avoid backface culling + for slice in indices.chunks_mut(3) { + slice.reverse(); + } } - } - commands.spawn(( - MaterialMeshBundle { + commands.spawn(MaterialMeshBundle { mesh: meshes.add(mesh), material: materials_skybox.add(shading::SkyBox {}), transform: Transform::from_translation(Vec3::new(0.0, 0.0, 0.0)), ..default() - }, - Position::from_xyz(0.0, 0.0, 0.0), - Rotation::from(Quat::IDENTITY), - )); + }); + } // Add shaded ring let ring_radius = 229_000_000.0;