use crate::{
    components::{CodeType, Program, Snippet},
    errors::*,
    graphics::AttaWithProgram,
};

use super::Transform;

pub struct Polar {
    snippet: Snippet,
    origin: f32,
}

impl Polar {
    pub fn new() -> Result<Self> {
        let snippets = Snippet::new(
            "polar",
            CodeType::<&'static str>::Path("transform/polar.glsl".into()),
            true,
            Some("forward".to_string()),
        )?;

        Ok(Self {
            snippet: snippets,
            origin: 0.0,
        })
    }
}

impl Transform for Polar {
    fn snippet(&self) -> &Snippet {
        &self.snippet
    }
}

impl AttaWithProgram for Polar {
    fn attach_with_program(&self, gl: &glow::Context, program: &Program) -> Result<()> {
        Ok(())
    }
}

mod test {
    use super::*;

    #[test]
    fn test_polar() {
        let polar = Polar::new().unwrap();

        println!("{}", polar.snippet);
    }
}
