pub fn transform_normal(n: &Vec3, transform: &Mat4) -> Vec3 {
        let inv = transform.inverse();

        Vec3 {
            x: inv.m[0][0] * n.x + inv.m[1][0] * n.y + inv.m[2][0] * n.z,
            y: inv.m[0][1] * n.x + inv.m[1][1] * n.y + inv.m[2][1] * n.z,
            z: inv.m[0][2] * n.x + inv.m[1][2] * n.y + inv.m[2][2] * n.z
        }
    }
/// Normals cannot have the transformation matrix directly applied to them
Normals cannot have the transformation matrix directly applied to them
Normals cannot have the transformation matrix directly applied to them
pub fn transform_normal(n: &Vec3, transform: &Mat4) -> Vec3 {
        let inv = transform.inverse();
        Vec3 {
            x: inv.m[0][0] * n.x + inv.m[1][0] * n.y + inv.m[2][0] * n.z,
            y: inv.m[0][1] * n.x + inv.m[1][1] * n.y + inv.m[2][1] * n.z,
            z: inv.m[0][2] * n.x + inv.m[1][2] * n.y + inv.m[2][2] * n.z
        }
    }
pub fn transform_normal ( n : & Vec3 , transform : & Mat4 ) -> Vec3 { let inv = transform . inverse ( ) ; Vec3 { x : inv . m [ 0 ] [ 0 ] * n . x + inv . m [ 1 ] [ 0 ] * n . y + inv . m [ 2 ] [ 0 ] * n . z , y : inv . m [ 0 ] [ 1 ] * n . x + inv . m [ 1 ] [ 1 ] * n . y + inv . m [ 2 ] [ 1 ] * n . z , z : inv . m [ 0 ] [ 2 ] * n . x + inv . m [ 1 ] [ 2 ] * n . y + inv . m [ 2 ] [ 2 ] * n . z } }
Normals cannot have the transformation matrix directly applied to them
Normals cannot have the transformation matrix directly applied to them
n
&Vec3
transform
&Mat4
n
&Vec3
transform
&Mat4