X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fcore%2Fmatrix.cpp;h=ff1e3af49c3a0fd8cd1280c3e6b37e1078179c8e;hp=0eb9e916aac6a56cffcc4de00ec08d35edc77812;hb=HEAD;hpb=acaefb4c669f01855252818ef0a2958cbdababc3 diff --git a/source/core/matrix.cpp b/source/core/matrix.cpp index 0eb9e916..ff1e3af4 100644 --- a/source/core/matrix.cpp +++ b/source/core/matrix.cpp @@ -1,6 +1,6 @@ #include #include -#include +#include #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::translation(t).get_matrix(); + return Geometry::AffineTransform::translation(t).get_matrix(); } Matrix Matrix::rotation(const Angle &a, const Vector3 &x) { - return Geometry::AffineTransformation::rotation(a, x).get_matrix(); + return Geometry::AffineTransform::rotation(a, x).get_matrix(); } Matrix Matrix::scaling(const Vector3 &s) { - return Geometry::AffineTransformation::scaling(s).get_matrix(); + return Geometry::AffineTransform::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; }