diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-09-11 18:47:39 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-09-11 18:47:46 +0200 |
commit | 7814da64942c4566e2fa9c9e2bd2a1e169e7fab9 (patch) | |
tree | d0eb4373cb1be4a0c35025f19346087fcaa811dd | |
parent | a79c34fe6ef7e47582de9188e284644e9665f31b (diff) | |
parent | 96c714e3794f992c26632664d5b028e0ca2a919e (diff) |
Merge "Merge remote-tracking branch 'origin/5.13' into 5.14"
22 files changed, 262 insertions, 49 deletions
diff --git a/dist/changes-5.12.5 b/dist/changes-5.12.5 new file mode 100644 index 000000000..e8be9316f --- /dev/null +++ b/dist/changes-5.12.5 @@ -0,0 +1,20 @@ +Qt 5.12.5 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.12.0 through 5.12.4. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +https://doc.qt.io/qt-5/index.html + +The Qt version 5.12 series is binary compatible with the 5.11.x series. +Applications compiled for 5.11 will continue to run with 5.12. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + + - This release contains only minor code improvements. diff --git a/dist/changes-5.13.1 b/dist/changes-5.13.1 new file mode 100644 index 000000000..fda39f037 --- /dev/null +++ b/dist/changes-5.13.1 @@ -0,0 +1,24 @@ +Qt 5.13.1 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.13.0. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +https://doc.qt.io/qt-5/index.html + +The Qt version 5.13 series is binary compatible with the 5.12.x series. +Applications compiled for 5.12 will continue to run with 5.13. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Quick3D * +**************************************************************************** + + - [QTBUG-75551] Update Qt3D color handing to match QtQuick. diff --git a/src/animation/frontend/qclipblendvalue.cpp b/src/animation/frontend/qclipblendvalue.cpp index c20609050..72a7dd796 100644 --- a/src/animation/frontend/qclipblendvalue.cpp +++ b/src/animation/frontend/qclipblendvalue.cpp @@ -59,10 +59,21 @@ QClipBlendValuePrivate::QClipBlendValuePrivate() \brief Class used for including a clip in a blend tree. */ /*! + \qmltype ClipBlendValue + \instantiates QClipBlendValue + \inqmlmodule Qt3D.Animation + \brief Type used for including a clip in a blend tree. +*/ +/*! \property Qt3DAnimation::QClipBlendValue::clip The animation clip that needs to be included in the blend tree. */ +/*! + \qmlproperty AbstractAnimationClip ClipBlendValue::clip + + The animation clip that needs to be included in the blend tree. +*/ QClipBlendValue::QClipBlendValue(Qt3DCore::QNode *parent) : QAbstractClipBlendNode(*new QClipBlendValuePrivate(), parent) { diff --git a/src/animation/frontend/qlerpclipblend.cpp b/src/animation/frontend/qlerpclipblend.cpp index fd9dd248c..89ce3ca6f 100644 --- a/src/animation/frontend/qlerpclipblend.cpp +++ b/src/animation/frontend/qlerpclipblend.cpp @@ -43,7 +43,7 @@ QT_BEGIN_NAMESPACE namespace Qt3DAnimation { /*! - \qmltype LerpBlend + \qmltype LerpClipBlend \instantiates Qt3DAnimation::QLerpClipBlend \inqmlmodule Qt3D.Animation @@ -52,7 +52,7 @@ namespace Qt3DAnimation { \since 5.9 - LerpBlend can be useful to create advanced animation effects based on + LerpClipBlend can be useful to create advanced animation effects based on individual animation clips. For instance, given a player character,, lerp blending could be used to combine a walking animation clip with an injured animation clip based on a blend factor that increases the more the player @@ -118,7 +118,7 @@ Qt3DCore::QNodeCreatedChangeBasePtr QLerpClipBlend::createNodeCreationChange() c } /*! - \qmlproperty real LerpBlend::blendFactor + \qmlproperty real LerpClipBlend::blendFactor Specifies the blending factor between 0 and 1 to control the blending of two animation clips. diff --git a/src/core/nodes/qentity.h b/src/core/nodes/qentity.h index f1a369c48..62398faa1 100644 --- a/src/core/nodes/qentity.h +++ b/src/core/nodes/qentity.h @@ -66,8 +66,8 @@ public: QVector<T *> componentsOfType() const { QVector<T*> matchComponents; - const QComponentVector components = this->components(); - for (QComponent *component : components) { + const QComponentVector comps = this->components(); + for (QComponent *component : comps) { T *typedComponent = qobject_cast<T*>(component); if (typedComponent != nullptr) matchComponents.append(typedComponent); diff --git a/src/core/transforms/matrix4x4_avx2_p.h b/src/core/transforms/matrix4x4_avx2_p.h index 74e7c911c..63858b35c 100644 --- a/src/core/transforms/matrix4x4_avx2_p.h +++ b/src/core/transforms/matrix4x4_avx2_p.h @@ -473,15 +473,13 @@ public: Vector3D_SSE mapVector(const Vector3D_SSE &vector) const { - const __m128 row1 = _mm_set_ps(0.0f, m13(), m12(), m11()); - const __m128 row2 = _mm_set_ps(0.0f, m23(), m22(), m21()); - const __m128 row3 = _mm_set_ps(0.0f, m33(), m32(), m31()); + const Vector3D_SSE row1(m11(), m12(), m13()); + const Vector3D_SSE row2(m21(), m22(), m23()); + const Vector3D_SSE row3(m31(), m32(), m33()); - const __m128 tmp = _mm_add_ps(_mm_mul_ps(vector.m_xyzw, row1), _mm_mul_ps(vector.m_xyzw, row2)); - - Vector3D_SSE v(Qt::Uninitialized); - v.m_xyzw = _mm_add_ps(tmp, _mm_mul_ps(vector.m_xyzw, row3)); - return v; + return Vector3D(Vector3D_SSE::dotProduct(row1, vector), + Vector3D_SSE::dotProduct(row2, vector), + Vector3D_SSE::dotProduct(row3, vector)); } friend Vector4D operator*(const Vector4D &vector, const Matrix4x4_AVX2 &matrix); diff --git a/src/core/transforms/matrix4x4_sse_p.h b/src/core/transforms/matrix4x4_sse_p.h index 287094be5..0ea2e37ad 100644 --- a/src/core/transforms/matrix4x4_sse_p.h +++ b/src/core/transforms/matrix4x4_sse_p.h @@ -356,15 +356,13 @@ public: Q_ALWAYS_INLINE Vector3D_SSE mapVector(const Vector3D_SSE &vector) const { - const __m128 row1 = _mm_set_ps(0.0f, m13(), m12(), m11()); - const __m128 row2 = _mm_set_ps(0.0f, m23(), m22(), m21()); - const __m128 row3 = _mm_set_ps(0.0f, m33(), m32(), m31()); + const Vector3D_SSE row1(m11(), m12(), m13()); + const Vector3D_SSE row2(m21(), m22(), m23()); + const Vector3D_SSE row3(m31(), m32(), m33()); - const __m128 tmp = _mm_add_ps(_mm_mul_ps(vector.m_xyzw, row1), _mm_mul_ps(vector.m_xyzw, row2)); - - Vector3D_SSE v(Qt::Uninitialized); - v.m_xyzw = _mm_add_ps(tmp, _mm_mul_ps(vector.m_xyzw, row3)); - return v; + return Vector3D(Vector3D_SSE::dotProduct(row1, vector), + Vector3D_SSE::dotProduct(row2, vector), + Vector3D_SSE::dotProduct(row3, vector)); } friend Q_ALWAYS_INLINE Vector4D operator*(const Vector4D &vector, const Matrix4x4_SSE &matrix); diff --git a/src/extras/defaults/qabstractcameracontroller.cpp b/src/extras/defaults/qabstractcameracontroller.cpp index 527ee7e8d..27df65d7b 100644 --- a/src/extras/defaults/qabstractcameracontroller.cpp +++ b/src/extras/defaults/qabstractcameracontroller.cpp @@ -209,7 +209,8 @@ void QAbstractCameraControllerPrivate::init() // Disable the logical device when the entity is disabled QObject::connect(q, &Qt3DCore::QEntity::enabledChanged, m_logicalDevice, &Qt3DInput::QLogicalDevice::setEnabled); - + QObject::connect(q, &Qt3DCore::QEntity::enabledChanged, + m_frameAction, &Qt3DLogic::QFrameAction::setEnabled); QObject::connect(m_escapeButtonAction, &Qt3DInput::QAction::activeChanged, q, [this](bool isActive) { diff --git a/src/extras/defaults/qmetalroughmaterial.cpp b/src/extras/defaults/qmetalroughmaterial.cpp index 572bfecfd..a969593db 100644 --- a/src/extras/defaults/qmetalroughmaterial.cpp +++ b/src/extras/defaults/qmetalroughmaterial.cpp @@ -212,7 +212,7 @@ QMetalRoughMaterial::~QMetalRoughMaterial() color value or a texture. By default the value of this property is "grey". */ /*! - \qmlproperty color Qt3D.Extras::MetalRoughMaterial::baseColor + \qmlproperty variant Qt3D.Extras::MetalRoughMaterial::baseColor Holds the current base color of the material. This can be either a plain color value or a texture. By default the value of this property is "grey". @@ -232,7 +232,7 @@ QVariant QMetalRoughMaterial::baseColor() const property is 0. */ /*! - \qmlproperty real Qt3D.Extras::MetalRoughMaterial::metalness + \qmlproperty variant Qt3D.Extras::MetalRoughMaterial::metalness Holds the current metalness level of the material, as a value between 0 (purely dielectric, the default) and 1 (purely metallic). This can be @@ -253,7 +253,7 @@ QVariant QMetalRoughMaterial::metalness() const 0. */ /*! - \qmlproperty real Qt3D.Extras::MetalRoughMaterial::roughness + \qmlproperty variant Qt3D.Extras::MetalRoughMaterial::roughness Holds the current roughness level of the material. This can be either a plain uniform value or a texture. By default the value of this property is diff --git a/src/extras/defaults/qskyboxentity.cpp b/src/extras/defaults/qskyboxentity.cpp index e82a30950..8d01e8d82 100644 --- a/src/extras/defaults/qskyboxentity.cpp +++ b/src/extras/defaults/qskyboxentity.cpp @@ -240,7 +240,7 @@ void QSkyboxEntityPrivate::reloadTexture() /*! * \qmltype SkyboxEntity * \instantiates Qt3DExtras::QSkyboxEntity - \inqmlmodule Qt3D.Extras + * \inqmlmodule Qt3D.Extras * * \brief SkyboxEntity is a convenience Entity subclass that can be used to * insert a skybox in a 3D scene. diff --git a/src/extras/defaults/qspritegrid.cpp b/src/extras/defaults/qspritegrid.cpp index 31d4dd5c0..15016a891 100644 --- a/src/extras/defaults/qspritegrid.cpp +++ b/src/extras/defaults/qspritegrid.cpp @@ -57,7 +57,7 @@ QSpriteGridPrivate::QSpriteGridPrivate() int QSpriteGridPrivate::maxIndex() const { - return m_numColumns * m_numRows; + return m_numColumns * m_numRows - 1; } void QSpriteGridPrivate::updateSizes() @@ -65,10 +65,10 @@ void QSpriteGridPrivate::updateSizes() Q_Q(QSpriteGrid); if (m_texture && m_numColumns && m_numRows) { m_textureSize = QSize(m_texture->width(), m_texture->height()); - m_cellSize = QSize(m_texture->width() / m_numColumns, m_texture->height() / m_numRows); + m_cellSize = QSizeF((float) m_texture->width() / m_numColumns, (float) m_texture->height() / m_numRows); } else { m_textureSize = QSize(); - m_cellSize = QSize(); + m_cellSize = QSizeF(); } if (m_cellSize.isEmpty() || m_numColumns == 0 || m_numRows == 0) { diff --git a/src/extras/defaults/qspritegrid_p.h b/src/extras/defaults/qspritegrid_p.h index 6135ebf0d..8d05b2bcc 100644 --- a/src/extras/defaults/qspritegrid_p.h +++ b/src/extras/defaults/qspritegrid_p.h @@ -69,7 +69,7 @@ class QSpriteGridPrivate : public QAbstractSpriteSheetPrivate int m_numColumns; int m_numRows; - QSize m_cellSize; + QSizeF m_cellSize; Q_DECLARE_PUBLIC(QSpriteGrid) }; diff --git a/src/extras/defaults/qspritesheet.cpp b/src/extras/defaults/qspritesheet.cpp index 87f664ce4..8eb1e33e6 100644 --- a/src/extras/defaults/qspritesheet.cpp +++ b/src/extras/defaults/qspritesheet.cpp @@ -56,7 +56,7 @@ QSpriteSheetPrivate::QSpriteSheetPrivate() int QSpriteSheetPrivate::maxIndex() const { - return m_sprites.count(); + return m_sprites.count() - 1; } void QSpriteSheetPrivate::updateSizes() @@ -77,7 +77,7 @@ void QSpriteSheetPrivate::updateSizes() return; } - if (m_currentIndex < 0 || m_currentIndex > m_sprites.size()) { + if (m_currentIndex < 0 || m_currentIndex >= m_sprites.size()) { m_currentIndex = 0; emit q->currentIndexChanged(m_currentIndex); } diff --git a/src/render/frontend/qcamera.cpp b/src/render/frontend/qcamera.cpp index 1bf8caad9..2dcec7ed6 100644 --- a/src/render/frontend/qcamera.cpp +++ b/src/render/frontend/qcamera.cpp @@ -348,6 +348,18 @@ void QCameraPrivate::updateViewMatrixAndTransform(bool doEmit) * Holds the current projection matrix of the camera. */ +/*! + * \qmlproperty real Qt3D.Render::Camera::exposure + * Holds the current exposure of the camera. + * + * The default value is 0.0. + * + * The MetalRoughMaterial in Qt 3D Extras is currently the only provided + * material that makes use of camera exposure. Negative values will cause + * the material to be darker, and positive values will cause it to be lighter. + * + * Custom materials may choose to interpret the value differently. + */ /*! * \qmlproperty vector3d Qt3D.Render::Camera::position @@ -493,6 +505,14 @@ void QCameraPrivate::updateViewMatrixAndTransform(bool doEmit) /*! * \property QCamera::exposure * Holds the current exposure of the camera. + * + * The default value is 0.0. + * + * The MetalRoughMaterial in Qt 3D Extras is currently the only provided + * material that makes use of camera exposure. Negative values will cause + * the material to be darker, and positive values will cause it to be lighter. + * + * Custom materials may choose to interpret the value differently. */ /*! diff --git a/src/render/lights/qenvironmentlight.cpp b/src/render/lights/qenvironmentlight.cpp index b3dac56ff..86ef04f95 100644 --- a/src/render/lights/qenvironmentlight.cpp +++ b/src/render/lights/qenvironmentlight.cpp @@ -55,7 +55,21 @@ namespace Qt3DRender * \since 5.9 * * EnvironmentLight uses cubemaps to implement image-based lighting (IBL), a technique - * often used in conjunction with physically-based rendering (PBR). + * often used in conjunction with physically-based rendering (PBR). The cubemaps are + * typically expected be based on high dynamic range (HDR) images, with a suitable + * OpenGL format (such as RGBA16F) that can handle the increased range of values. + * + * There are a variety of tools that can be used to produce the cubemaps needed by + * EnvironmentLight. Some examples include + * + * \list + * \li \l {https://github.com/dariomanesku/cmftStudio}{cmftStudio} + * \li \l {https://github.com/derkreature/IBLBaker}{IBLBaker} + * \li \l {https://www.knaldtech.com/lys/}{Lys} + * \endlist + * + * \l {https://hdrihaven.com/hdris/}{HDRI Haven} provides many CC0-licensed HDR images + * that can be used as source material for the above tools. */ QEnvironmentLightPrivate::QEnvironmentLightPrivate() @@ -101,8 +115,22 @@ Qt3DCore::QNodeCreatedChangeBasePtr QEnvironmentLight::createNodeCreationChange( \brief Encapsulate an environment light object in a Qt 3D scene. \since 5.9 - EnvironmentLight uses cubemaps to implement image-based lighting (IBL), a technique - often used in conjunction with physically-based rendering (PBR). + QEnvironmentLight uses cubemaps to implement image-based lighting (IBL), a technique + often used in conjunction with physically-based rendering (PBR). The cubemaps are + typically expected be based on high dynamic range (HDR) images, with a suitable + OpenGL format (such as RGBA16F) that can handle the increased range of values. + + There are a variety of tools that can be used to produce the cubemaps needed by + QEnvironmentLight. Some examples include + + \list + \li \l {https://github.com/dariomanesku/cmftStudio}{cmftStudio} + \li \l {https://github.com/derkreature/IBLBaker}{IBLBaker} + \li \l {https://www.knaldtech.com/lys/}{Lys} + \endlist + + \l {https://hdrihaven.com/hdris/}{HDRI Haven} provides many CC0-licensed HDR images + that can be used as source material for the above tools. */ QEnvironmentLight::QEnvironmentLight(Qt3DCore::QNode *parent) diff --git a/src/render/renderers/opengl/jobs/renderviewjobutils.cpp b/src/render/renderers/opengl/jobs/renderviewjobutils.cpp index 24978fd87..c70f82dea 100644 --- a/src/render/renderers/opengl/jobs/renderviewjobutils.cpp +++ b/src/render/renderers/opengl/jobs/renderviewjobutils.cpp @@ -197,7 +197,7 @@ void setRenderViewConfigFromFrameGraphLeafNode(RenderView *rv, const FrameGraphN // Add states from new stateSet we might be missing // but don' t override existing states (lower StateSetNode always has priority) if (rStateSet->hasRenderStates()) - addUniqueStatesToRenderStateSet(stateSet, rStateSet->renderStates(), manager->renderStateManager()); + addStatesToRenderStateSet(stateSet, rStateSet->renderStates(), manager->renderStateManager()); break; } @@ -436,13 +436,13 @@ void parametersFromMaterialEffectTechnique(ParameterInfoList *infoList, } // Only add states with types we don't already have -void addUniqueStatesToRenderStateSet(RenderStateSet *stateSet, - const QVector<Qt3DCore::QNodeId> stateIds, - RenderStateManager *manager) +void addStatesToRenderStateSet(RenderStateSet *stateSet, + const QVector<Qt3DCore::QNodeId> stateIds, + RenderStateManager *manager) { for (const Qt3DCore::QNodeId &stateId : stateIds) { RenderStateNode *node = manager->lookupResource(stateId); - if (node->isEnabled() && !stateSet->hasStateOfType(node->type())) { + if (node->isEnabled() && stateSet->canAddStateOfType(node->type())) { stateSet->addState(node->impl()); } } diff --git a/src/render/renderers/opengl/jobs/renderviewjobutils_p.h b/src/render/renderers/opengl/jobs/renderviewjobutils_p.h index bd2e12534..b2fa59785 100644 --- a/src/render/renderers/opengl/jobs/renderviewjobutils_p.h +++ b/src/render/renderers/opengl/jobs/renderviewjobutils_p.h @@ -150,9 +150,9 @@ void parametersFromParametersProvider(ParameterInfoList *infoList, Q_AUTOTEST_EXPORT ParameterInfoList::const_iterator findParamInfo(ParameterInfoList *infoList, const int nameId); -Q_AUTOTEST_EXPORT void addUniqueStatesToRenderStateSet(RenderStateSet *stateSet, - const QVector<Qt3DCore::QNodeId> stateIds, - RenderStateManager *manager); +Q_AUTOTEST_EXPORT void addStatesToRenderStateSet(RenderStateSet *stateSet, + const QVector<Qt3DCore::QNodeId> stateIds, + RenderStateManager *manager); typedef QHash<int, QVariant> UniformBlockValueBuilderHash; diff --git a/src/render/renderers/opengl/renderer/renderview.cpp b/src/render/renderers/opengl/renderer/renderview.cpp index 378cb02ab..b00f2c473 100644 --- a/src/render/renderers/opengl/renderer/renderview.cpp +++ b/src/render/renderers/opengl/renderer/renderview.cpp @@ -655,7 +655,7 @@ QVector<RenderCommand *> RenderView::buildDrawRenderCommands(const QVector<Entit RenderPass *pass = passData.pass; if (pass->hasRenderStates()) { command->m_stateSet = new RenderStateSet(); - addUniqueStatesToRenderStateSet(command->m_stateSet, pass->renderStates(), m_manager->renderStateManager()); + addStatesToRenderStateSet(command->m_stateSet, pass->renderStates(), m_manager->renderStateManager()); if (m_stateSet != nullptr) command->m_stateSet->merge(m_stateSet); command->m_changeCost = m_renderer->defaultRenderState()->changeCost(command->m_stateSet); @@ -780,7 +780,7 @@ QVector<RenderCommand *> RenderView::buildComputeRenderCommands(const QVector<En if (pass->hasRenderStates()) { command->m_stateSet = new RenderStateSet(); - addUniqueStatesToRenderStateSet(command->m_stateSet, pass->renderStates(), m_manager->renderStateManager()); + addStatesToRenderStateSet(command->m_stateSet, pass->renderStates(), m_manager->renderStateManager()); // Merge per pass stateset with global stateset // so that the local stateset only overrides diff --git a/src/render/renderers/opengl/renderstates/renderstateset.cpp b/src/render/renderers/opengl/renderstates/renderstateset.cpp index b14695c77..d667d9c76 100644 --- a/src/render/renderers/opengl/renderstates/renderstateset.cpp +++ b/src/render/renderers/opengl/renderstates/renderstateset.cpp @@ -112,17 +112,28 @@ void RenderStateSet::merge(RenderStateSet *other) // We only add states which are new (different type) for (const StateVariant &otherState : otherStates) { - const bool hasFoundStateOfSameType = hasStateOfType(otherState.type); - if (!hasFoundStateOfSameType) + const bool canAdd = canAddStateOfType(otherState.type); + if (canAdd) m_states.push_back(otherState); } } +bool RenderStateSet::canAddStateOfType(StateMask type) const +{ + return !hasStateOfType(type) || allowMultipleStatesOfType(type); +} + bool RenderStateSet::hasStateOfType(StateMask type) const { return (type & stateMask()); } +bool RenderStateSet::allowMultipleStatesOfType(StateMask type) const +{ + return (type == BlendEquationArgumentsMask) || + (type == ClipPlaneMask); +} + bool RenderStateSet::contains(const StateVariant &ds) const { // trivial reject using the state mask bits diff --git a/src/render/renderers/opengl/renderstates/renderstateset_p.h b/src/render/renderers/opengl/renderstates/renderstateset_p.h index 29be4d2f1..c2f3a0219 100644 --- a/src/render/renderers/opengl/renderstates/renderstateset_p.h +++ b/src/render/renderers/opengl/renderstates/renderstateset_p.h @@ -93,8 +93,7 @@ public: QVector<StateVariant> states() const { return m_states; } - bool hasStateOfType(StateMask type) const; - + bool canAddStateOfType(StateMask type) const; /** * @brief contains - check if this set contains a matching piece of state @@ -102,6 +101,11 @@ public: * @return */ bool contains(const StateVariant &ds) const; + +private: + bool hasStateOfType(StateMask type) const; + bool allowMultipleStatesOfType(StateMask type) const; + private: StateMaskSet m_stateMask; QVector<StateVariant> m_states; diff --git a/tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp b/tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp index 144df6711..12eaab263 100644 --- a/tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp +++ b/tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp @@ -474,6 +474,55 @@ private Q_SLOTS: QCOMPARE(row.w(), 44.0f); } } + + void checkVectorMapVector() + { + { + // GIVEN + QMatrix4x4 tmpMat; + QVector3D tmpVec3(1.0f, 0.0f, 0.0f); + tmpMat.rotate(90.f, 0.f, 1.f, 0.f); + + Matrix4x4_AVX2 mat(tmpMat); + Vector3D vec3(tmpVec3); + + // WHEN + const Vector3D resultingVec = mat.mapVector(vec3); + + // THEN + QCOMPARE(resultingVec.toQVector3D(), tmpMat.mapVector(tmpVec3)); + } + { + // GIVEN + QMatrix4x4 tmpMat; + QVector3D tmpVec3(0.0f, 0.0f, -1.0f); + tmpMat.rotate(90.f, 0.f, 1.f, 0.f); + + Matrix4x4_AVX2 mat(tmpMat); + Vector3D vec3(tmpVec3); + + // WHEN + const Vector3D resultingVec = mat.mapVector(vec3); + + // THEN + QCOMPARE(resultingVec.toQVector3D(), tmpMat.mapVector(tmpVec3)); + } + { + // GIVEN + QMatrix4x4 tmpMat; + QVector3D tmpVec3(3.0f, -3.0f, -1.0f); + tmpMat.rotate(90.f, 0.33f, 0.33f, 0.33f); + + Matrix4x4_AVX2 mat(tmpMat); + Vector3D vec3(tmpVec3); + + // WHEN + const Vector3D resultingVec = mat.mapVector(vec3); + + // THEN + QCOMPARE(resultingVec.toQVector3D(), tmpMat.mapVector(tmpVec3)); + } + } }; QTEST_MAIN(tst_Matrix4x4_AVX2) diff --git a/tests/auto/core/matrix4x4_sse/tst_matrix4x4_sse.cpp b/tests/auto/core/matrix4x4_sse/tst_matrix4x4_sse.cpp index bbd6596d4..dccf90d10 100644 --- a/tests/auto/core/matrix4x4_sse/tst_matrix4x4_sse.cpp +++ b/tests/auto/core/matrix4x4_sse/tst_matrix4x4_sse.cpp @@ -471,6 +471,55 @@ private Q_SLOTS: QCOMPARE(row.w(), 44.0f); } } + + void checkVectorMapVector() + { + { + // GIVEN + QMatrix4x4 tmpMat; + QVector3D tmpVec3(1.0f, 0.0f, 0.0f); + tmpMat.rotate(90.f, 0.f, 1.f, 0.f); + + Matrix4x4_SSE mat(tmpMat); + Vector3D vec3(tmpVec3); + + // WHEN + const Vector3D resultingVec = mat.mapVector(vec3); + + // THEN + QCOMPARE(resultingVec.toQVector3D(), tmpMat.mapVector(tmpVec3)); + } + { + // GIVEN + QMatrix4x4 tmpMat; + QVector3D tmpVec3(0.0f, 0.0f, -1.0f); + tmpMat.rotate(90.f, 0.f, 1.f, 0.f); + + Matrix4x4_SSE mat(tmpMat); + Vector3D vec3(tmpVec3); + + // WHEN + const Vector3D resultingVec = mat.mapVector(vec3); + + // THEN + QCOMPARE(resultingVec.toQVector3D(), tmpMat.mapVector(tmpVec3)); + } + { + // GIVEN + QMatrix4x4 tmpMat; + QVector3D tmpVec3(3.0f, -3.0f, -1.0f); + tmpMat.rotate(90.f, 0.33f, 0.33f, 0.33f); + + Matrix4x4_SSE mat(tmpMat); + Vector3D vec3(tmpVec3); + + // WHEN + const Vector3D resultingVec = mat.mapVector(vec3); + + // THEN + QCOMPARE(resultingVec.toQVector3D(), tmpMat.mapVector(tmpVec3)); + } + } }; QTEST_MAIN(tst_Matrix4x4_SSE) |