toggle skybox off. don't like the result

This commit is contained in:
yuni 2024-04-17 04:08:44 +02:00
parent 6d12033e23
commit 1b0209f38b

View file

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