summaryrefslogtreecommitdiffstats
path: root/src/gui/math3d
Commit message (Collapse)AuthorAgeFilesLines
* Fix private member initialization for QMatrix4x4(Qt::Uninitialized)Konstantin Ritt2015-03-161-1/+1
| | | | | | | | ...introduced in 348ac43821ad3b0251d383d82fb02b8ab52ddbeb Change-Id: Iae44cbc5590bfbbaba8c98d838995451fa958105 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Clarify QMatrix4x4::lookAt() docsLaszlo Agocs2015-03-071-4/+7
| | | | | | Task-number: QTBUG-44603 Change-Id: I72d143a5d9ddd31ab1b64788cc0e2dd4fca2531c Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Introduce QQuaternion::rotationTo(vecFrom, vecTo)Konstantin Ritt2015-03-072-0/+34
| | | | | | | | | which returns the shortest arc quaternion to rotate vector from to the destination vector to. Change-Id: Ibd7a746789ecdfe6f7fe17e4ac9049f7ac46560d Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* [QQuaternion] Add a way to convert to/from orthonormal axesKonstantin Ritt2015-03-072-2/+54
| | | | | | | | It is just a convenience wrapper around convertion to/from the rotation matrix. Change-Id: I27511b43866827172960b0152f1c7b65da857f6f Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Introduce QQuaternion::dotProduct()Konstantin Ritt2015-03-052-17/+27
| | | | | Change-Id: I14b9857ca0a43808b7d536fc258a6bb10f611211 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@theqtcompany.com>
* Fix QMatrix4x4::lookAt() in case of null directionKonstantin Ritt2015-02-261-1/+5
| | | | | | | | If direction is null, any valid orientation fits, so that the resulting matrix must be valid. Change-Id: Ie8060f44801822ee337b25f75fb275bd02223fe8 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Optimize quaternion to rotation matrix convertionKonstantin Ritt2015-02-262-38/+47
| | | | | | | | Rearrange operands to get rid of 50% of multiplications (i.e. `2 * (x * x + z * z)` -> `(x + x) * x + (z + z) * z`). Change-Id: Ib5279425ead999fc571b4964ac1681b6e22f9a7e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* [QQuaternion] Add operator* that rotates a vector with a quaternionKonstantin Ritt2015-02-262-0/+17
| | | | | | | | Same as quaternion.rotatedVector(vec). Expression like `vec = quat * vec` quite common in the 3D world. Change-Id: I0edd5a5f80537bd149f03f682b3de15c54463e23 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* [QQuaternion] Fix naming of the new methodsKonstantin Ritt2015-02-262-12/+12
| | | | | | | | | | | According to the Qt naming policy, methods that return value(s) via the mutable parameter(s) should have "get" prefix to mention that. [ChangeLog][QtGui][QQuaternion] Added methods to convert a quaternion to/from Euler angles and to/from rotation matrix. Change-Id: I95704e1f4623dc4ca54cd237ea203539fb60d452 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QtGui: Fix some qdoc-warnings.Friedemann Kleint2015-02-252-5/+5
| | | | | | | | | | | | | | qtbase/src/gui/math3d/qquaternion.cpp:466: warning: Undocumented parameter 'eulerAngles' in QQuaternion::fromEulerAngles() qtbase/src/gui/math3d/qquaternion.cpp:466: warning: No such parameter 'eulerAngles.y()' in QQuaternion::fromEulerAngles() qtbase/src/gui/math3d/qquaternion.cpp:466: warning: No such parameter 'eulerAngles.x()' in QQuaternion::fromEulerAngles() qtbase/src/gui/math3d/qquaternion.cpp:466: warning: No such parameter 'eulerAngles.z()' in QQuaternion::fromEulerAngles() qtbase/src/gui/math3d/qquaternion.cpp:455: warning: No such parameter 'pitch' in QQuaternion::toEulerAngles() qtbase/src/gui/math3d/qquaternion.cpp:455: warning: No such parameter 'roll' in QQuaternion::toEulerAngles() qtbase/src/gui/math3d/qquaternion.cpp:455: warning: No such parameter 'yaw' in QQuaternion::toEulerAngles() qtbase/src/gui/opengl/qopenglshaderprogram.cpp:2757: warning: No such parameter 'value' in QOpenGLShaderProgram::setUniformValueArray() Change-Id: Ib825ecb0db798380d97414ca3c3eba8bee3ab6ea Reviewed-by: Konstantin Ritt <ritt.ks@gmail.com>
* Use C++ <cmath> instead of <math.h>Allan Sandfeld Jensen2015-02-165-44/+44
| | | | | | | | | | | | | | Including math.h can pollute the default namespace, and break some compilers if cmath versions of the method are declared as using. Switching to C++ math functions also greatly simplifies handling of float qreal as C++ automatically chooses the right method. [ChangeLog][QtCore][QtMath] qmath.h no longer includes math.h, so any sources depending on that indirect inclusion may fail to build. Change-Id: I4d0e331dafba354ec05dc5052e61ef4ff8d387fe Reviewed-by: Rafael Roquetto <rafael.roquetto@kdab.com>
* [QQuaternion] Introduce to/from euler angles conversion routinesKonstantin Ritt2015-02-142-0/+144
| | | | | Change-Id: I26c0a9d1ce9258048cf44eed5b5238920c2317b1 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* [QQuaternion] Introduce toAxisAndAngle()Konstantin Ritt2015-02-142-0/+59
| | | | | | | | | This operation is the exact opposite to QQuaternion::fromAxisAndAngle() (so that it is a way to extract the axis and angle values suitable to create the same quaternion via QQuaternion::fromAxisAndAngle()). Change-Id: I41fda58f5fb2b867cccd6b2faf58ab671fa070da Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Update copyright headersJani Heikkinen2015-02-1112-84/+84
| | | | | | | | | | | | | | | | | | Qt copyrights are now in The Qt Company, so we could update the source code headers accordingly. In the same go we should also fix the links to point to qt.io. Outdated header.LGPL removed (use header.LGPL21 instead) Old header.LGPL3 renamed to header.LGPL3-COMM to match actual licensing combination. New header.LGPL-COMM taken in the use file which were using old header.LGPL3 (src/plugins/platforms/android/extract.cpp) Added new header.LGPL3 containing Commercial + LGPLv3 + GPLv2 license combination Change-Id: I6f49b819a8a20cc4f88b794a8f6726d975e8ffbe Reviewed-by: Matti Paaso <matti.paaso@theqtcompany.com>
* [QQuaternion] Introduce to/from rotation matrix conversion routinesKonstantin Ritt2015-02-062-0/+89
| | | | | | Change-Id: Ic19824e7e135f53a9ce3f2ea7ecd078a589e7425 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* [QMath3D] Add public c-tors that do not initialize the contentsKonstantin Ritt2015-02-0412-0/+54
| | | | | | Change-Id: I1a28766451e6750986a239c989e7f30c14479057 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Friedemann Kleint <Friedemann.Kleint@theqtcompany.com>
* Introduce QMatrix4x4::isAffine()Konstantin Ritt2015-01-282-0/+19
| | | | | | | | - a convenience method thats checks if the matrix has no projective coefficients. Change-Id: Ieea8ac2e4237b471a683ad5010672b1e89a0c953 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Introduce QQuaternion::inverted()Konstantin Ritt2015-01-282-0/+24
| | | | | Change-Id: I6de77082bb7c32e48fb7f7d765a58fdbe68db1fd Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* [QVectorND] Add missing operator/=(const QVectorND &)Konstantin Ritt2015-01-286-0/+108
| | | | | Change-Id: Ic1d2912808b95e02ba5d9cb2972c81c6374bbca9 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add project/unproject methods in QVector3DPaul Lemire2015-01-222-0/+69
| | | | | | | | | | Equivalent of gluProject and gluUnproject. [ChangeLog][QtCore][QVector3D] add convenience project and unproject methods to use like gluProject and gluUnproject Change-Id: I6e4e3e79ea6e34d1fb0c375e15185c950b699ef0 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Update license headers and add new license filesMatti Paaso2014-09-2412-228/+132
| | | | | | | | | - Renamed LICENSE.LGPL to LICENSE.LGPLv21 - Added LICENSE.LGPLv3 - Removed LICENSE.GPL Change-Id: Iec3406e3eb3f133be549092015cefe33d259a3f2 Reviewed-by: Iikka Eklund <iikka.eklund@digia.com>
* Add viewport transform to QMatrix4x4Sean Harmer2014-05-162-0/+53
| | | | | | | | | | | | | This allows to easily create a matrix that performs the transformation used by OpenGL fixed function to go from normalized device coordinates to window coordinates. This comes in useful if you need to perform the NDC->window coordinate conversion inside a shader. Change-Id: I183b3545bfb3eb1e8b13fc3172911b46926fcbb7 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Laszlo Agocs <laszlo.agocs@digia.com>
* Revert some previously added constexpr in QVector?d classesAlex Blasche2014-03-106-43/+7
| | | | | | | | | | | | | | This commit partly reverts cd91d8ad0281c984a01b8091696a6fdfdfa69514. The revert is required as the used ifdef relied on undefined compiler behavior. Especially Windows has had trouble. The revert reduces the risk of breaks by future compilers. The proper inline and constexpr has to wait until Qt 6. Task-number: QTBUG-37122 Change-Id: I881fffb95fa46d9c170c9420a578f15640e18aea Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make QVector* compile on Win/staticAlex Blasche2014-03-086-3/+11
| | | | | | Task-number: QTBUG-37122 Change-Id: Ib2283e8c27da7af2bdc08eee3b7cc542fbe55d71 Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Convert more QVector*D member functions to constexprAlex Blasche2013-11-203-3/+31
| | | | | | | | | | constexpr requires inline functions. We convert more member functions to inline functions while retaining a version of those functions inside QtGui. This prevents any BC breakage. Change-Id: I325b78da6b41611bda3994869f474c700b6fb306 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Add C++11 constexpr to 3D vector classesAlex Blasche2013-11-153-114/+114
| | | | | | | | | This turns QVector2D(1,1) into compile-time expressions when using a C++11 compiler. Change-Id: Ifea2d1cdfd5481300f9a5a0c7bbe8bfe9115c636 Reviewed-by: Marc Mutz <marc.mutz@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-086-29/+29
| | | | | | | | | | | | | | | | | Default values should have mark-up to denote that they are code. This commit changes: -"property is true" to "property is \c true". -"Returns true" to "Returns \c true". -"property is false" to "property is \c false". -"returns true" to "returns \c true". -"returns false" to "returns \c false". src/3rdparty and non-documentation instances were ignored. Task-number: QTBUG-33360 Change-Id: Ie87eaa57af947caa1230602b61c5c46292a4cf4e Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com>
* Add operator[] to QVectorND classesSean Harmer2013-08-276-0/+102
| | | | | | Change-Id: Ia786d4fab64da974bb60f24c05325925d42a1e70 Reviewed-by: Gunnar Sletta <gunnar.sletta@digia.com> Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Doc: Corrected a typo in the constructor documentation.Venu2013-03-271-1/+1
| | | | | | | | | Task-number: QTBUG-30162 Change-Id: I2db9ae7b5bab82cf4b65dc35bcb904ffbfb9e115 Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com> Reviewed-by: Jerome Pasion <jerome.pasion@digia.com> Reviewed-by: Martin Smith <martin.smith@digia.com>
* Add convenience distance methods to QVector2DLaszlo Papp2013-03-182-0/+36
| | | | | | Change-Id: I8ecdda35912a95e69c2f8dd98ce9c41c77b222d2 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* Add a minor convenience for calculating the distance to a pointLaszlo Papp2013-03-152-0/+14
| | | | | Change-Id: I312727bf6858ead6c30fe20bf3abc5afc73a3a14 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Remove QT_{BEGIN,END}_HEADER macro usageSergio Ahumada2013-01-296-24/+0
| | | | | | | | | | | The macro was made empty in ba3dc5f3b56d1fab6fe37fe7ae08096d7dc68bcb and is no longer necessary or used. Discussed-on: http://lists.qt-project.org/pipermail/development/2013-January/009284.html Change-Id: Id2bb2e2cabde059305d4af5f12593344ba30f001 Reviewed-by: Laszlo Papp <lpapp@kde.org> Reviewed-by: Jędrzej Nowacki <jedrzej.nowacki@digia.com> Reviewed-by: hjk <hjk121@nokiamail.com>
* Fix a typo and make the QQuaternion constructor documentation even more explicitLaszlo Papp2013-01-251-2/+3
| | | | | Change-Id: I913ef98b706f29f1bab7564d6d6fff0a91ebfdc0 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-1812-12/+12
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make the documentation more explicit an talkativeLaszlo Papp2012-12-072-8/+10
| | | | | | Change-Id: Ifa4b7c3c5f8ec384addbb80a9436d55b32d8bc51 Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Samuel Rødal <samuel.rodal@digia.com>
* WINCE: Fix missing cosfAndreas Holzammer2012-12-032-0/+4
| | | | | | | | | cosf seems to be defined in the cmath header for Windows CE, so include it to fix the issue of not finding the symbol cosf. Change-Id: I7317668838912325d45be0d4087ae3055940d3cd Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Remove last usages of qSin and friends from QQuaternionSean Harmer2012-11-261-6/+6
| | | | | Change-Id: I93fe1d22313da4cfa671603ccdbe9ac8f02cd73b Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-2212-288/+288
| | | | | | | | Change copyrights and license headers from Nokia to Digia Change-Id: If1cc974286d29fd01ec6c19dd4719a67f4c3f00e Reviewed-by: Lars Knoll <lars.knoll@digia.com> Reviewed-by: Sergio Ahumada <sergio.ahumada@digia.com>
* Remove temporary constructor used to make qreal->float changeSean Harmer2012-09-092-12/+0
| | | | | | | | | | | | The constructor being removed was needed to allow the CI to work until commit e88f56afc2c889eede8c719b9ce7b621f49a96f9 in qtdeclarative was merged. This completes the move from qreal->float in QtGui/math3d. Change-Id: I2afd108bd9398a1e6925b2885a90dbbad4d25669 Reviewed-by: Qt Doc Bot <qt_docbot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Make gui/math3d classes use float rather than qrealSean Harmer2012-09-0712-582/+615
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This corrects the mismatch between using floats for internal storage and qreal in the API of QVector*D which leads to lots of implicit casts between double and float. This change also stops users from being surprised by the loss of precision when using these classes on desktop platforms and removes the need for the private constructors taking a dummy int as the final argument. The QMatrix4x4 and QQuaternion classes have been changed to use float for their internal storage since these are meant to be used in conjunction with the QVector*D classes. This is to prevent unexpected loss of precision and to improve performance. The on-disk format has also been changed from double to float thereby reducing the storage required when streaming vectors and matrices. This is potentially a large saving when working with complex 3D meshes etc. This also has a significant performance improvement when passing matrices to QOpenGLShaderProgram (and QGLShaderProgram) as we no longer have to iterate and convert the data to floats. This is an operation that could easily be needed many times per frame. This change also opens the door for further optimisations of these classes to be implemented by using SIMD intrinsics. This needs to be applied in conjunction with https://codereview.qt-project.org/#change,33548 Task-number: QTBUG-21035 Task-number: QTBUG-20661 Change-Id: I9321b06040ffb93ae1cbd72fd2013267ac901b2e Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Move the QDataStream operator<< for QPair to qdatastream.hThiago Macieira2012-06-284-0/+4
| | | | | | | | | | QPair is small and is no problem to include from qdatastream.h. However, including QDataStream from qpair.h means including QIODevice and QObject too. Change-Id: I344321e9f68438008ec329a165135c3a346c6058 Reviewed-by: Lars Knoll <lars.knoll@nokia.com> Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
* Get started with patching up the Qt GUI docsGunnar Sletta2012-06-286-0/+6
| | | | | | | | Primary goal, make the front page of the Qt GUI module a bit more clarifying and avoid downstream references inside the Qt GUI docs. Change-Id: Icbcfbb64b93963add889bf83711daa9575885c02 Reviewed-by: Samuel Rødal <samuel.rodal@nokia.com>
* QtGui: make some constructors explicitMarc Mutz2012-03-142-2/+2
| | | | | | | | | This is a semi-automatic search, so I'm reasonably sure that all the exported ones have been caught. Change-Id: I5b122db2498dbb2aee50c7ad95c67e708aade45b Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>
* Remove the usage of deprecated qdoc macros.Casper van Donderen2012-03-025-9/+9
| | | | | | | | | | | QDoc now has support for Doxygen style commands for italics, bold and list items. This change applies that change in QDoc to the actual documentation. Task-number: QTBUG-24578 Change-Id: I519bf9c29b14092e3ab6067612f42bf749eeedf5 Reviewed-by: Shane Kearns <shane.kearns@accenture.com> Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Remove many deprecated methodsLars Knoll2012-01-311-1/+1
| | | | | | | | | | Remove methods that have been marked as deprecated before Qt 4.6. Keep others, but inline them where possible and mark them as QT_DEPRECATED_SINCE(5, 0). Change-Id: If881821ae095f054b31cc13464f19e2007c20ed7 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com> Reviewed-by: João Abecasis <joao.abecasis@nokia.com>
* Remove "All rights reserved" line from license headers.Jason McDonald2012-01-3012-12/+12
| | | | | | | | | | As in the past, to avoid rewriting various autotests that contain line-number information, an extra blank line has been inserted at the end of the license text to ensure that this commit does not change the total number of lines in the license header. Change-Id: I311e001373776812699d6efc045b5f742890c689 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Remove use of QT_MODULE from libraryGunnar Sletta2012-01-256-6/+0
| | | | | | | | | | These defines were there to aid in the commercial licensing scheme we used long ago, and are no longer needed. Keep a QT_MODULE(x) define so other modules continue compiling. Change-Id: I8fd76cd5270df8f14aee746b6cf32ebf7c23fec7 Reviewed-by: Lars Knoll <lars.knoll@nokia.com>
* Update contact information in license headers.Jason McDonald2012-01-2312-12/+12
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Update copyright year in license headers.Jason McDonald2012-01-0512-12/+12
| | | | | Change-Id: I02f2c620296fcd91d4967d58767ea33fc4e1e7dc Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>
* Optimized QMatrix4x4 by improving how 'flagBits' are used.Kim Motoyoshi Kalland2011-08-292-408/+572
| | | | | | | Change-Id: Ic417336489d334e25b547c719d457faf65307cac Reviewed-on: http://codereview.qt.nokia.com/3670 Reviewed-by: Qt Sanity Bot <qt_sanity_bot@ovi.com> Reviewed-by: Gunnar Sletta <gunnar.sletta@nokia.com>