diff options
Diffstat (limited to 'src/gui/math3d')
-rw-r--r-- | src/gui/math3d/qgenericmatrix.h | 27 | ||||
-rw-r--r-- | src/gui/math3d/qquaternion.h | 2 |
2 files changed, 9 insertions, 20 deletions
diff --git a/src/gui/math3d/qgenericmatrix.h b/src/gui/math3d/qgenericmatrix.h index 89bc09f544..c08faaaa8b 100644 --- a/src/gui/math3d/qgenericmatrix.h +++ b/src/gui/math3d/qgenericmatrix.h @@ -47,7 +47,6 @@ class QGenericMatrix public: QGenericMatrix(); explicit QGenericMatrix(Qt::Initialization) {} - QGenericMatrix(const QGenericMatrix<N, M, T>& other); explicit QGenericMatrix(const T *values); const T& operator()(int row, int column) const; @@ -93,8 +92,6 @@ private: #endif T m[N][M]; // Column-major order to match OpenGL. - explicit QGenericMatrix(int) {} // Construct without initializing identity matrix. - #if !defined(Q_NO_TEMPLATE_FRIENDS) template <int NN, int MM, typename TT> friend class QGenericMatrix; @@ -108,14 +105,6 @@ Q_INLINE_TEMPLATE QGenericMatrix<N, M, T>::QGenericMatrix() } template <int N, int M, typename T> -Q_INLINE_TEMPLATE QGenericMatrix<N, M, T>::QGenericMatrix(const QGenericMatrix<N, M, T>& other) -{ - for (int col = 0; col < N; ++col) - for (int row = 0; row < M; ++row) - m[col][row] = other.m[col][row]; -} - -template <int N, int M, typename T> Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>::QGenericMatrix(const T *values) { for (int col = 0; col < N; ++col) @@ -178,7 +167,7 @@ Q_OUTOFLINE_TEMPLATE void QGenericMatrix<N, M, T>::fill(T value) template <int N, int M, typename T> Q_OUTOFLINE_TEMPLATE QGenericMatrix<M, N, T> QGenericMatrix<N, M, T>::transposed() const { - QGenericMatrix<M, N, T> result(1); + QGenericMatrix<M, N, T> result(Qt::Uninitialized); for (int row = 0; row < M; ++row) for (int col = 0; col < N; ++col) result.m[row][col] = m[col][row]; @@ -246,7 +235,7 @@ Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T>& QGenericMatrix<N, M, T>::operator/ template <int N, int M, typename T> Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator+(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2) { - QGenericMatrix<N, M, T> result(1); + QGenericMatrix<N, M, T> result(Qt::Uninitialized); for (int row = 0; row < M; ++row) for (int col = 0; col < N; ++col) result.m[col][row] = m1.m[col][row] + m2.m[col][row]; @@ -256,7 +245,7 @@ Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator+(const QGenericMatrix<N, M template <int N, int M, typename T> Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& m1, const QGenericMatrix<N, M, T>& m2) { - QGenericMatrix<N, M, T> result(1); + QGenericMatrix<N, M, T> result(Qt::Uninitialized); for (int row = 0; row < M; ++row) for (int col = 0; col < N; ++col) result.m[col][row] = m1.m[col][row] - m2.m[col][row]; @@ -266,7 +255,7 @@ Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M template <int N, int M1, int M2, typename T> Q_OUTOFLINE_TEMPLATE QGenericMatrix<M1, M2, T> operator*(const QGenericMatrix<N, M2, T>& m1, const QGenericMatrix<M1, N, T>& m2) { - QGenericMatrix<M1, M2, T> result(1); + QGenericMatrix<M1, M2, T> result(Qt::Uninitialized); for (int row = 0; row < M2; ++row) { for (int col = 0; col < M1; ++col) { T sum(0.0f); @@ -281,7 +270,7 @@ Q_OUTOFLINE_TEMPLATE QGenericMatrix<M1, M2, T> operator*(const QGenericMatrix<N, template <int N, int M, typename T> Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M, T>& matrix) { - QGenericMatrix<N, M, T> result(1); + QGenericMatrix<N, M, T> result(Qt::Uninitialized); for (int row = 0; row < M; ++row) for (int col = 0; col < N; ++col) result.m[col][row] = -matrix.m[col][row]; @@ -291,7 +280,7 @@ Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator-(const QGenericMatrix<N, M template <int N, int M, typename T> Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator*(T factor, const QGenericMatrix<N, M, T>& matrix) { - QGenericMatrix<N, M, T> result(1); + QGenericMatrix<N, M, T> result(Qt::Uninitialized); for (int row = 0; row < M; ++row) for (int col = 0; col < N; ++col) result.m[col][row] = matrix.m[col][row] * factor; @@ -301,7 +290,7 @@ Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator*(T factor, const QGenericM template <int N, int M, typename T> Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator*(const QGenericMatrix<N, M, T>& matrix, T factor) { - QGenericMatrix<N, M, T> result(1); + QGenericMatrix<N, M, T> result(Qt::Uninitialized); for (int row = 0; row < M; ++row) for (int col = 0; col < N; ++col) result.m[col][row] = matrix.m[col][row] * factor; @@ -311,7 +300,7 @@ Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator*(const QGenericMatrix<N, M template <int N, int M, typename T> Q_OUTOFLINE_TEMPLATE QGenericMatrix<N, M, T> operator/(const QGenericMatrix<N, M, T>& matrix, T divisor) { - QGenericMatrix<N, M, T> result(1); + QGenericMatrix<N, M, T> result(Qt::Uninitialized); for (int row = 0; row < M; ++row) for (int col = 0; col < N; ++col) result.m[col][row] = matrix.m[col][row] / divisor; diff --git a/src/gui/math3d/qquaternion.h b/src/gui/math3d/qquaternion.h index 240e31a5c2..52c717072d 100644 --- a/src/gui/math3d/qquaternion.h +++ b/src/gui/math3d/qquaternion.h @@ -266,7 +266,7 @@ inline bool operator==(const QQuaternion &q1, const QQuaternion &q2) inline bool operator!=(const QQuaternion &q1, const QQuaternion &q2) { - return q1.xp != q2.xp || q1.yp != q2.yp || q1.zp != q2.zp || q1.wp != q2.wp; + return !operator==(q1, q2); } inline const QQuaternion operator+(const QQuaternion &q1, const QQuaternion &q2) |