use number_traits::Float;
use mat4;

use specs::{VecStorage, Component};


pub struct Transform3D<T: 'static + Sync + Send + Copy + Float>(pub [T; 16]);


impl<T: 'static + Sync + Send + Copy + Float> Component for Transform3D<T> {
    type Storage = VecStorage<Self>;
}

impl<T: 'static + Sync + Send + Copy + Float> From<[T; 16]> for Transform3D<T> {

    #[inline(always)]
    fn from(matrix: [T; 16]) -> Self {
        Transform3D(matrix)
    }
}

impl<T: 'static + Sync + Send + Copy + Float> Default for Transform3D<T> {

    #[inline(always)]
    fn default() -> Self {
        Self::from(mat4::new_identity())
    }
}

impl<T: 'static + Sync + Send + Copy + Float> Transform3D<T> {

    #[inline(always)]
    pub fn new() -> Self {
        Self::default()
    }
}
