implemented maximum star magnitude, looks actually better w/ less stars

This commit is contained in:
yuni 2024-03-21 03:20:44 +01:00
parent beefe695f6
commit 7080c8d34c

View file

@ -10,6 +10,7 @@ use bevy::core_pipeline::bloom::{BloomCompositeMode, BloomSettings};
use std::f32::consts::PI; use std::f32::consts::PI;
const ASTEROID_SIZE: f32 = 100.0; const ASTEROID_SIZE: f32 = 100.0;
const STARS_MAX_MAGNITUDE: f32 = 3.5;
//const SKYBOX_BRIGHTNESS: f32 = 300.0; //const SKYBOX_BRIGHTNESS: f32 = 300.0;
//const SKYBOX_BRIGHTNESS_AR: f32 = 100.0; //const SKYBOX_BRIGHTNESS_AR: f32 = 100.0;
@ -145,8 +146,12 @@ pub fn setup(
// Generate starmap // Generate starmap
let sphere_handle = meshes.add(Sphere::new(1.0)); let sphere_handle = meshes.add(Sphere::new(1.0));
let mut starcount = 0;
for star in nature::STARS { for star in nature::STARS {
let mag = star[3]; let mag = star[3];
if mag > STARS_MAX_MAGNITUDE {
continue;
}
let scale_color = {|color: f32| let scale_color = {|color: f32|
if mag < -20.0 { if mag < -20.0 {
color * 13.0f32 // Sun color * 13.0f32 // Sun
@ -182,7 +187,9 @@ pub fn setup(
..default() ..default()
} }
)); ));
starcount += 1;
} }
info!("Generated {starcount} stars");
// Add Light from the Sun // Add Light from the Sun
commands.spawn(DirectionalLightBundle { commands.spawn(DirectionalLightBundle {