Get rid of the QMatrix4x4(int) constructor
QMatrix4x4(Qt::Uninitialized) does the same thing. Change-Id: Ie226690f417505f082cb69fdb476e34db2b19c15 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
This commit is contained in:
parent
bfceaf7eb3
commit
3c525f2a21
@ -389,7 +389,7 @@ QMatrix4x4 QMatrix4x4::inverted(bool *invertible) const
|
|||||||
*invertible = true;
|
*invertible = true;
|
||||||
return orthonormalInverse();
|
return orthonormalInverse();
|
||||||
} else if (flagBits < Perspective) {
|
} else if (flagBits < Perspective) {
|
||||||
QMatrix4x4 inv(1); // The "1" says to not load the identity.
|
QMatrix4x4 inv(Qt::Uninitialized);
|
||||||
|
|
||||||
double mm[4][4];
|
double mm[4][4];
|
||||||
copyToDoubles(m, mm);
|
copyToDoubles(m, mm);
|
||||||
@ -425,7 +425,7 @@ QMatrix4x4 QMatrix4x4::inverted(bool *invertible) const
|
|||||||
return inv;
|
return inv;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMatrix4x4 inv(1); // The "1" says to not load the identity.
|
QMatrix4x4 inv(Qt::Uninitialized);
|
||||||
|
|
||||||
double mm[4][4];
|
double mm[4][4];
|
||||||
copyToDoubles(m, mm);
|
copyToDoubles(m, mm);
|
||||||
@ -527,7 +527,7 @@ QMatrix3x3 QMatrix4x4::normalMatrix() const
|
|||||||
*/
|
*/
|
||||||
QMatrix4x4 QMatrix4x4::transposed() const
|
QMatrix4x4 QMatrix4x4::transposed() const
|
||||||
{
|
{
|
||||||
QMatrix4x4 result(1); // The "1" says to not load the identity.
|
QMatrix4x4 result(Qt::Uninitialized);
|
||||||
for (int row = 0; row < 4; ++row) {
|
for (int row = 0; row < 4; ++row) {
|
||||||
for (int col = 0; col < 4; ++col) {
|
for (int col = 0; col < 4; ++col) {
|
||||||
result.m[col][row] = m[row][col];
|
result.m[col][row] = m[row][col];
|
||||||
@ -726,7 +726,7 @@ QMatrix4x4& QMatrix4x4::operator/=(float divisor)
|
|||||||
*/
|
*/
|
||||||
QMatrix4x4 operator/(const QMatrix4x4& matrix, float divisor)
|
QMatrix4x4 operator/(const QMatrix4x4& matrix, float divisor)
|
||||||
{
|
{
|
||||||
QMatrix4x4 m(1); // The "1" says to not load the identity.
|
QMatrix4x4 m(Qt::Uninitialized);
|
||||||
m.m[0][0] = matrix.m[0][0] / divisor;
|
m.m[0][0] = matrix.m[0][0] / divisor;
|
||||||
m.m[0][1] = matrix.m[0][1] / divisor;
|
m.m[0][1] = matrix.m[0][1] / divisor;
|
||||||
m.m[0][2] = matrix.m[0][2] / divisor;
|
m.m[0][2] = matrix.m[0][2] / divisor;
|
||||||
@ -1159,7 +1159,7 @@ void QMatrix4x4::rotate(float angle, float x, float y, float z)
|
|||||||
z = float(double(z) / len);
|
z = float(double(z) / len);
|
||||||
}
|
}
|
||||||
float ic = 1.0f - c;
|
float ic = 1.0f - c;
|
||||||
QMatrix4x4 rot(1); // The "1" says to not load the identity.
|
QMatrix4x4 rot(Qt::Uninitialized);
|
||||||
rot.m[0][0] = x * x * ic + c;
|
rot.m[0][0] = x * x * ic + c;
|
||||||
rot.m[1][0] = x * y * ic - z * s;
|
rot.m[1][0] = x * y * ic - z * s;
|
||||||
rot.m[2][0] = x * z * ic + y * s;
|
rot.m[2][0] = x * z * ic + y * s;
|
||||||
@ -1254,8 +1254,8 @@ void QMatrix4x4::projectedRotate(float angle, float x, float y, float z)
|
|||||||
y = float(double(y) / len);
|
y = float(double(y) / len);
|
||||||
z = float(double(z) / len);
|
z = float(double(z) / len);
|
||||||
}
|
}
|
||||||
float ic = 1.0f - c;
|
const float ic = 1.0f - c;
|
||||||
QMatrix4x4 rot(1); // The "1" says to not load the identity.
|
QMatrix4x4 rot(Qt::Uninitialized);
|
||||||
rot.m[0][0] = x * x * ic + c;
|
rot.m[0][0] = x * x * ic + c;
|
||||||
rot.m[1][0] = x * y * ic - z * s;
|
rot.m[1][0] = x * y * ic - z * s;
|
||||||
rot.m[2][0] = 0.0f;
|
rot.m[2][0] = 0.0f;
|
||||||
@ -1391,10 +1391,10 @@ void QMatrix4x4::ortho(float left, float right, float bottom, float top, float n
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Construct the projection.
|
// Construct the projection.
|
||||||
float width = right - left;
|
const float width = right - left;
|
||||||
float invheight = top - bottom;
|
const float invheight = top - bottom;
|
||||||
float clip = farPlane - nearPlane;
|
const float clip = farPlane - nearPlane;
|
||||||
QMatrix4x4 m(1);
|
QMatrix4x4 m(Qt::Uninitialized);
|
||||||
m.m[0][0] = 2.0f / width;
|
m.m[0][0] = 2.0f / width;
|
||||||
m.m[1][0] = 0.0f;
|
m.m[1][0] = 0.0f;
|
||||||
m.m[2][0] = 0.0f;
|
m.m[2][0] = 0.0f;
|
||||||
@ -1432,10 +1432,10 @@ void QMatrix4x4::frustum(float left, float right, float bottom, float top, float
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Construct the projection.
|
// Construct the projection.
|
||||||
QMatrix4x4 m(1);
|
QMatrix4x4 m(Qt::Uninitialized);
|
||||||
float width = right - left;
|
const float width = right - left;
|
||||||
float invheight = top - bottom;
|
const float invheight = top - bottom;
|
||||||
float clip = farPlane - nearPlane;
|
const float clip = farPlane - nearPlane;
|
||||||
m.m[0][0] = 2.0f * nearPlane / width;
|
m.m[0][0] = 2.0f * nearPlane / width;
|
||||||
m.m[1][0] = 0.0f;
|
m.m[1][0] = 0.0f;
|
||||||
m.m[2][0] = (left + right) / width;
|
m.m[2][0] = (left + right) / width;
|
||||||
@ -1475,9 +1475,9 @@ void QMatrix4x4::perspective(float verticalAngle, float aspectRatio, float nearP
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
// Construct the projection.
|
// Construct the projection.
|
||||||
QMatrix4x4 m(1);
|
QMatrix4x4 m(Qt::Uninitialized);
|
||||||
float radians = qDegreesToRadians(verticalAngle / 2.0f);
|
const float radians = qDegreesToRadians(verticalAngle / 2.0f);
|
||||||
float sine = std::sin(radians);
|
const float sine = std::sin(radians);
|
||||||
if (sine == 0.0f)
|
if (sine == 0.0f)
|
||||||
return;
|
return;
|
||||||
float cotan = std::cos(radians) / sine;
|
float cotan = std::cos(radians) / sine;
|
||||||
@ -1525,7 +1525,7 @@ void QMatrix4x4::lookAt(const QVector3D& eye, const QVector3D& center, const QVe
|
|||||||
QVector3D side = QVector3D::crossProduct(forward, up).normalized();
|
QVector3D side = QVector3D::crossProduct(forward, up).normalized();
|
||||||
QVector3D upVector = QVector3D::crossProduct(side, forward);
|
QVector3D upVector = QVector3D::crossProduct(side, forward);
|
||||||
|
|
||||||
QMatrix4x4 m(1);
|
QMatrix4x4 m(Qt::Uninitialized);
|
||||||
m.m[0][0] = side.x();
|
m.m[0][0] = side.x();
|
||||||
m.m[1][0] = side.y();
|
m.m[1][0] = side.y();
|
||||||
m.m[2][0] = side.z();
|
m.m[2][0] = side.z();
|
||||||
@ -1574,7 +1574,7 @@ void QMatrix4x4::viewport(float left, float bottom, float width, float height, f
|
|||||||
const float w2 = width / 2.0f;
|
const float w2 = width / 2.0f;
|
||||||
const float h2 = height / 2.0f;
|
const float h2 = height / 2.0f;
|
||||||
|
|
||||||
QMatrix4x4 m(1);
|
QMatrix4x4 m(Qt::Uninitialized);
|
||||||
m.m[0][0] = w2;
|
m.m[0][0] = w2;
|
||||||
m.m[1][0] = 0.0f;
|
m.m[1][0] = 0.0f;
|
||||||
m.m[2][0] = 0.0f;
|
m.m[2][0] = 0.0f;
|
||||||
@ -1864,7 +1864,7 @@ QRectF QMatrix4x4::mapRect(const QRectF& rect) const
|
|||||||
// of just rotations and translations.
|
// of just rotations and translations.
|
||||||
QMatrix4x4 QMatrix4x4::orthonormalInverse() const
|
QMatrix4x4 QMatrix4x4::orthonormalInverse() const
|
||||||
{
|
{
|
||||||
QMatrix4x4 result(1); // The '1' says not to load identity
|
QMatrix4x4 result(Qt::Uninitialized);
|
||||||
|
|
||||||
result.m[0][0] = m[0][0];
|
result.m[0][0] = m[0][0];
|
||||||
result.m[1][0] = m[0][1];
|
result.m[1][0] = m[0][1];
|
||||||
|
@ -205,9 +205,6 @@ private:
|
|||||||
float m[4][4]; // Column-major order to match OpenGL.
|
float m[4][4]; // Column-major order to match OpenGL.
|
||||||
Flags flagBits;
|
Flags flagBits;
|
||||||
|
|
||||||
// Construct without initializing identity matrix.
|
|
||||||
explicit QMatrix4x4(int) { }
|
|
||||||
|
|
||||||
QMatrix4x4 orthonormalInverse() const;
|
QMatrix4x4 orthonormalInverse() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -587,7 +584,7 @@ inline bool QMatrix4x4::operator!=(const QMatrix4x4& other) const
|
|||||||
|
|
||||||
inline QMatrix4x4 operator+(const QMatrix4x4& m1, const QMatrix4x4& m2)
|
inline QMatrix4x4 operator+(const QMatrix4x4& m1, const QMatrix4x4& m2)
|
||||||
{
|
{
|
||||||
QMatrix4x4 m(1);
|
QMatrix4x4 m(Qt::Uninitialized);
|
||||||
m.m[0][0] = m1.m[0][0] + m2.m[0][0];
|
m.m[0][0] = m1.m[0][0] + m2.m[0][0];
|
||||||
m.m[0][1] = m1.m[0][1] + m2.m[0][1];
|
m.m[0][1] = m1.m[0][1] + m2.m[0][1];
|
||||||
m.m[0][2] = m1.m[0][2] + m2.m[0][2];
|
m.m[0][2] = m1.m[0][2] + m2.m[0][2];
|
||||||
@ -604,13 +601,12 @@ inline QMatrix4x4 operator+(const QMatrix4x4& m1, const QMatrix4x4& m2)
|
|||||||
m.m[3][1] = m1.m[3][1] + m2.m[3][1];
|
m.m[3][1] = m1.m[3][1] + m2.m[3][1];
|
||||||
m.m[3][2] = m1.m[3][2] + m2.m[3][2];
|
m.m[3][2] = m1.m[3][2] + m2.m[3][2];
|
||||||
m.m[3][3] = m1.m[3][3] + m2.m[3][3];
|
m.m[3][3] = m1.m[3][3] + m2.m[3][3];
|
||||||
m.flagBits = QMatrix4x4::General;
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QMatrix4x4 operator-(const QMatrix4x4& m1, const QMatrix4x4& m2)
|
inline QMatrix4x4 operator-(const QMatrix4x4& m1, const QMatrix4x4& m2)
|
||||||
{
|
{
|
||||||
QMatrix4x4 m(1);
|
QMatrix4x4 m(Qt::Uninitialized);
|
||||||
m.m[0][0] = m1.m[0][0] - m2.m[0][0];
|
m.m[0][0] = m1.m[0][0] - m2.m[0][0];
|
||||||
m.m[0][1] = m1.m[0][1] - m2.m[0][1];
|
m.m[0][1] = m1.m[0][1] - m2.m[0][1];
|
||||||
m.m[0][2] = m1.m[0][2] - m2.m[0][2];
|
m.m[0][2] = m1.m[0][2] - m2.m[0][2];
|
||||||
@ -627,7 +623,6 @@ inline QMatrix4x4 operator-(const QMatrix4x4& m1, const QMatrix4x4& m2)
|
|||||||
m.m[3][1] = m1.m[3][1] - m2.m[3][1];
|
m.m[3][1] = m1.m[3][1] - m2.m[3][1];
|
||||||
m.m[3][2] = m1.m[3][2] - m2.m[3][2];
|
m.m[3][2] = m1.m[3][2] - m2.m[3][2];
|
||||||
m.m[3][3] = m1.m[3][3] - m2.m[3][3];
|
m.m[3][3] = m1.m[3][3] - m2.m[3][3];
|
||||||
m.flagBits = QMatrix4x4::General;
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -647,7 +642,7 @@ inline QMatrix4x4 operator*(const QMatrix4x4& m1, const QMatrix4x4& m2)
|
|||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
QMatrix4x4 m(1);
|
QMatrix4x4 m(Qt::Uninitialized);
|
||||||
m.m[0][0] = m1.m[0][0] * m2.m[0][0]
|
m.m[0][0] = m1.m[0][0] * m2.m[0][0]
|
||||||
+ m1.m[1][0] * m2.m[0][1]
|
+ m1.m[1][0] * m2.m[0][1]
|
||||||
+ m1.m[2][0] * m2.m[0][2]
|
+ m1.m[2][0] * m2.m[0][2]
|
||||||
@ -947,7 +942,7 @@ inline QPointF operator*(const QMatrix4x4& matrix, const QPointF& point)
|
|||||||
|
|
||||||
inline QMatrix4x4 operator-(const QMatrix4x4& matrix)
|
inline QMatrix4x4 operator-(const QMatrix4x4& matrix)
|
||||||
{
|
{
|
||||||
QMatrix4x4 m(1);
|
QMatrix4x4 m(Qt::Uninitialized);
|
||||||
m.m[0][0] = -matrix.m[0][0];
|
m.m[0][0] = -matrix.m[0][0];
|
||||||
m.m[0][1] = -matrix.m[0][1];
|
m.m[0][1] = -matrix.m[0][1];
|
||||||
m.m[0][2] = -matrix.m[0][2];
|
m.m[0][2] = -matrix.m[0][2];
|
||||||
@ -964,13 +959,12 @@ inline QMatrix4x4 operator-(const QMatrix4x4& matrix)
|
|||||||
m.m[3][1] = -matrix.m[3][1];
|
m.m[3][1] = -matrix.m[3][1];
|
||||||
m.m[3][2] = -matrix.m[3][2];
|
m.m[3][2] = -matrix.m[3][2];
|
||||||
m.m[3][3] = -matrix.m[3][3];
|
m.m[3][3] = -matrix.m[3][3];
|
||||||
m.flagBits = QMatrix4x4::General;
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QMatrix4x4 operator*(float factor, const QMatrix4x4& matrix)
|
inline QMatrix4x4 operator*(float factor, const QMatrix4x4& matrix)
|
||||||
{
|
{
|
||||||
QMatrix4x4 m(1);
|
QMatrix4x4 m(Qt::Uninitialized);
|
||||||
m.m[0][0] = matrix.m[0][0] * factor;
|
m.m[0][0] = matrix.m[0][0] * factor;
|
||||||
m.m[0][1] = matrix.m[0][1] * factor;
|
m.m[0][1] = matrix.m[0][1] * factor;
|
||||||
m.m[0][2] = matrix.m[0][2] * factor;
|
m.m[0][2] = matrix.m[0][2] * factor;
|
||||||
@ -987,13 +981,12 @@ inline QMatrix4x4 operator*(float factor, const QMatrix4x4& matrix)
|
|||||||
m.m[3][1] = matrix.m[3][1] * factor;
|
m.m[3][1] = matrix.m[3][1] * factor;
|
||||||
m.m[3][2] = matrix.m[3][2] * factor;
|
m.m[3][2] = matrix.m[3][2] * factor;
|
||||||
m.m[3][3] = matrix.m[3][3] * factor;
|
m.m[3][3] = matrix.m[3][3] * factor;
|
||||||
m.flagBits = QMatrix4x4::General;
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline QMatrix4x4 operator*(const QMatrix4x4& matrix, float factor)
|
inline QMatrix4x4 operator*(const QMatrix4x4& matrix, float factor)
|
||||||
{
|
{
|
||||||
QMatrix4x4 m(1);
|
QMatrix4x4 m(Qt::Uninitialized);
|
||||||
m.m[0][0] = matrix.m[0][0] * factor;
|
m.m[0][0] = matrix.m[0][0] * factor;
|
||||||
m.m[0][1] = matrix.m[0][1] * factor;
|
m.m[0][1] = matrix.m[0][1] * factor;
|
||||||
m.m[0][2] = matrix.m[0][2] * factor;
|
m.m[0][2] = matrix.m[0][2] * factor;
|
||||||
@ -1010,7 +1003,6 @@ inline QMatrix4x4 operator*(const QMatrix4x4& matrix, float factor)
|
|||||||
m.m[3][1] = matrix.m[3][1] * factor;
|
m.m[3][1] = matrix.m[3][1] * factor;
|
||||||
m.m[3][2] = matrix.m[3][2] * factor;
|
m.m[3][2] = matrix.m[3][2] * factor;
|
||||||
m.m[3][3] = matrix.m[3][3] * factor;
|
m.m[3][3] = matrix.m[3][3] * factor;
|
||||||
m.flagBits = QMatrix4x4::General;
|
|
||||||
return m;
|
return m;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user