]> git.tdb.fi Git - libs/gl.git/blobdiff - source/render/camera.cpp
Use persistent uniform blocks for Camera, Lighting and Clipping
[libs/gl.git] / source / render / camera.cpp
index 3bba0eaf38e00385e68a077474095a980a10f340..9b8b0c778d0c5fc68f784efaee4c74b886801ddb 100644 (file)
@@ -2,6 +2,8 @@
 #include "camera.h"
 #include "matrix.h"
 
+using namespace std;
+
 namespace Msp {
 namespace GL {
 
@@ -129,6 +131,8 @@ void Camera::update_projection_matrix()
        else
                proj_matrix = Matrix::ortho(left, right, bottom, top, clip_near, clip_far);
        proj_matrix = Matrix::rotation(rotate, Vector3(0, 0, 1))*proj_matrix;
+
+       shdata.uniform("clip_eye_matrix", proj_matrix);
 }
 
 void Camera::update_object_matrix()
@@ -141,6 +145,17 @@ void Camera::update_object_matrix()
        columns[3] = compose(position, 1.0f);
        matrix = Matrix::from_columns(columns);
        view_matrix = invert(matrix);
+
+       shdata.uniform("eye_world_matrix", view_matrix);
+}
+
+void Camera::set_debug_name(const string &name)
+{
+#ifdef DEBUG
+       shdata.set_debug_name(name+" [UBO]");
+#else
+       (void)name;
+#endif
 }