summaryrefslogtreecommitdiff
path: root/src/gui/math3d/qmatrix4x4.h
diff options
context:
space:
mode:
authorLaszlo Agocs <laszlo.agocs@qt.io>2020-05-28 13:06:37 +0200
committerLaszlo Agocs <laszlo.agocs@qt.io>2020-06-03 18:56:09 +0200
commit1f88ccc8ad64096209cdf7874af129f4220b00ba (patch)
tree3a9490d423dadfae2cb63ff8d1c9fb4fd0d98558 /src/gui/math3d/qmatrix4x4.h
parent07ded4912f82008549b69b61a598ec7b0d2b3325 (diff)
downloadqtbase-1f88ccc8ad64096209cdf7874af129f4220b00ba.tar.gz
Enable the scenegraph to remove its QMatrix4x4_Accessor hack
Expose flagBits via a public function marked as internal. Task-number: QTBUG-82670 Change-Id: Ia64d934d3dda3e718357cf4e3c32866a613a4722 Reviewed-by: Andy Nichols <andy.nichols@qt.io> Reviewed-by: Christian Strømme <christian.stromme@qt.io>
Diffstat (limited to 'src/gui/math3d/qmatrix4x4.h')
-rw-r--r--src/gui/math3d/qmatrix4x4.h17
1 files changed, 12 insertions, 5 deletions
diff --git a/src/gui/math3d/qmatrix4x4.h b/src/gui/math3d/qmatrix4x4.h
index 95f4db92ec..64bf9c607e 100644
--- a/src/gui/math3d/qmatrix4x4.h
+++ b/src/gui/math3d/qmatrix4x4.h
@@ -185,12 +185,10 @@ public:
#endif
void projectedRotate(float angle, float x, float y, float z);
-private:
- float m[4][4]; // Column-major order to match OpenGL.
- int flagBits; // Flag bits from the enum below.
// When matrices are multiplied, the flag bits are or-ed together.
- enum {
+ // Note that the ordering of the bit values matters. (ident < t < s < r2d < r < p)
+ enum Flag {
Identity = 0x0000, // Identity matrix
Translation = 0x0001, // Contains a translation
Scale = 0x0002, // Contains a scale
@@ -199,6 +197,13 @@ private:
Perspective = 0x0010, // Last row is different from (0, 0, 0, 1)
General = 0x001f // General matrix, unknown contents
};
+ Q_DECLARE_FLAGS(Flags, Flag)
+
+ Flags flags() const { return flagBits; }
+
+private:
+ float m[4][4]; // Column-major order to match OpenGL.
+ Flags flagBits;
// Construct without initializing identity matrix.
explicit QMatrix4x4(int) { }
@@ -206,6 +211,8 @@ private:
QMatrix4x4 orthonormalInverse() const;
};
+Q_DECLARE_OPERATORS_FOR_FLAGS(QMatrix4x4::Flags)
+
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG("-Wfloat-equal")
QT_WARNING_DISABLE_GCC("-Wfloat-equal")
@@ -627,7 +634,7 @@ inline QMatrix4x4 operator-(const QMatrix4x4& m1, const QMatrix4x4& m2)
inline QMatrix4x4 operator*(const QMatrix4x4& m1, const QMatrix4x4& m2)
{
- int flagBits = m1.flagBits | m2.flagBits;
+ QMatrix4x4::Flags flagBits = m1.flagBits | m2.flagBits;
if (flagBits < QMatrix4x4::Rotation2D) {
QMatrix4x4 m = m1;
m.m[3][0] += m.m[0][0] * m2.m[3][0];