pub fn target_to<T: Copy + Float + NumAssign>(
    eye: Vec3<T>,
    center: Vec3<T>,
    up: Vec3<T>
) -> Mat4<T>
Expand description

Calculates the Mat4 model matrix for a camera at eye position looking at the center position with a given up direction.

Examples

let m = transform::target_to(vec3(0_f32, 2., 0.), vec3(0., 0.6, 0.), vec3(0., 0., -1.));
assert_float_eq!((m * vec4(0_f32, 2., 0., 1.)).as_ref(), &[0., 2., -2., 1.]);
assert_float_eq!((m * vec4(0_f32, 2., -1., 1.)).as_ref(), &[0., 1., -2., 1.]);
assert_float_eq!((m * vec4(1_f32, 2., 0., 1.)).as_ref(), &[1., 2., -2., 1.]);
assert_float_eq!((m * vec4(0_f32, 1., 0., 1.)).as_ref(), &[0., 2., -1., 1.]);