]> git.tdb.fi Git - libs/gl.git/blobdiff - source/shadowmap.cpp
Use the matrix classes internally
[libs/gl.git] / source / shadowmap.cpp
index bedfcfd51c0f1e2aa4d1f5bd374e1c5b8a342620..c8730426e6a557b113440914bef162239bc02751 100644 (file)
@@ -10,7 +10,6 @@ Distributed under the LGPL
 #include "light.h"
 #include "matrix.h"
 #include "misc.h"
-#include "projection.h"
 #include "scene.h"
 #include "shadowmap.h"
 #include "texunit.h"
@@ -98,22 +97,15 @@ void ShadowMap::prepare()
        matrix[15] = 1;
 
        {
-               matrix_mode(PROJECTION);
-               push_matrix();
-               load_identity();
-               ortho(-radius, radius, -radius, radius, -radius, radius);
-               matrix_mode(MODELVIEW);
-               push_matrix();
-               load_matrix(matrix);
+               MatrixStack::Push push_mv(MatrixStack::modelview());
+               MatrixStack::Push push_proj(MatrixStack::projection());
+
+               MatrixStack::projection() = Matrix::ortho(-radius, radius, -radius, radius, -radius, radius);
+               MatrixStack::modelview() = matrix;
 
                Bind bind_fbo(fbo, true);
                fbo.clear(DEPTH_BUFFER_BIT);
                scene.render("shadow");
-
-               matrix_mode(PROJECTION);
-               pop_matrix();
-               matrix_mode(MODELVIEW);
-               pop_matrix();
        }
 
        depth_buf.bind_to(unit);