diff options
24 files changed, 229 insertions, 51 deletions
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 29703878d..c2df23c6d 100644 --- a/src/render/frontend/qcamera.cpp +++ b/src/render/frontend/qcamera.cpp @@ -336,6 +336,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 @@ -469,6 +481,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/picking/qobjectpicker.cpp b/src/render/picking/qobjectpicker.cpp index a0b6d8dcd..f41ea06a6 100644 --- a/src/render/picking/qobjectpicker.cpp +++ b/src/render/picking/qobjectpicker.cpp @@ -109,6 +109,8 @@ namespace Qt3DRender { \sa PickingSettings, Geometry, Attribute, PickEvent, PickTriangleEvent + \note To receive hover events in QtQuick, the hoverEnabled property of Scene3D must also be set. + \note Instances of this component shouldn't be shared, not respecting that condition will most likely result in undefined behavior. */ diff --git a/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp b/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp index 51f7cebd1..1a2971a3f 100644 --- a/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp +++ b/src/render/renderers/opengl/graphicshelpers/submissioncontext.cpp @@ -577,7 +577,7 @@ QSize SubmissionContext::renderTargetSize(const QSize &surfaceSize) const } else { renderTargetSize = m_surface->size(); if (m_surface->surfaceClass() == QSurface::Window) { - int dpr = static_cast<QWindow *>(m_surface)->devicePixelRatio(); + const float dpr = static_cast<QWindow *>(m_surface)->devicePixelRatio(); renderTargetSize *= dpr; } } diff --git a/src/render/renderers/opengl/jobs/renderviewjobutils.cpp b/src/render/renderers/opengl/jobs/renderviewjobutils.cpp index c2d75b499..d8f27d1cd 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; } @@ -432,13 +432,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 9bbf966c8..4bb3ba2f8 100644 --- a/src/render/renderers/opengl/renderer/renderview.cpp +++ b/src/render/renderers/opengl/renderer/renderview.cpp @@ -603,7 +603,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); @@ -728,7 +728,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/src/render/renderers/opengl/textures/gltexture.cpp b/src/render/renderers/opengl/textures/gltexture.cpp index 42deb4c2a..4fd8a8a86 100644 --- a/src/render/renderers/opengl/textures/gltexture.cpp +++ b/src/render/renderers/opengl/textures/gltexture.cpp @@ -522,6 +522,13 @@ void GLTexture::uploadGLTextureData() void GLTexture::updateGLTextureParameters() { + const bool isMultisampledTexture = (m_actualTarget == QAbstractTexture::Target2DMultisample || + m_actualTarget == QAbstractTexture::Target2DMultisampleArray); + // Multisampled textures can only be accessed by texelFetch in shaders + // and don't support wrap modes and mig/mag filtes + if (isMultisampledTexture) + return; + m_gl->setWrapMode(QOpenGLTexture::DirectionS, static_cast<QOpenGLTexture::WrapMode>(m_parameters.wrapModeX)); if (m_actualTarget != QAbstractTexture::Target1D && m_actualTarget != QAbstractTexture::Target1DArray && 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) diff --git a/tests/manual/downloading/main.qml b/tests/manual/downloading/main.qml index a78cf605e..f8631e9b1 100644 --- a/tests/manual/downloading/main.qml +++ b/tests/manual/downloading/main.qml @@ -81,7 +81,7 @@ Entity { Mesh { id: mesh - source: "https://codereview.qt-project.org/gitweb?p=qt/qt3d.git;a=blob_plain;hb=refs/heads/dev;f=examples/qt3d/exampleresources/assets/chest/Chest.obj" + source: "https://codereview.qt-project.org/gitweb?p=qt/qt3d.git;a=blob_plain;f=examples/qt3d/exampleresources/assets/obj/plane-10x10.obj" onStatusChanged: console.log("Mesh status " + status) } |