suns 0.0.3

Sun celestial simulation crate for the MilkyWay SolarSystem workspace
Documentation
#[derive(Debug, Clone, Copy, PartialEq)]
pub struct StellarShaderData {
    pub limb_darkening_coeff: f32,
    pub granulation_scale: f32,
    pub magnetic_field_intensity: f32,
    pub corona_falloff_exponent: f32,
}

impl StellarShaderData {
    pub fn photosphere() -> Self {
        Self {
            limb_darkening_coeff: 0.6,
            granulation_scale: 1000.0,
            magnetic_field_intensity: 1e-4,
            corona_falloff_exponent: 0.0,
        }
    }

    pub fn corona() -> Self {
        Self {
            limb_darkening_coeff: 0.0,
            granulation_scale: 0.0,
            magnetic_field_intensity: 0.0,
            corona_falloff_exponent: 2.5,
        }
    }

    pub fn active_region() -> Self {
        Self {
            limb_darkening_coeff: 0.6,
            granulation_scale: 500.0,
            magnetic_field_intensity: 0.3,
            corona_falloff_exponent: 0.0,
        }
    }

    pub fn limb_darkening_factor(&self, cos_theta: f32) -> f32 {
        1.0 - self.limb_darkening_coeff * (1.0 - cos_theta)
    }

    pub fn corona_intensity_at_radius(&self, r_over_r_sun: f32) -> f32 {
        if r_over_r_sun <= 1.0 {
            return 1.0;
        }
        r_over_r_sun.powf(-self.corona_falloff_exponent)
    }
}