More camera functionality
use gl;
use glm;
-use glm::ext::look_at;
+use glm::ext::*;
#[derive(Debug)]
pub enum Error {
@@ -35,8 +35,13 @@ impl Camera
self.direction = direction;
}
- fn get_view(&self)
+ fn get_view(&self) -> glm::Matrix4<f32>
{
- glm::ext::look_at(self.position, self.position + self.direction, glm::vec3(0., 1., 0.));
+ glm::ext::look_at(self.position, self.position + self.direction, glm::vec3(0., 1., 0.))
+ }
+
+ fn get_projection(&self) -> glm::Matrix4<f32>
+ {
+ glm::ext::perspective(glm::radians(45.0), (self.width as f32)/(self.height as f32), self.z_near, self.z_far)
}
}
