]> git.tdb.fi Git - libs/gl.git/blobdiff - source/camera.cpp
Support rotating the camera frustum
[libs/gl.git] / source / camera.cpp
index d119e1eff1b67245b9fca74c4058b5d5077af8e3..ba8ff718d136744dbff8261d73b887a21258ef76 100644 (file)
@@ -56,6 +56,12 @@ void Camera::set_frustum_axis(float x, float y)
        update_projection_matrix();
 }
 
+void Camera::set_frustum_rotation(const Geometry::Angle<float> &r)
+{
+       rotate = r;
+       update_projection_matrix();
+}
+
 void Camera::set_position(const Vector3 &p)
 {
        position = p;
@@ -115,6 +121,7 @@ void Camera::update_projection_matrix()
                proj_matrix = Matrix::frustum(left, right, bottom, top, clip_near, clip_far);
        else
                proj_matrix = Matrix::ortho(left, right, bottom, top, clip_near, clip_far);
+       proj_matrix = Matrix::rotation(rotate, Vector3(0, 0, 1))*proj_matrix;
 }
 
 void Camera::update_object_matrix()