X-Git-Url: http://git.tdb.fi/?p=libs%2Fgl.git;a=blobdiff_plain;f=source%2Fmatrix.cpp;h=a4c36a022a9ecb338406a496760f12c1d0655540;hp=ece99e344b903381a2a3dfc013ecdbff1571cffb;hb=9d1fa012a23693768bbe287371e97751c03acc50;hpb=50a0c7fd661fe6bfa3f929ad66e47cfab4a0fb87 diff --git a/source/matrix.cpp b/source/matrix.cpp index ece99e34..a4c36a02 100644 --- a/source/matrix.cpp +++ b/source/matrix.cpp @@ -22,45 +22,19 @@ Matrix::Matrix(const LinAl::Matrix &other): Base(other) { } -void Matrix::multiply(const Matrix &other) +Matrix &Matrix::translate(const Vector3 &t) { - *this = *this*other; + return multiply(translation(t)); } -void Matrix::translate(const Vector3 &t) +Matrix &Matrix::rotate(const Angle &a, const Vector3 &x) { - multiply(translation(t)); + return multiply(rotation(a, x)); } -void Matrix::rotate(const Angle &a, const Vector3 &x) +Matrix &Matrix::scale(const Vector3 &s) { - multiply(rotation(a, x)); -} - -void Matrix::scale(const Vector3 &s) -{ - multiply(scaling(s)); -} - -Matrix Matrix::operator*(const Matrix &other) const -{ - return static_cast(*this)*static_cast(other); -} - -Matrix &Matrix::operator*=(const Matrix &other) -{ - multiply(other); - return *this; -} - -Vector4 Matrix::operator*(const Vector4 &vec) const -{ - return static_cast(*this)*LinAl::Vector(vec); -} - -Vector3 Matrix::operator*(const Vector3 &vec) const -{ - return ((*this)*compose(vec, 1.0f)).slice<3>(0); + return multiply(scaling(s)); } float Matrix::operator[](unsigned i) const