summaryrefslogtreecommitdiffstats
path: root/src/render/backend
Commit message (Collapse)AuthorAgeFilesLines
...
* Indicate light typeLaszlo Agocs2015-12-071-0/+2
| | | | | | | | | | | | Having a dedicated type field is required not just to make the shaders cleaner but also to avoid incorrect results when lights get moved around in the scene. Currently the shaders rely on the direction uniform to distinguish directional lights from the others, but this cannot work when the elements in the lights uniform array change, potentially leaving type-specific members like direction set when a point light takes the same index. Change-Id: I170e4b471c8cd9b4a23eca49690239c01944b3e6 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Set lightCount properly with multiple Light componentsLaszlo Agocs2015-12-041-5/+4
| | | | | | | | | It was still based on the old assumption that each entity will have at most one light component only. This is not true anymore so use the correct count. Change-Id: I17d709aed60ec160062bacf1d9de30bea51f5d28 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Unify the default and phong shadersLaszlo Agocs2015-12-011-6/+6
| | | | | | | This also means that (Q)PhongMaterial is now lights capable. Change-Id: I8191fa6dfe96dadafdc9a2db47066650a8c96ee6 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Fix warning, this QChar ctor is deprecatedKevin Ottens2015-12-011-1/+1
| | | | | Change-Id: I42fab1c8d0cb225c6ba0ed14deb6a3b66498702f Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Clean up the shader directoryLaszlo Agocs2015-12-011-6/+6
| | | | | | | | Probably long overdue. Remove unused variants and rename diffuse to default. Change-Id: Ib94f1ba448f8bbfb7b10c7e4ca8bb90b1111a284 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Let There Be LightLaszlo Agocs2015-12-012-13/+10
| | | | | | | | | | | | | | | | Now with 100% more specular components. Enable proper lights in the default material. May break example since parameters like lightPosition, lightIntensity and diffuse do not exist anymore. The light calculation function is rearranged to have the diffuse and specular colors as output parameters. This way the diffusemap, diffusespecularmap, etc. materials can be migrated easily later on. Change-Id: Id0c69467aaaf6865d554aa2c4f302df7aab6563c Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Set number of lights on the fallback pathLaszlo Agocs2015-11-301-0/+1
| | | | | Change-Id: I768d701656d29d99d74eedab08df0be9939f034e Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Allow multiple lights per entityLaszlo Agocs2015-11-272-20/+25
| | | | | Change-Id: I60a36fe289991143e82ac89f44f4dfbc59e01355 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Add a default point light when none was specifiedLaszlo Agocs2015-11-261-0/+6
| | | | | | | Equivalent to what the default material provides. Change-Id: Id38deff0b341250b4d2befae75bd4d44f18daab0 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Lights: set uniformsLaszlo Agocs2015-11-261-3/+18
| | | | | | | | | | | | | | | Assumes the following in the shaders: const int MAX_LIGHTS = 8; struct Light { vec3 position; ... // properties from QLight and its subclasses }; uniform Light lights[MAX_LIGHTS]; uniform int lightCount; // only when dynamic indexing is supported Change-Id: I8f5e9c6718110594f220f79e81f48b48213555f2 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Expose eye position as a uniformLaszlo Agocs2015-11-262-0/+8
| | | | | Change-Id: Ica74c5c1fe79a849dcd0dab8c57f47ea70311424 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Lights phase 1: infrastructureLaszlo Agocs2015-11-268-7/+129
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Add we mean it to the vao private headerLaszlo Agocs2015-11-251-0/+11
| | | | | Change-Id: I97908683dafe265f0d9f2e159362ee0c52488d7d Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Do not crash on null vaoLaszlo Agocs2015-11-241-1/+2
| | | | | | | | On systems without VAO support the pointer is null. This is the case of plain GLES2 systems, like the Raspberry Pi. Change-Id: Id4b608ce0001c6d499c7c808182649bd14c485e0 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* RenderView: use FrameGraph to decide when frustum culling should be donePaul Lemire2015-11-242-1/+6
| | | | | Change-Id: I366876f68040dd571524d9d7137a2f7916a5b757 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* RenderView: frustum cullingPaul Lemire2015-11-242-13/+38
| | | | | Change-Id: Iacfcfce5d4a339acd29bcaacffb38ce339220ad2 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* QRenderAspect/Renderer: refactored to use the AbstractRenderer interfacePaul Lemire2015-11-245-101/+81
| | | | | Change-Id: I662577e6dd337b1f056f73b4a11262e902d4dde2 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Add AbstractRenderer interfacePaul Lemire2015-11-242-1/+128
| | | | | | | | | | | | The goal is to make the Renderer a subclass of this interface. That way the QRenderAspect can abstract all the rendering part, which will allow us to not be tied down to the rendering technology. We can imagine in a later step that we could add support for DirectX/Vulkan or any other rendering API by just creating a new IRenderer implementation. Change-Id: Ie3bd59f5d06c579da81b6e3553f26f1da765101f Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* TrianglesExtractor: store triangle vertices in CW orderPaul Lemire2015-11-241-8/+8
| | | | | Change-Id: Ie73abf79f4314d036c6abc353167528852390091 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* TriangleExtractor addedPaul Lemire2015-11-243-2/+592
| | | | | | | | Will allow to retrive a vector of TriangleBoundingVolumes given a GeometryRenderer/Geometry/Attributes and Buffers Change-Id: Ieb1040b2c190ef2a8c03b92e2ecb8739832d7b43 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* jobs benchmarksPaul Lemire2015-11-242-31/+33
| | | | | Change-Id: I0585281d2ba3e109b8ab8e45762e5101f7ea2163 Reviewed-by: Sean Harmer <sean.harmer@kdab.com>
* Change annoying debug print to qCDebugLaszlo Agocs2015-11-231-1/+1
| | | | | Change-Id: I3f2b3984a33db9e56cb6d5f4000b54fed37c0d75 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Track whether the vao has had attributes specified or notSean Harmer2015-11-235-20/+120
| | | | | | | | | | | | | | | | In some cases the VAO was being created but there wasn't any input attributes specified on the shader at that time which skipped the specification of the attributes in updateBuffersAndAttributes(). We now track whether the VAO has been specified as part of the VAO object itself. This way, the first time the VAO is actually used to draw something we can ensure the attributes have been specified. Also skip the draw calls if the primitive count is zero. Change-Id: Iad0a1cff4677ab33369057a6000f0f4a18dc5c58 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Entity: make bounding volumes getter constPaul Lemire2015-11-201-3/+3
| | | | | Change-Id: I7b4f96351ec889d4817762f7de6d6378eaf0e14a Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* TriangleBoundingVolume addedPaul Lemire2015-11-203-2/+285
| | | | | Change-Id: I82ed00b73595330df9a6b7b870433e5c919a99a0 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* PlatformSurfaceFilter/Renderer: render only when surface is exposedPaul Lemire2015-11-203-2/+19
| | | | | Change-Id: Idec2f0ee5f3ace590421698293742932e8843aae Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Change scale property to scale3D and provide uniform scale propertySean Harmer2015-11-161-2/+2
| | | | | | Change-Id: I34625b2b8beab9b7bd5b2dde44666614c35632e7 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Update transformation matrix from the scale, rotation and translationSean Harmer2015-11-162-7/+24
| | | | | | | | | | | | | | The transformations are applied in the following order: 1) Scale 2) Rotation 3) Translation When we come to decompose this will be important. Change-Id: I11e4b76f402fc0e9eef273d99f5975084400b4e1 Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Update backend Transform properties from frontend changesSean Harmer2015-11-162-0/+14
| | | | | | Change-Id: I76f3612d8d09060e09e6cd739751dcabcfd86a8f Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Updated comment for better understanding of the codePaul Lemire2015-11-161-2/+1
| | | | | | Change-Id: If6a5be9bbabd61da4464b1b1dd4b94551a8e5053 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Entity: add a boundingVolumeDirty flagPaul Lemire2015-11-162-16/+36
| | | | | Change-Id: I175a2bd4ed2ed59f070b8371495cc573941f1c1d Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Entity: add hasChildren methodPaul Lemire2015-11-161-0/+1
| | | | | Change-Id: I0580578ca27b8b32ddf3d8c29b5bab192e24c166 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Export EntityManager for unit testsPaul Lemire2015-11-161-1/+4
| | | | | Change-Id: I67866ea75e39a2c20b6422deb067c792cee9ff36 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Renderer: use NodeManagersPaul Lemire2015-11-166-237/+123
| | | | | Change-Id: I8d505034b24c3ec00b93ace02e5a4fe450939478 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* NodeManagers class addedPaul Lemire2015-11-163-2/+589
| | | | | | | | | The Renderer will have an instance of it so that the managing nodes part can be removed from the Renderer class (should make it easier to test in the long run). Change-Id: Ia85833adff5d0bb383b6cb7bc44869141e1d4985 Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Renderer: fix empty VAO casePaul Lemire2015-11-161-6/+8
| | | | | | | | | | | | | | | Under some cases a VAO could be allocated but never created as at a given point in time there was no attributes found for the current shader (which can happen if the shader isn't yet loaded). Then the next frame, the attributes would have been loaded and the VAO allocated and the renderer would assume then that the VAO had been created. Eventually that would then crash as a draw call would be performed with an empty and never created VAO. Now check that a VAO is created and if not request creation to make sure that the VAO is always created when setting the attributes/trying to draw. Change-Id: Idf3fa45fabc574c0a0e82a38283c5848b32e15a4 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Entity: add reference to QBoundingVolumeDebug componentsPaul Lemire2015-11-162-0/+30
| | | | | | 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-162-59/+70
| | | | | | Change-Id: I404d35ff9e159d47c53660220cf5899b6df1cf89 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Renderer: add a boundingVolumeDebugManagerPaul Lemire2015-11-162-0/+4
| | | | | | Change-Id: I33f0b1e01b20ffcf56fe0c758e07b99f410dba40 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Handle type for BoundingVolumeDebugPaul Lemire2015-11-161-0/+2
| | | | | | Change-Id: I52d1e770855d402f0403baf159ef824204d2d947 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Manager for BoundingVolumeDebug componentsPaul Lemire2015-11-161-0/+11
| | | | | | Change-Id: I6381480d080bb3160035b190d94a9593aad3d9ab Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* BoundingVolumeDebug backend node addedPaul Lemire2015-11-163-2/+206
| | | | | | Change-Id: Ifd869107ce102ed4b962d2be35f793e9c72a60d6 Reviewed-by: Paul Lemire <paul.lemire@kdab.com> Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Make BackToFront sorting workLaszlo Agocs2015-11-133-1/+7
| | | | | | Change-Id: I9f2442b49d825a36bef7036ee0893a17464bd73c Reviewed-by: Sean Harmer <sean.harmer@kdab.com> Reviewed-by: Andy Nichols <andy.nichols@theqtcompany.com>
* Create proper plugin infrastructure for sceneloadersAndy Nichols2015-11-042-22/+10
| | | | | | | | Now Qt3D sceneloaders plugins follow the same pattern as the rest of Qt. This also makes the loading much more standard and less error prone. Change-Id: Ibb5aae0a16d9d197a9c34fe2885dd5435e68d7eb Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Remove some uncessary QOpenGL* includesAndy Nichols2015-11-031-2/+0
| | | | | | | These includes seem to be left over from previous iterations. Change-Id: I58945b72c354bfa8ebbe687d52d3eb146f021f70 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* Rename QOpenGLFilter to QGraphicsApiFilterAndy Nichols2015-11-032-3/+3
| | | | | | | | | | | | | | | | | | | | | | This API change is part of an effort to remove anything specific to one graphics API (in this case OpenGL) from the public APIs. In addition to the name of the class being changed, the QGraphicsApiFilter::Api has been refactored to reference the Graphics API, rather than an OpenGL API. Now this list includes OpenGL, and OpenGLES, but could also include Vulkan, DirectX, or any other graphics rendering API we wish to support in the future. Right now the properties in this class are still reflective of the OpenGL APIs, and may need to be extended with other properties in the future for other rendering technologies. The QGraphicsApiFilter::Profile enum has also been changed to be more more clear. So for now there are enums NoProfile, CoreProfile, and CompatibilityProfile. Task-number:QTBUG-49078 Change-Id: Ib5f9c3b7adee5badec6bce8a12b23683eb43b4cb Reviewed-by: Laszlo Agocs <laszlo.agocs@theqtcompany.com> Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QAspectManager: Explicitly mark as private APIAndy Nichols2015-10-303-3/+0
| | | | | | | Also remove some unnecessary includes. Change-Id: I35539566e530f7800bbbe7884be65a93a7ee91eb Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* d-pointer classes, private/public changesTomi Korpipää2015-10-302-4/+4
| | | | | | Change-Id: I4ca133aebad0c088296ab293f95f0a6d76d18395 Task-number: QTBUG-39946 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>
* QNode: Introduce enabled propertyAndy Nichols2015-10-273-0/+28
| | | | | | | | | | | | | | | | | 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>
* Move picking into its own directorySean Harmer2015-10-255-438/+2
| | | | | Change-Id: I4982f08d18c855a57f621af28b13cc876f20eb16 Reviewed-by: Paul Lemire <paul.lemire@kdab.com>