]> git.tdb.fi Git - libs/gl.git/blobdiff - source/core/matrix.cpp
Check the flat qualifier from the correct member
[libs/gl.git] / source / core / matrix.cpp
index 0eb9e916aac6a56cffcc4de00ec08d35edc77812..ff1e3af49c3a0fd8cd1280c3e6b37e1078179c8e 100644 (file)
@@ -1,6 +1,6 @@
 #include <cmath>
 #include <stdexcept>
-#include <msp/geometry/affinetransformation.h>
+#include <msp/geometry/affinetransform.h>
 #include "matrix.h"
 
 using namespace std;
@@ -44,17 +44,17 @@ float Matrix::operator[](unsigned i) const
 
 Matrix Matrix::translation(const Vector3 &t)
 {
-       return Geometry::AffineTransformation<float, 3>::translation(t).get_matrix();
+       return Geometry::AffineTransform<float, 3>::translation(t).get_matrix();
 }
 
 Matrix Matrix::rotation(const Angle &a, const Vector3 &x)
 {
-       return Geometry::AffineTransformation<float, 3>::rotation(a, x).get_matrix();
+       return Geometry::AffineTransform<float, 3>::rotation(a, x).get_matrix();
 }
 
 Matrix Matrix::scaling(const Vector3 &s)
 {
-       return Geometry::AffineTransformation<float, 3>::scaling(s).get_matrix();
+       return Geometry::AffineTransform<float, 3>::scaling(s).get_matrix();
 }
 
 Matrix Matrix::ortho(float l, float r, float b, float t, float n, float f)
@@ -65,10 +65,10 @@ Matrix Matrix::ortho(float l, float r, float b, float t, float n, float f)
        Matrix result;
        result(0, 0) = 2/(r-l);
        result(1, 1) = 2/(t-b);
-       result(2, 2) = -2/(f-n);
+       result(2, 2) = -1/(f-n);
        result(0, 3) = -(r+l)/(r-l);
        result(1, 3) = -(t+b)/(t-b);
-       result(2, 3) = -(f+n)/(f-n);
+       result(2, 3) = 0.5f-0.5f*(f+n)/(f-n);
        return result;
 }
 
@@ -97,9 +97,9 @@ Matrix Matrix::frustum(float l, float r, float b, float t, float n, float f)
        result(1, 1) = 2*n/(t-b);
        result(0, 2) = (r+l)/(r-l);
        result(1, 2) = (t+b)/(t-b);
-       result(2, 2) = -(f+n)/(f-n);
+       result(2, 2) = -f/(f-n);
        result(3, 2) = -1;
-       result(2, 3) = -2*f*n/(f-n);
+       result(2, 3) = -f*n/(f-n);
        result(3, 3) = 0;
        return result;
 }