summaryrefslogtreecommitdiffstats
path: root/src/render/backend/entity.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Integrate EnvironmentLight with EntityKevin Ottens2017-02-241-0/+32
| | | | | | | This will be needed to gather the environment lights in the scene. Change-Id: Icabcfb378c4938448bd241460b0f3fa3811c0287 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* LevelOfDetail (LOD) nodeMike Krus2017-01-231-0/+32
| | | | | | | | | | | | | | | | | | | Component to control complexity of entities based on either distance to camera or size on screen. Given a specific camera, the LevelOfDetail computes the distance to the observer, or the screen size of the entity. The currentIndex property is updated to identify which of the entries in the provided array of distance or size ranges contains the current value. A disabled LevelOfDetail component will act as a simple (user controlled) switch. Updates are not done on disabled sub trees since their bounding boxes may not be valid. Change-Id: Ifa4c088de6b80b6a6ed203070411761574686cdb Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Correct filtering of disabled entitiesWieland Hagen2017-01-051-0/+1
| | | | | | | | | | | | | FilterLayerEntityJob would not check for the enabled-ness of parent entities, if present. We introduce another job that checks for each entity, whether it is enabled or not. Jobs that need to access this flag must take care to add a dependency on the UpdateTreeEnabledJob Task-number: QTBUG-56235 Change-Id: Ic087fc8e9efdd4829cdb18ae3e8430344f6ecf43 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Entity: fix -> properly clear childrenHandles vectorPaul Lemire2016-08-161-1/+2
| | | | | | | | | | | | | When cleanup is called that means an Entity needs to be recycled for reuse later on. The children handles vector wasn't cleared which resulted in it containing invalid handles when the Entity element was reused. In turn that eventually resulted in asserts in the handle manager when that Entity was released again (which explains crashes with the QSceneLoader changing sources). Change-Id: Ic2e69132e4a5186f92936593ddcf3da72a7e1446 Task-number: QTBUG-54889 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Remove qboundingvolumedebugSean Harmer2016-08-041-1/+0
| | | | | | | | | | | Wasn't being built anyway which led to a warning with moc. We should rethink how we do such debug rendering so as to not hardwire a Layer component and make it work with other framegraphs not implementing a simple forward renderer. Can revert this in the future as a starting point if needed. Change-Id: I055310f440b49f144a5ab635122f2193b8c5ac12 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Entity: add simple method to check for componentsPaul Lemire2016-06-271-0/+1
| | | | | Change-Id: I560089e499aa8e98415b00b3131a5e9923c1a551 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Entity: use QVector for componentsHandle/renderComponentsPaul Lemire2016-06-271-20/+12
| | | | | Change-Id: I8b7b53be17c91dbafeb46a6537b236a60f374f10 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Entity: use NodeAdded to update the childrenHandlesPaul Lemire2016-05-251-0/+18
| | | | | Change-Id: I85d78d99c18544944ffae11eaf76e89a54d5e828 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QNodePropertyChange -> QPropertyUpdatedChangeSean Harmer2016-05-101-1/+1
| | | | | | Task-number: QTBUG-51494 Change-Id: Ic326499f80b5a91b2d19c09770de926f220cc805 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Remove NodeAboutToBeDeleted change type enum valueSean Harmer2016-05-051-1/+1
| | | | | | | | This is not needed and was not used anywhere in any meaningful way. Task-number: QTBUG-51494 Change-Id: I6b09fb248f48ec844bfebcf2c0013f0bf8478f18 Reviewed-by: Kevin Ottens <kevin.ottens@kdab.com>
* Remove QBackendNode::updateFromPeer()Sean Harmer2016-05-031-34/+0
| | | | | | | | | | Implemented a few missing initializeFromPeer() implementations along with the corresponding frontend node creation change creation functions. Adapted unit tests. Change-Id: I571e53a7b68a5544bd0e308df0baf7e52533306e Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Remove virtual QBackendNode *create(QNode *frontend) constSean Harmer2016-05-011-11/+0
| | | | | | | | from QBackendNodeMapper and subclasses. No longer needed now we have disabled cloning. Change-Id: I261fa7bccfa9a4019d479079e2ff7c19154e5e72 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Q_NULLPTR -> nullptrSean Harmer2016-05-011-17/+17
| | | | | | Task-number: QTBUG-52736 Change-Id: I58f9cbcdf018e7b672d33dd865067485412b79fe Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QAbstractLight now inherits directly QComponentKevin Ottens2016-04-281-1/+1
| | | | | | | | | | | | | We are turning the relationship between QAbstractLight and QShaderData from a "is-a" to a "has-a". For that we relay all the properties of the light to its internal shader data dynamic properties. Interestingly it also removes a couple of special handling for lights which aren't needed anymore. Change-Id: Ia937b8934f94ce318e02901d90ac340e172cbc75 Task-number: QTBUG-51489 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Rename QLight to QAbstractLightKevin Ottens2016-04-281-3/+3
| | | | | | Change-Id: I3ee3f6e3c9eef554fce7d79407825894b1be2450 Task-number: QTBUG-51489 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* render/backend: eradicate Q_FOREACH loops [low-risk]Marc Mutz2016-04-281-9/+11
| | | | | | | | | | | | | | | | ... by replacing them with C++11 range-for loops. To avoid detaches of these mutable Qt containers, wrap the container in qAsConst(), where needed. This is the batch with low-risk changes. They operate on local containers or the loop body clearly does not cause the container to change. Saves 8.3KiB (2.8%) in text size on optimized GCC 5.3 Linux AMD64 builds. Change-Id: I7e4f8390b7530981185ad65d152b267e18a88c90 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Move defaults and geometries out of Qt3DRender and into Qt3DExtrasPaul Lemire2016-04-231-16/+16
| | | | | | | QBoundingVolumeDebug has been disabled for now. Will be re-enabled later on. Change-Id: Id6b0abab2ec2aa697330bd20d782f9d104d25d50 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Rename QScenePropertyChange -> QNodePropertyChangeSean Harmer2016-04-211-1/+1
| | | | | | | Trying to unify naming of change types. Change-Id: I0bfca0b7ba5adeaaa6145f75ddb41731f76adc09 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Use new component added/removed changesSean Harmer2016-04-201-8/+9
| | | | | Change-Id: I31d1d60fad2ed85bcb7b9cac956b36b89e6bfb1e Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Entity: use m_enabled member from QBackendNodePaul Lemire2016-04-151-22/+2
| | | | | | | Also make sceneChangeEvent call BackendNode::sceneChangeEvent Change-Id: Ic5be546dadc116af07f02cfe39c4bcfb76d2281a Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Render::Entity initializes from creation changeSean Harmer2016-03-311-0/+70
| | | | | Change-Id: Iafc679ea1f495d9c1ad2c1a434cd2ebb9ec803dd Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* RenderEntityFunctor handles creationSean Harmer2016-03-301-0/+10
| | | | | Change-Id: I49f06a618ba4356fa723f70b3ff5598b9d9ccea6 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Make QBoundingVolumeDebug privateMike Krus2016-03-131-1/+1
| | | | | | | | QML type exported though, need to decide where/how to hide it Change-Id: I2d341456c3e09101da895ccd4a925f85a01089b0 Task-number: QTBUG-51449 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* QComputeJob cleanupPaul Lemire2016-03-051-5/+5
| | | | | | | | | | | * Renamed to QComputeCommand * Removed protected ctor * Added x,y,z workgroup properties * Renamed backend elements to match frontend Change-Id: I3959ec671a7d6e86239f72336f02452ea58919ee Task-number: QTBUG-51514 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QBackendNode::peerUuid() renamed to peerId()Paul Lemire2016-03-051-7/+7
| | | | | Change-Id: I72471d0b22d16bbbee33610e30a06daadffedbd9 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Fix uses of inefficient QList<QNodeId>Marc Mutz2016-03-011-3/+3
| | | | | | | | | | | | | QNodeId is a 64-bit type, so holding it in QList on 32-bit platforms is horribly inefficient. Fix by porting to QVector instead. [ChangeLog][Important Behavior Changes] QNodeIds are now passed and accepted in QVectors, not QLists. Change-Id: I3cbe35d639eb2ddf9d106294f542f65b431dc4a4 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Remove ParameterMappingPaul Lemire2016-02-261-1/+1
| | | | | | | | | | | | | | * Bindings are now entirely deduced from shader introspection * Modified the BackendNodeDirtyFlags to remove the class at this prevents the operator~() to be called * Make the Renderer loop check for the ComputeDirty flag and don't unset it if set Note: uses a hack to reset m_changeSet in performCompute as right know we are sometimes missing the markDirty(ComputeDirty) set by the ComputeJob nodes. Will be sorted out later. Change-Id: Ic4fa71ecf01b625e885a58a66278387bf5b36339 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Propagate backend node changes to Renderer; render-on-demandWieland Hagen2016-02-241-0/+1
| | | | | | | | | | | | Each sceneChangeEvent marks a dirty bit in the AbstractRenderer. If no changes were accumulated during one frame, the renderer decides not to render the frame, by returning false from shouldRender(). We still need to go through each backend node and see what flags to set exactly, and to make sure we also react on backend-initiated changes. Change-Id: I80588bc5c4ebeb5d57b45ddfbd4d79ec268968b1 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Added AbstractRenderer pointer to RenderBackendNodeWieland Hagen2016-02-241-1/+3
| | | | | | | | Modified all node functors to pass QRenderAspect's renderer instance to all newly created backend nodes Change-Id: Iffa4941bff53f6acf87f46789219c7ae2f123615 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Dedicated QRenderBackendNodeWieland Hagen2016-02-241-1/+1
| | | | | | | | | Render aspect Backend nodes now subclass from QRenderBackendNode, which is a subclass of QBackendNode. We may want to store aspect- related data in each backend node Change-Id: I4f00de09c8cc31d2347d919151d359ad44cf03a9 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* const QNodeId & -> QNodeIdPaul Lemire2016-02-221-9/+9
| | | | | Change-Id: Ia672918cbae3b950e20e68bfbfd6982676a5981e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Removed factory member variableRobert Brock2016-02-071-2/+1
| | | | | | | | | The variable was removed from QBackendNode and subsequently all areas it appeared. Task-number: QTBUG-49682 Change-Id: I5904714b55aaefbe07ee11008ff49cd1d9b89950 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Unify license header usageAntti Kokko2016-01-261-11/+14
| | | | | | | Update old header.LGPL3 to header.LGPL Change-Id: I8eac0cd6bbc276a56df487249cc459c0d4fab165 Reviewed-by: Jani Heikkinen <jani.heikkinen@theqtcompany.com>
* Move QCamera/QCameraLens to Qt3DRenderPaul Lemire2016-01-161-1/+1
| | | | | | | | Also get rid of Qt3DRender::QWindow and of the hard codes camera controller. Change-Id: I307735d01caf97b7a690b28de8dc99fc9866c35f Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Entity: add reference to QComputeJob componentPaul Lemire2016-01-131-0/+21
| | | | | Change-Id: I1a99115b78478ec143a83a2f768a7249d9038ac0 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Use QList::reserve.Volker Krause2016-01-061-0/+6
| | | | | | | | 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>
* 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>
* Lights phase 1: infrastructureLaszlo Agocs2015-11-261-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | QAbstractLight becomes QLight and gets its own backend node. This way we can easily gather all lights for the scene and filter them when building render commands. Both the frontend and backend remain a subclass of (Q)ShaderData but will not be part of the ordinary ShaderData component list. This prevents mixing up ShaderDatas and Lights but allows reusing the same underlying infrastructure so that properties can automatically be transformed for example. It is worth noting that the position property for lights is now removed: the position is determined by the entity's (to which the light component belongs) position. A number of changes are made to ShaderData itself as backend subclassing with different managers is not straightforward. For now the distance between the rendered entity and the entity with the light component is calculated and lights will be chosen based on this distance. A framegraph node for controlling this will be added in future patches. No uniform setting or shader changes are included here. Task-number: QTBUG-48834 Change-Id: I43a6c5f9420d4254d798c558bd58680b2b09eceb Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Entity: add a boundingVolumeDirty flagPaul Lemire2015-11-161-16/+32
| | | | | Change-Id: I175a2bd4ed2ed59f070b8371495cc573941f1c1d Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Renderer: use NodeManagersPaul Lemire2015-11-161-40/+40
| | | | | Change-Id: I8d505034b24c3ec00b93ace02e5a4fe450939478 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Entity: add reference to QBoundingVolumeDebug componentsPaul Lemire2015-11-161-0/+21
| | | | | | Change-Id: I338d55d8c6f81a55ecc61a247b9a1791bd25bb7d Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Entity: reorganize template functors for better readabilityPaul Lemire2015-11-161-42/+49
| | | | | | Change-Id: I404d35ff9e159d47c53660220cf5899b6df1cf89 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* QNode: Introduce enabled propertyAndy Nichols2015-10-271-0/+20
| | | | | | | | | | | | | | | | | Previously there was only and enable property for the QNode subclass QComponent, but now all QNode subclasses should also have an enable property. This means that it is now possible to disable a QEntity which would also disable all of its children. This is a bit tricky though because each Aspect needs to now check if the corresponding QEntities are disabled or not before processing. This has been accounted for with RenderEntity in the Renderer already, but will need to be respected in each Aspect. This behavior is similar to the Unity3D GameObject active property which disabled the entity and disables all components. Change-Id: I5233b2b43f04aa5dfa7910eac6a88a9da656a997 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Sphere moved into Render namespace and made privatePaul Lemire2015-10-241-1/+1
| | | | | Change-Id: I940a8ea898a338f20bb9abbebcc1fcef9830a118 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Entity: create bounding sphere with the Entity idPaul Lemire2015-10-241-9/+6
| | | | | | | | Will be needed to retrive Entity from hits reported by the RayCasting service. Change-Id: I91f1f3c2277d468c2ec60509a04095138a5eafcb Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Entity: cleaning up QNodeId doesn't require rendererPaul Lemire2015-10-241-11/+11
| | | | | Change-Id: I673cd1d8385d3e54c066fbd7dec522e4da5a9f79 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Entity: keep ObjectPicker component node idPaul Lemire2015-10-241-0/+21
| | | | | Change-Id: I30b2149b5e90c92e012b77b4101200990610d96a Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Rename Renderer -> Render throughoutSean Harmer2015-10-191-11/+11
| | | | | | | | This is for consistency between the C++ namespaces and QML imports and with the other aspects. Change-Id: I73392f138b4e519b12888f52530123e3d0ba445e Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Resurrect bounding volumesLaszlo Agocs2015-10-141-2/+3
| | | | | | | | | | | | | | For BackToFront sorting to work we need to calculate a depth value based on the entity's bounding spheres. This is currently missing as there is no AABB from which the RenderEntity's localBoundingVolume could be calculated. Bring it back. RenderEntity contains two world bounding volumes from now on: just having one that includes the children is not ideal because in some cases we want to know the entitys own bounding volume not including the children. This is the case when building render commands for example. Change-Id: I20f5bccdc3f868bcbd5faa3164f0e9995a3171ec Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Move Qt3DCore into Qt3DCore namespaceSean Harmer2015-10-131-19/+19
| | | | | | | Update other aspects, tests and examples accordingly. Change-Id: Ib1bcf0bdf4f5aec4422dc0c80bfc32b27fb1a317 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>