assimp/math/
matrix3.rs

1#[cfg(feature = "cgmath")]
2use cgmath::Matrix3;
3use ffi::AiMatrix3x3;
4
5define_type! {
6    /// Matrix3x3 docs
7    #[derive(Clone, Copy, Debug, PartialEq)]
8    struct Matrix3x3(AiMatrix3x3)
9}
10
11impl Matrix3x3 {
12    pub fn new(c0r0: f32, c0r1: f32, c0r2: f32,
13               c1r0: f32, c1r1: f32, c1r2: f32,
14               c2r0: f32, c2r1: f32, c2r2: f32) -> Matrix3x3 {
15        Matrix3x3(AiMatrix3x3 {
16            a1: c0r0, a2: c0r1, a3: c0r2,
17            b1: c1r0, b2: c1r1, b3: c1r2,
18            c1: c2r0, c2: c2r1, c3: c2r2,
19        })
20    }
21}
22
23#[cfg(feature = "cgmath")]
24impl From<Matrix3<f32>> for Matrix3x3 {
25    fn from(mat: Matrix3<f32>) -> Matrix3x3 {
26        Matrix3x3::new(mat[0][0], mat[1][0], mat[2][0],
27                       mat[0][1], mat[1][1], mat[2][1],
28                       mat[0][2], mat[1][2], mat[2][2])
29    }
30}
31
32#[cfg(feature = "cgmath")]
33impl From<Matrix3x3> for Matrix3<f32> {
34    fn from(mat: Matrix3x3) -> Matrix3<f32> {
35        Matrix3::new(mat.a1, mat.b1, mat.c1,
36                     mat.a2, mat.b2, mat.c2,
37                     mat.a3, mat.b3, mat.c3)
38    }
39}