Update ray constructor to take anything that Into<Vec3>

This commit is contained in:
Bill Thiede 2019-02-25 20:35:32 -08:00
parent b7002df00e
commit 3256feab1b

View File

@ -10,7 +10,12 @@ pub struct Ray {
} }
impl Ray { impl Ray {
pub fn new(origin: Vec3, direction: Vec3, time: f32) -> Ray { pub fn new<V>(origin: V, direction: V, time: f32) -> Ray
where
V: Into<Vec3>,
{
let direction = direction.into();
let origin = origin.into();
let inv = 1. / direction; let inv = 1. / direction;
Ray { Ray {
origin, origin,