summaryrefslogtreecommitdiffstats
path: root/src/render
Commit message (Collapse)AuthorAgeFilesLines
* Doc: Removed Qt3DCollision namespace and module docsVenugopal Shivashankar2016-01-211-0/+2
| | | | | | | | Besides that, fixed a few qdoc warnings. Change-Id: Ibaf8fd6ffbb93f3f2bd73fa5fedf06e94f6ac2eb Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Topi Reiniö <topi.reinio@theqtcompany.com>
* GLSL 100 light include uses too many uniformsAndy Nichols2016-01-201-175/+1
| | | | | | | | With the additon of the uniforms for supporting spotlights, now it is only possible to have 2 active lights instead of 4. Change-Id: Ie9d84c85cda204f82f976fb55d8b5fe74ba58687 Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com>
* Added skeleton docs to geometry classesTomi Korpipää2016-01-2018-12/+1549
| | | | | | | Change-Id: I312b3f1eed1578899319cfc30b9bad143c5c467e Task-number: QTBUG-46037 Reviewed-by: Pasi Keränen <pasi.keranen@theqtcompany.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Don't allocate QMutex members on the heap.Volker Krause2016-01-196-21/+13
| | | | | Change-Id: I23f1ccd2f2bbee2fcab2eadfeeec83e1ac489623 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fixed some documentation warningsTomi Korpipää2016-01-193-9/+4
| | | | | | | Change-Id: I5055043641a1916dde47ad614d8ab7a5788fd93b Task-number: QTBUG-46037 Reviewed-by: Miikka Heikkinen <miikka.heikkinen@theqtcompany.com> Reviewed-by: Pasi Keränen <pasi.keranen@theqtcompany.com>
* Android: handle image from assetsBogDan Vatra2016-01-111-1/+5
| | | | | | Task-number: QTBUG-46866 Change-Id: I0f7f8bcb3afe528e9a00270025ed42e950221800 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Replace QTextStream with QString::splitRefMauro Persano2016-01-071-38/+52
| | | | | Change-Id: I0a540dfdcbe5f28df38cf406c771c828e25abd64 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Avoid unnecessary detaching.Volker Krause2016-01-072-4/+4
| | | | | Change-Id: Ied910d38c400b34a38f6eaea9683107b079513ec Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fix RenderViewJob crash on Renderer shutdownMauro Persano2016-01-071-0/+2
| | | | | | | | | | | | Set Renderer::m_running to zero to prevent crashes when Renderer::shutdown is called while a RenderViewJob is running. This only affects QtQuick/Scene3D. It's not a problem in the case of pure Qt3D, as Renderer::m_running is set to zero when Renderer::setSurface(0) is called before Renderer::shutdown. Change-Id: I41f8da7589c098c6df9d24792932a293df7982aa Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add glBlendFunci() to GraphicsContext + GraphicsHelperWieland Hagen2016-01-0713-0/+53
| | | | | | | | Only for OpenGL 4.0. Task-number: QTBUG-50005 Change-Id: I70984a2bff3afc04539efa7dea60196aa06e72d2 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Sort GraphicsContext + GraphicsHelper methodsWieland Hagen2016-01-077-210/+211
| | | | | | | They were a big mess, now they are a smaller mess. Change-Id: I4e21e340a24588370cf8b17b54ebb9e03fe07b4a Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add a few more QVector::reserve calls.Volker Krause2016-01-072-0/+3
| | | | | | | Found by heaptrack, all relevant for per-frame allocations. Change-Id: I12ef71f6bd1bca2ca78f4bfbd295265d840b4232 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Avoid expensive multiple QString::arg usage on this hot path.Volker Krause2016-01-061-4/+3
| | | | | | | | | The string operations in here are still one of the largest contributors to per-frame allocations, but at least this spot is now down to three allocations per frame and per light. Change-Id: Ieab3b882c87e8fa8d4d4dedb46a3a482ebb07d6f Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fix dynamic texture provider property handlingLaszlo Agocs2016-01-065-8/+10
| | | | | | | | The Q_PROPERTY has to include the namespace, otherwise setting properties via QObject::setProperty() will fail. Change-Id: Ifdf7012fd8b670710bac38eb0e5ce8eab057e719 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Use QList::reserve.Volker Krause2016-01-062-0/+7
| | | | | | | | The intermediate QLists are still not optimal here, as these methods are called per frame, but at least this is now down to one allocation each. Change-Id: I7705172aabc5e526c5123d70450d3ae2dec20d03 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Use QString::splitRef rather than QString::split.Volker Krause2016-01-061-1/+1
| | | | | | | This avoids countless unnecessary string allocations here. Change-Id: I5f5b474ca7b335ccb7bf1083fd85aa85e3a9e8a4 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Avoid expensive QHash::keys() call in obj loader.Volker Krause2016-01-051-6/+4
| | | | | | | | | This hurts particularly bad here as the key type is too large for QList to be efficient, causing 140k QList node allocations with my test model. Change-Id: I46b8e347520a768d71ba6ed02d161c40e3af3c59 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fix parameter mismatch in QDiffuseMapMaterialLaszlo Agocs2016-01-051-1/+1
| | | | | | Task-number: QTBUG-50126 Change-Id: Ia0f4ec12b2598f2b117cc5860c648310e2dca0b9 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Move QTextStream creation out of the loop.Volker Krause2016-01-051-1/+2
| | | | | | | | This saves one QObject allocation per line of an obj file (which tend to be quite large), for the QDeviceCloseNotifier in QTextStreamPrivate. Change-Id: Ia5762f497782ee4356c2f807dd02f9ab73eccf70 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fix target type for Texture3DSean Harmer2016-01-041-1/+1
| | | | | | | Task-number: QTBUG-50214 Change-Id: I11b18e8559b4625137874286afaa40917ea35472 Reviewed-by: Mike Krus <mike.krus@kdab.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Added QPointSize RenderStateWieland Hagen2015-12-278-3/+255
| | | | | | | | | Point Sizes may be specified 2 ways: either statically via glPointSize() (OpenGL 2.0+) or by enabling GL_PROGRAM_POINT_SIZE. Task-number: QTBUG-49997 Change-Id: I98887484cf31df01b98801e1f324487ee7bf7492 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add glPointSize() helper functionsWieland Hagen2015-12-2713-0/+67
| | | | | | | | | | OpenGL ES 2.0 doesn't support glPointSize(), but OpenGL 2.0+ does, so we need to call it though a QGraphicsHelperInterface. When on OpenGL ES 2.0, just print a warning. Task-number: QTBUG-49562 Change-Id: Icbd5f602cae38f95925d99003ec3ee9aebb3719e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fix slow down seen with long running applicationSean Harmer2015-12-221-1/+7
| | | | | | | | | | | | | | | | When Qt3D applications are left running for extended periods a gradual slow down was noticed. This turned out to be caused by spending a long time sorting the job dependencies in the thread pooler caused by an ever increasing number of dependencies. This in turn is caused by the render aspect not properly clearing out old dependencies between one frame and the next. This change fixes this kind of mistake in two places. Qt3D applications now no longer slow down over time. Change-Id: I32c258009c98120b38c8c8fa47641dcf336e9588 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Make parentEntityId privateKevin Ottens2015-12-181-1/+3
| | | | | | | | It is used only once in the whole of Qt3D and looks rather foreign to the rest of the nodes API. Change-Id: I6d8d40590a1f8a5c2019a8d16a7abff4f19ae9bb Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* The Renderer depends only on the QServiceLocatorKevin Ottens2015-12-185-11/+9
| | | | | | | | | This way the only thing Renderer knows about QRenderAspect is the enum controlling the render more (threaded or synchronous). We properly decoupled both now. Change-Id: I0023efec541d40f7b499da4355d5cd8b796d2194 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Move the time property to the rendererKevin Ottens2015-12-187-12/+21
| | | | | Change-Id: I60adff0ece408bb4ee21b9cbd329e21da2c1f95c Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Pass the QBackendNodeFactory to setSceneRootKevin Ottens2015-12-184-7/+5
| | | | | | | This helps to reduce the dependencies from the Renderer to the QRenderAspect. Change-Id: Id54e38642061f787649ba3794cafb8b8bbbde3f1 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Destroy allocators in aspect not the rendererKevin Ottens2015-12-184-3/+4
| | | | | | | | | Otherwise it was creating a weird confusion of responsibility. The aspect asked for the creation of the allocators while the renderer itself was asking for their destruction. Change-Id: Ib06a315b39dc654d5a9bb97d4d2153884c457443 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Make QBackendNodeFactory privateKevin Ottens2015-12-171-8/+9
| | | | | Change-Id: I0edb9fb0444d8a4a9b77550d5dd32d36d501683c Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Move services() and jobManager() to the pimplKevin Ottens2015-12-173-7/+11
| | | | | | | This way we avoid leaking private types through public API. Change-Id: Ifb30d7e57d8b995bba8cf9a95ae77f8d7818d79a Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Remove QAbstractAspect::setRootEntityKevin Ottens2015-12-172-5/+3
| | | | | | | We switch to a more resilient private virtual instead. Change-Id: I90710c7873571ca0a40f7cc939282344b20a59f0 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Remove useless reimplementationsKevin Ottens2015-12-162-10/+0
| | | | | Change-Id: I0b19646de41014274674c75650028980076b8349 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Change the idiom to clear null job dependenciesKevin Ottens2015-12-162-2/+2
| | | | | | | | | | The "clearNull" method is kind of surprising so make QAspectJob API more usual. Also the "clearNull" method was only used twice so change the idiom to go through removeDependency if that one receives a null pointer. Change-Id: Ib74e1054ba52754b1a19d6c3e9268fa9ff14edaf Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add we mean it headersLaszlo Agocs2015-12-151-0/+11
| | | | | Change-Id: I0ad651a68441d3cd0f836c37304cdcb1effac455 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add missing precision qualifiersLaszlo Agocs2015-12-153-3/+3
| | | | | Change-Id: I362d40cc7861551b49d97120751b107d3d7f674e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Remove initialize/shutdown from APIv5.6.0-beta1Kevin Ottens2015-12-141-1/+0
| | | | | | | | Hiding them in QAspectEnginePrivate and calling them when needed from setRootEntity. Change-Id: I4c3dfb19d84ae90cc15bbff29a4abd0705bb61dc Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Turn all services private for nowKevin Ottens2015-12-126-5/+6
| | | | | Change-Id: I9da605c77c5489b9bef4f07079e05f8babb9559f Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Rename Q3D*Event to Q*Event and handle namespaceMike Krus2015-12-102-2/+0
| | | | | | | | Q3DMouseEvent, Q3DWheelEvent, Q3DKeyEvent Also removed unused variables and fixed some formatting Change-Id: Ie4c531f2084875fe4d8b6ac9bafd2b3c085dead4 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Move all raycasting code as private in Qt3DRenderKevin Ottens2015-12-1025-143/+886
| | | | | Change-Id: I871cbc57166493f30ea307305d8664e2f8a8873f Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Bring the GLSL 1.00 fallback shader up-to-dateLaszlo Agocs2015-12-101-35/+170
| | | | | | | | | Add support for spotlights and increase the number of lights supported from 3 to 4. It is now on feature parity with the normal lighting shader code. Change-Id: I784ffb8bd0142253b5c8980e654fa25d683d93f0 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Reduce specular reflectivity defaultsLaszlo Agocs2015-12-106-7/+7
| | | | | | | | 0.95 -> 0.01 to prevent eye-poppingly white specular highlights. Change-Id: I3e765bad13afe991053932e73cea13b95c950c1c Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Do lighting calculation in world spaceLaszlo Agocs2015-12-1033-155/+116
| | | | | | | | | | | | | | | | As opposed to (mostly) camera space. Oops. While somewhat hidden with point lights, the problem became apparent with directional lights. Now that we have proper directional lights, change the default light, that is used when no light components are specified at all, from point to directional since this is cheaper and provides less surprises with arbitrary scenes. Also remove the duplicate phongalpha vertex shader in the process. Change-Id: I295660a1400b16b69e1516672e31794312ee48d1 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add support for spotlightsLaszlo Agocs2015-12-097-34/+59
| | | | | Change-Id: I61a4e072c1a2e00cdbcee917aa557e56fb8cb7c0 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fix Rendering to Scene3D on Raspberry Pi (maybe other ES2 devices)Andy Nichols2015-12-091-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | When using an external FBO like in the case of Scene3D, we try to get the query the size of the FBO's color attachment so that we can call glViewport in the case that there are multiple viewports. For ES2 this is problematic because it is not possible to query the size of a GL_TEXTURE attachment (which the attachment will normally be if there is no multi-sampling). When the query is not possible we simply return without calling glViewport. On ES2 it is possible to query the size of a RenderBuffer and this has been implemented for this code path. As an oddity in the VideoCore OpenGL drivers for the Raspberry Pi, when we query the type of the color attachment for the FBO, it returns the type as RenderBuffer even though we created it as a GL_TEXTURE (likely because they are the same in the driver). This creates an issue though because when we query the size of the RenderBuffer it returns a height and width of 0, which we then use to call glViewport, leading to nothing being rendered into the FBO. This commit checks the validity of the size before making the call to glViewport. Change-Id: I0c3235afd7bcc7fe70ca0dda0379b1ceb2cdab38 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Added parameters to signals and made setters Q_SLOTSTomi Korpipää2015-12-09142-708/+1080
| | | | | | Change-Id: Icec2f9f207221e35ffdeeb594bb9b4dc6ef890f1 Task-number: QTBUG-49797 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Make QFrameAllocator privateKevin Ottens2015-12-083-3/+3
| | | | | Change-Id: Id69a161da691322184d8ec5ed7a1b375cf2038ed Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QRenderAspect: register ComputeDispatch backend nodePaul Lemire2015-12-071-0/+3
| | | | | Change-Id: I1e84bc9dd02ae2c0b4f7c180f0043b4a734d78fd Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* BackendNode for QComputeDispatchPaul Lemire2015-12-074-3/+179
| | | | | Change-Id: I41a027b073ee5cb253f7b37244ad887acff4f909 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add QDispatchCompute framegraph nodePaul Lemire2015-12-073-2/+216
| | | | | | | | Will be used to dispatch a compute job if the renderer is compatible with compute shaders (OpenG 4.3) Change-Id: I7846d3b58d6aed06276aa34e841245ce1154fdd8 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Separate GLSL 1.00 and newer shader snippets for lightsLaszlo Agocs2015-12-075-55/+331
| | | | | | | | | | | | | | | | | | | | Many but not all OpenGL ES 2.0 implementations support dynamic indexing. For these the normal for loop is fine. For simple GLSL 1.00 compilers without dynamic indexing support (e.g. RPi) a separate, limited version is provided that supports a lower number of lights and uses copy-paste instead of the loop. Right now there is no sane way to choose which snippet to use as that requires the OpenGL context at minimum (and even then we could only rely on vendor/renderer checks). Therefore a QT3D_GLSL100_WORKAROUND environment variable is used for now. This is temporary until we figure out something more sophisticated. The default GL2/ES2 lighting shader is now equivalent to the GL3 version, supporting up to 8 lights. Change-Id: I0244c920a1f2c2516b130991996afca68207a7db Reviewed-by: Sean Harmer <sean.harmer@kdab.com>