summaryrefslogtreecommitdiffstats
path: root/src/gui/math3d/qmatrix4x4.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Doc: Fix \fn template arguments for Qt GuiTopi Reinio2023-11-181-1/+1
| | | | | | | | | Upcoming changes to QDoc require accurate definition for template arguments in \fn commands. Task-number: QTBUG-118080 Change-Id: I75f8956c5fc094402837f96bd4598b60e3a7c649 Reviewed-by: Luca Di Sera <luca.disera@qt.io>
* Allow specify distance to plane for QTransformJiDe Zhang2022-08-181-11/+28
| | | | | | | | | | | | | | | | | The default camera to plane distance is 1024, when rotating a big image along the x or y axis, some areas of the screen may move above the camera, causing the rotation to fail. A new rotation interface has been added to allow users to specify the distance from the camera to the plane themselves when rotating the QImage. Also, this support has been added to QMatrix4x4::projectedRotate. [ChangeLog][QtGui][QTransform] Added overloads to rotate() and rotateRadians() that allow specifying of the distance to the rotation plane. Fixes: QTBUG-105088 Change-Id: I81f629916ddd9b6ab84e0282191e4284a88a85f5 Reviewed-by: Eirik Aavitsland <eirik.aavitsland@qt.io>
* Use SPDX license identifiersLucie Gérard2022-05-161-38/+2
| | | | | | | | | | | | | Replace the current license disclaimer in files by a SPDX-License-Identifier. Files that have to be modified by hand are modified. License files are organized under LICENSES directory. Task-number: QTBUG-67283 Change-Id: Id880c92784c40f3bbde861c0d93f58151c18b9f1 Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: Lars Knoll <lars.knoll@qt.io> Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
* Fix up some QMatrix4x4 docsLaszlo Agocs2022-03-291-4/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The deprecation note for one of the operator* is wrong: Using mapVector() is never the right choice given the deprecated operator* itself is implemented by calling map(). It could be that in some cases the results are identical so one can get away with migrating to mapVector(), but this is incorrect in other cases and causes regressions all over the place. Thus we should only recommend using map() instead, never mapVector(). As shown by recent experiences, the current docs are insufficient/wrong and caused a number of regressions in the Qt code base as well. Also enhance some related docs. It could be that the wording is not always academically correct, however having some additional notes in there help make it obvious to the reader (or at least raise some alarms) that there are important differences between map and mapVector. Also improve the note for the other deprecated operator*. There is only one way to convert to a vec4, given the existing implementation of the operator, and that is by using 1 for w. Make this clear to the reader. Pick-to: 6.3 6.2 Change-Id: I1d8dbca44fdc103ab62d49bfc1d4ce37a9bc130b Reviewed-by: Mårten Nordheim <marten.nordheim@qt.io> Reviewed-by: Andy Nichols <andy.nichols@qt.io>
* gui: Fix typos in documentationJonas Kvinge2021-10-121-4/+4
| | | | | | Pick-to: 5.15 6.2 Change-Id: I533f5a55cd0cd60a76990b552d7dab51a301ac1c Reviewed-by: Giuseppe D'Angelo <giuseppe.dangelo@kdab.com>
* Doc: Ensure deprecated APIs in Gui are documented as suchNico Vertriest2021-07-261-4/+4
| | | | | | | | | | | Added missing #if-ery and deprecation macros to a QFont constructor that was only documented as deprecated. Fixes: QTBUG-94521 Fixes: QTBUG-95310 Pick-to: 6.2 6.1 Change-Id: I3d0418a3f7dca191a9068cc22627fe4deb7c53c5 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Use \deprecated instead of \obsoletePaul Wicking2021-05-261-4/+4
| | | | | | Task-number: QTBUG-93990 Change-Id: I4e512354a49dde6678ca89cabc56bc76ba666bb3 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Fix documentation warnings qtbaseNico Vertriest2021-02-181-4/+4
| | | | | | Task-number: QTBUG-90662 Change-Id: If31847f8f2b8b57a8a8624d0406a030b5752f1c8 Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* QMatrix4x4: deprecate operator*(QVector3D, QMatrix4x4)Giuseppe D'Angelo2021-02-111-3/+5
| | | | | | | | | | | | | | | | | | | | | | | | | | | | The operation is sketchy for a number of reasons: 1) Mathematically, it doesn't make sense. The code interprets the QVector3D as a point, extending it with w=1, and uses it as a row vector. But similarly, the vector could be intepreted as a directional vector, with w=0. No semantic is "better" than the other. 2) QMatrix4x4 is not meant to be post-multiplied. Granted, one could use a QMatrix4x4 as arbitrary storage for 16 floats, but QMatrix4x4 builds itself to be always *pre* multiplied (e.g. translate changes the 4th column, not the 4th row). We can keep post multiplication for the general case if we do it against a QVector4D, but I don't feel that we should support it also for QVector3D. [ChangeLog][QtGui][QMatrix4x4] The multiplication operator (operator*) between a QVector3D and a QMatrix4x4 has been deprecated. User code needs to extend the QVector3D to a QVector4D first (by specifying the intended w coordinate), and then multiply the QVector4D by the matrix. Pick-to: 6.1 Change-Id: I41b64d8ab7eb6126dc4c49fe29cf3f1b7afc7987 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* QMatrix4x4: deprecate operator*(QMatrix4x4, QVector3D/QPoint(F))Giuseppe D'Angelo2021-02-111-3/+22
| | | | | | | | | | | | | | | | | | | | | | | | | | The operation does not make sense at the "fundamental" level for these classes (algebraic, in this case), so it shouldn't exist. It's also a semantic trap: * it interprets a _vector_ as a _point_ instead (the vector gets 1-extended in 4D) * after the multiplication, it gets perspective divided. These semantics do not belong to operator*. operator*(QVector3D/QPoint(F), QMatrix) will be tackled in a next commit; we don't have a straightforward replacement for it. Drive-by, document that map() interprets vectors as points. [ChangeLog][QtGui][QMatrix4x4] operator* between a QMatrix4x4 and a QVector3D, QPoint, or QPointF has been deprecated in favor of map() and mapVector(). Pick-to: 6.1 Task-number: QTBUG-89708 Change-Id: Iad78d6eb68cc8cdc3ac16b1635c4d3b522c95213 Reviewed-by: Edward Welbourne <edward.welbourne@qt.io>
* Doc: Link to correct locationPaul Wicking2021-01-111-4/+4
| | | | | | | | | Reflow text to fit style while at it, to satisfy git clang-format. Pick-to: 6.0 5.15 Fixes: QTBUG-89709 Change-Id: Iab2bf09399adf2cb0f0219ab40978bb238825ae8 Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Get rid of the QMatrix4x4(int) constructorLars Knoll2020-11-191-21/+21
| | | | | | | QMatrix4x4(Qt::Uninitialized) does the same thing. Change-Id: Ie226690f417505f082cb69fdb476e34db2b19c15 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* De-inline qFuzzyCompare for QMatrix4x4 and QVector4DLars Knoll2020-11-191-0/+20
| | | | | Change-Id: Ic412d5cefcc1c41e90ee5cf98814469aec3a91f6 Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* Doc: Fix documentation warnings for Qt GUITopi Reinio2020-08-281-4/+0
| | | | | | | | | | | | * Drop deprecation warnings for now-dropped items * Use the 'qt6' define and a new \nothing doc macro to conditionally document items on Qt 6 * Add a custom module header for docs that pulls in also Vulkan headers * Add \internal command for internal classes/functions * Move QtGUI-related code snippets from widgets to gui docs Change-Id: Ieb386b96631a49568d09059906d307c45c01d93a Reviewed-by: Paul Wicking <paul.wicking@qt.io>
* Remove deprecated qGenericMatrix{To,From}Matrix4x4 functionsMarcel Krems2020-08-261-24/+0
| | | | | Change-Id: I3b43d48f5324f3a1f2fff8e22bb4f9563d3ea997 Reviewed-by: Thiago Macieira <thiago.macieira@intel.com>
* Remove QVariant(int type, void *data, ...) constructorLars Knoll2020-08-151-1/+1
| | | | | | | | It was marked internal anyway. Use the constructor taking a QMetaType instead. Change-Id: I15b9cd0911aac063a0f0fe0352fa2c84b7f7c691 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Use dedicated function for chopping QByteArrayRobert Loehning2020-06-171-2/+1
| | | | | Change-Id: I03f5e782a3d5d63540db9a5fdd1d432e71b5eec5 Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
* Enable the scenegraph to remove its QMatrix4x4_Accessor hackLaszlo Agocs2020-06-031-0/+17
| | | | | | | | | 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>
* Revert "Remove flagBits from QMatrix4x4"Fabian Kosmale2020-03-041-102/+462
| | | | | | | | | | | This reverts commit 5ebb03c47604e0597502fbe1069de636987f33fc. Reason for revert: Removing flagBits breaks the batchrenderer in declarative, which accesses them via QMatrix4x4_Accessor. If flagBits are still going to be removed, we need to first find a solution for the renderer. Change-Id: Ib0a3fc7a327926f2245058c0e2ed30e8789aa75d Reviewed-by: Simon Hausmann <simon.hausmann@qt.io> Reviewed-by: Ulf Hermann <ulf.hermann@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Remove flagBits from QMatrix4x4Jarek Kobus2020-02-281-462/+102
| | | | | Change-Id: I14a22f3272b4793abd1e1b448351c94d3e07e946 Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io>
* Get rid of QMatrixJarek Kobus2020-02-281-57/+0
| | | | | | Task-number: QTBUG-81628 Change-Id: Iad66bfdf49b9ee65558a451108c086fc40dc3884 Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Deprecate all methods that use QMatrixJarek Kobus2020-01-281-0/+10
| | | | | | | | | | | Don't use QMatrix in implementation classes anymore. Task-number: QTBUG-46653 Fixes: QTBUG-81627 Change-Id: I4806c1302e42645dc6a608062c8d9c336ae8629b Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io> Reviewed-by: Laszlo Agocs <laszlo.agocs@qt.io> Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Replace most use of QVariant::type and occurrences of QVariant::TypeOlivier Goffart2020-01-231-1/+1
| | | | | | | | | | | | | | | | | | | | | I made a clazy automated check that replaced the use of QVariant::Type by the equivalent in QMetaType. This has been deprecated since Qt 5.0, but many uses were not yet removed. In addition, there was some manual changes to fix the compilation errors. Adapted the Private API of QDateTimeParser and QMimeDataPrivate and adjust QDateTimeEdit and QSpinBox. QVariant(QVariant::Invalid) in qstylesheet made no sense. But note that in QVariant::save, we actually wanted to use the non-user type. In the SQL module, many changes were actually reverted because the API still expects QVarient::Type. Change-Id: I98c368490e4ee465ed3a3b63bda8b8eaa50ea67e Reviewed-by: Lars Knoll <lars.knoll@qt.io>
* Prefix textstream operators with Qt::Lars Knoll2019-05-021-5/+5
| | | | | | | As the non prefixed variants are deprecated Change-Id: I2ba09d71b9cea5203b54297a3f2332e6d44fedcf Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io>
* doc: Add missing template clauses in qmatrix4x4.cppMartin Smith2018-01-121-2/+2
| | | | | | | | Added a few missing template clauses to member functions and friends. Change-Id: Ie5ca557ddcc1dfd90ef5e80fc4e8213dfb32a03c Reviewed-by: Topi Reiniö <topi.reinio@qt.io>
* Use qRadiansToDegrees() and qDegreesToRadians() more widelyEdward Welbourne2017-07-051-3/+3
| | | | | | | | | | | | | | | | Especially in examples, where we should show off our convenience functions, prefer calling these functions over doing arithmetic with M_PI (or approximations thereto) and 180 (give or take simple factors). This incidentally documents what's going on, just by the name of the function used (and reveals at least one place where variables were misnamed; the return from atan is in radians, *not* degrees). Task-number: QTBUG-58083 Change-Id: I6e5d66721cafab423378f970af525400423e971e Reviewed-by: Jüri Valdmann <juri.valdmann@qt.io> Reviewed-by: Allan Sandfeld Jensen <allan.jensen@qt.io> Reviewed-by: Marc Mutz <marc.mutz@kdab.com>
* Doc: Fix link errorsNico Vertriest2017-04-191-2/+2
| | | | | | | | qimage.cpp:2127: warning: Can't link to 'isDetached()' qmatrix4x4.cpp:1933: warning: Can't link to 'operator()()' Change-Id: I93a2ead9650faf139040173f8d3b24cfa1e730ae Reviewed-by: Martin Smith <martin.smith@qt.io>
* Updated license headersJani Heikkinen2016-01-151-14/+20
| | | | | | | | | | | From Qt 5.7 -> LGPL v2.1 isn't an option anymore, see http://blog.qt.io/blog/2016/01/13/new-agreement-with-the-kde-free-qt-foundation/ Updated license headers to use new LGPL header instead of LGPL21 one (in those files which will be under LGPL v3) Change-Id: I046ec3e47b1876cd7b4b0353a576b352e3a946d9 Reviewed-by: Lars Knoll <lars.knoll@theqtcompany.com>
* Doc: Corrected link issues in qtbaseNico Vertriest2015-09-041-2/+0
| | | | | | Task-number: QTBUG-43810 Change-Id: I0a019becc53b222cb6a7df1fafdccd57aca5b598 Reviewed-by: Martin Smith <martin.smith@digia.com>
* Use QDebugStateSaver to restore space setting in stream operators.Friedemann Kleint2015-03-301-1/+2
| | | | | | | | Returning dbg.space() breaks formatting on streams that already have nospace() set. Change-Id: I55e38b018679a67eb40be6b4664505483a3a7d8e Reviewed-by: David Faure <david.faure@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>
* 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-261-19/+25
| | | | | | | | 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>
* Use C++ <cmath> instead of <math.h>Allan Sandfeld Jensen2015-02-161-8/+8
| | | | | | | | | | | | | | 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>
* Update copyright headersJani Heikkinen2015-02-111-7/+7
| | | | | | | | | | | | | | | | | | 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>
* [QMath3D] Add public c-tors that do not initialize the contentsKonstantin Ritt2015-02-041-0/+8
| | | | | | 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-281-0/+12
| | | | | | | | - a convenience method thats checks if the matrix has no projective coefficients. Change-Id: Ieea8ac2e4237b471a683ad5010672b1e89a0c953 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Update license headers and add new license filesMatti Paaso2014-09-241-19/+11
| | | | | | | | | - 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-161-0/+46
| | | | | | | | | | | | | 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>
* Doc: Adding mark-up to boolean default values.Jerome Pasion2013-10-081-4/+4
| | | | | | | | | | | | | | | | | 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>
* Update copyright year in Digia's license headersSergio Ahumada2013-01-181-1/+1
| | | | | Change-Id: Ic804938fc352291d011800d21e549c10acac66fb Reviewed-by: Lars Knoll <lars.knoll@digia.com>
* Make the documentation more explicit an talkativeLaszlo Papp2012-12-071-7/+9
| | | | | | 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-031-0/+2
| | | | | | | | | 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>
* Change copyrights from Nokia to DigiaIikka Eklund2012-09-221-24/+24
| | | | | | | | 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-091-9/+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-071-161/+196
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Get started with patching up the Qt GUI docsGunnar Sletta2012-06-281-0/+1
| | | | | | | | 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>
* Remove the usage of deprecated qdoc macros.Casper van Donderen2012-03-021-3/+3
| | | | | | | | | | | 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 "All rights reserved" line from license headers.Jason McDonald2012-01-301-1/+1
| | | | | | | | | | 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>
* Update contact information in license headers.Jason McDonald2012-01-231-1/+1
| | | | | | | Replace Nokia contact email address with Qt Project website. Change-Id: I431bbbf76d7c27d8b502f87947675c116994c415 Reviewed-by: Rohan McGovern <rohan.mcgovern@nokia.com>