pub struct ShaderData {
    pub name: String,
    pub uniforms: Vec<ShaderUniform>,
}

#[derive(Debug, Clone)]
pub enum UniformValue {
    Float(f32),
    Vec3([f32; 3]),
    Vec4([f32; 4]),
    Mat4([[f32; 4]; 4]),
    Int(i32),
}

#[derive(Debug, Clone)]
pub struct ShaderUniform {
    pub name: String,
    pub value: UniformValue,
}

impl ShaderData {
    pub fn terrain() -> Self {
        Self {
            name: "cloudtoppbr".to_string(),
            uniforms: vec![
                ShaderUniform {
                    name: "usundirection".into(),
                    value: UniformValue::Vec3([0.0, 1.0, 0.0]),
                },
                ShaderUniform {
                    name: "ucamerapos".into(),
                    value: UniformValue::Vec3([0.0, 0.0, 0.0]),
                },
                ShaderUniform {
                    name: "uplanetradius".into(),
                    value: UniformValue::Float(crate::NEPTUNEEQUATORIALRADIUS as f32),
                },
                ShaderUniform {
                    name: "uatmosphereheight".into(),
                    value: UniformValue::Float(600000.0),
                },
            ],
        }
    }

    pub fn atmosphere() -> Self {
        Self {
            name: "neptunescattering".to_string(),
            uniforms: vec![
                ShaderUniform {
                    name: "urayleighcoeff".into(),
                    value: UniformValue::Vec3([1.2e-6, 3.5e-6, 8.5e-6]),
                },
                ShaderUniform {
                    name: "umiecoeff".into(),
                    value: UniformValue::Float(5e-6),
                },
                ShaderUniform {
                    name: "umieg".into(),
                    value: UniformValue::Float(0.75),
                },
                ShaderUniform {
                    name: "usunintensity".into(),
                    value: UniformValue::Float(0.024),
                },
                ShaderUniform {
                    name: "uscaleheightrayleigh".into(),
                    value: UniformValue::Float(*crate::SCALEHEIGHT as f32),
                },
                ShaderUniform {
                    name: "uscaleheightmie".into(),
                    value: UniformValue::Float(15000.0),
                },
                ShaderUniform {
                    name: "umethaneabsorption".into(),
                    value: UniformValue::Vec3([0.0, 0.001, 0.01]),
                },
            ],
        }
    }

    pub fn interiorocean() -> Self {
        Self {
            name: "superionicwater".to_string(),
            uniforms: vec![
                ShaderUniform {
                    name: "upressure".into(),
                    value: UniformValue::Float(200.0),
                },
                ShaderUniform {
                    name: "utemperature".into(),
                    value: UniformValue::Float(2000.0),
                },
                ShaderUniform {
                    name: "udeepcolor".into(),
                    value: UniformValue::Vec3([0.02, 0.05, 0.15]),
                },
                ShaderUniform {
                    name: "uemissive".into(),
                    value: UniformValue::Vec3([0.01, 0.02, 0.05]),
                },
            ],
        }
    }
}
