diff options
author | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-08-24 03:04:10 +0200 |
---|---|---|
committer | Qt Forward Merge Bot <qt_forward_merge_bot@qt-project.org> | 2019-08-24 03:04:10 +0200 |
commit | f74a1c905764e27dbce4966e430c45f46be08e64 (patch) | |
tree | 90741503d55e9dbaf46367ee9cf0be3b3456132d | |
parent | e1772c0a015ffac562b64e2c958a09d0ca074cd1 (diff) | |
parent | 29541954dc1ab128295487f25067876d9967b2f9 (diff) |
Merge remote-tracking branch 'origin/5.12' into 5.13
Change-Id: I7d7274866129a3c8a3ed3788680a46368120d20d
-rw-r--r-- | src/core/transforms/matrix4x4_avx2_p.h | 14 | ||||
-rw-r--r-- | src/core/transforms/matrix4x4_sse_p.h | 14 | ||||
-rw-r--r-- | src/render/frontend/qcamera.cpp | 20 | ||||
-rw-r--r-- | src/render/lights/qenvironmentlight.cpp | 34 | ||||
-rw-r--r-- | tests/auto/core/matrix4x4_avx2/tst_matrix4x4_avx2.cpp | 49 | ||||
-rw-r--r-- | tests/auto/core/matrix4x4_sse/tst_matrix4x4_sse.cpp | 49 |
6 files changed, 161 insertions, 19 deletions
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/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/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) |