]> git.tdb.fi Git - libs/gl.git/blobdiff - source/matrix.cpp
Honor the srgb conversion flag when loading textures asynchronously
[libs/gl.git] / source / matrix.cpp
index b05d4bbc8ab6ff3de95e4f9cb6a35dacea80285d..ddc0cdf58c8ac64c72e1d830e6226f0edc2dcfa7 100644 (file)
@@ -22,24 +22,25 @@ Matrix::Matrix(const LinAl::Matrix<float, 4, 4> &other):
        Base(other)
 { }
 
-void Matrix::multiply(const Matrix &other)
+Matrix &Matrix::multiply(const Matrix &other)
 {
        *this = *this*other;
+       return *this;
 }
 
-void Matrix::translate(const Vector3 &t)
+Matrix &Matrix::translate(const Vector3 &t)
 {
-       multiply(translation(t));
+       return multiply(translation(t));
 }
 
-void Matrix::rotate(const Angle &a, const Vector3 &x)
+Matrix &Matrix::rotate(const Angle &a, const Vector3 &x)
 {
-       multiply(rotation(a, x));
+       return multiply(rotation(a, x));
 }
 
-void Matrix::scale(const Vector3 &s)
+Matrix &Matrix::scale(const Vector3 &s)
 {
-       multiply(scaling(s));
+       return multiply(scaling(s));
 }
 
 Matrix Matrix::operator*(const Matrix &other) const
@@ -49,8 +50,7 @@ Matrix Matrix::operator*(const Matrix &other) const
 
 Matrix &Matrix::operator*=(const Matrix &other)
 {
-       multiply(other);
-       return *this;
+       return multiply(other);
 }
 
 Vector4 Matrix::operator*(const Vector4 &vec) const
@@ -60,7 +60,7 @@ Vector4 Matrix::operator*(const Vector4 &vec) const
 
 Vector3 Matrix::operator*(const Vector3 &vec) const
 {
-       return Vector3((*this)*Vector4(vec, 1.0f));
+       return ((*this)*compose(vec, 1.0f)).slice<3>(0);
 }
 
 float Matrix::operator[](unsigned i) const